1

I want to build a Ruby gem to collect all local gems in a project, I don't know the best practice for that.

should i parse the Gemfile somehow and get the gems list from it? or there are libraries to make that?

also, How can i make my gem global, just like Linux commands, what i mean is if my gem name is gemlocator and i put it on specific place in my Linux environment, it will enable me to open the terminal and cd to my Ruby project then write gemlocator to list the gems used in the project.

Moustafa Elkady
  • 670
  • 1
  • 7
  • 17
  • 1
    Does this question relate ? https://stackoverflow.com/questions/5177634/list-of-installed-gems If I understood what you mean by `collect`, so it may be helpful. Also you can use `bundle show` or `bundle list`. did you try that? – Mahmoud Sayed Jun 14 '17 at 07:50

1 Answers1

1

You can parse your Gemfile using Gem::Specification. The class contains all information of the gem.

Gem::Specification.map {|gem| gem.name}
slal
  • 2,657
  • 18
  • 29