Created
May 21, 2014 00:55
-
-
Save havenwood/1d38d30cc3d185580ac7 to your computer and use it in GitHub Desktop.
Find Bundler gems in a given dependency group.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
class Gemfile | |
def initialize gemfile_path = 'Gemfile' | |
@bundler = Bundler::Dsl.new | |
@bundler.eval_gemfile gemfile_path | |
end | |
def gems group | |
@bundler.dependencies.select do |gem| | |
gem.groups.include? group | |
end.map &:name | |
end | |
end | |
gemfile = Gemfile.new | |
gemfile.gems :development | |
gemfile.gems :test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment