Sha256: 86b17420e8a5948b3112cd9207b8f4f3f015f548e559751b45ce56f1da2d3a59
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require "bundler" module BundlerExt class Gemfile def self.setup_env(gemfile) ENV['BUNDLE_GEMFILE'] = gemfile end def self.parse_env(groups) extra_groups = ENV['BEXT_GROUPS'] || ENV['BUNDLER_EXT_GROUPS'] extra_groups.split(/\s/).each {|g| groups << g.to_sym} if extra_groups all_groups = groups.size == 1 && groups.first == :all && (!extra_groups || extra_groups.empty?) {:groups => groups.map { |g| g.to_sym}, :extra_groups => extra_groups, :all_groups => all_groups} end def self.dependency_in_env?(dep, env) in_group = (env[:groups] & dep.groups).any? || env[:all_groups] in_group && dep.current_platform? end def self.files_for_dependency(dep, env) files = [] if self.dependency_in_env?(dep, env) Array(dep.autorequire || dep.name).each do |file| files << file end end files end def self.process(bundler_gemfile, env) deps = {} bundler_gemfile.dependencies.each do |dep| files = self.files_for_dependency(dep, env) deps[dep.name] = {:dep => dep, :files => files} unless files.empty? end deps end def self.parse(gemfile, *groups) setup_env(gemfile) env = parse_env(groups) gemfile = Bundler::Dsl.evaluate(gemfile, nil, true) process(gemfile, env) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bundler_ext-0.4.2 | lib/bundler_ext/gemfile.rb |
bundler_ext-0.4.1 | lib/bundler_ext/gemfile.rb |
bundler_ext-0.4.0 | lib/bundler_ext/gemfile.rb |