Sha256: a58f6d11b704b9d363d692ea5c45a65b7950f6e72c4fa3f39835d4551eedf61d
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
module IsItWorking class BundlerCheck def initialize(options={}) end def call(status) gems.each do |gem| status.info "#{gem[:name]} (#{gem[:version]}) [#{ gem[:dependencies].map { |x| "#{x[:name]} (#{x[:version]})" }.join(",") }]" end end private def dependencies @dependencies ||= Hash[groups.collect { |group,deps| [group,Hash[deps.collect { |dep| [dep.name,dependency_hash(environment, dep.name)] }]] }] end def environment @environment ||= Bundler.load end def graph @graph ||= Bundler::Graph.new(environment, '/dev/null') end def groups @groups ||= environment.current_dependencies.group_by { |d| d.groups.first.to_s } end def version key dependency_version key end def gems graph.groups.map do |group| nodes = graph.relations[group] nodes.map do |gem| next unless environment.current_dependencies.include? gem { :name => gem, :version => dependency_version(gem), :dependencies => graph.relations[gem].map do |d| { :name => d, :version => dependency_version(d) } end } end.compact end.flatten.compact end def dependency_version(key) spec = environment.specs.find { |s| s.name == key } rev = spec.git_version rev.strip! unless rev.nil? location = [spec.source.options.values_at('path','uri').compact.first,rev].compact.join('@') [spec.version.to_s,location].compact.join(' ').strip end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
is_it_working-cbeer-1.0.16 | lib/is_it_working/checks/bundler_check.rb |