module XDep::Ruby::Helper
Constants
- COMMENT
- GEMFILE
- GEMSPEC
- KNOWN_DEPENDENCIES
> 50 million downloads according to rubygems.com, with a few exceptions
- SPEC_MISSING
I think 2.4.0 added MissingSpecError
Private Instance Methods
find_spec(name)
click to toggle source
# File lib/xdep/ruby.rb, line 59 def find_spec(name) Gem::Specification.find_by_name(name) rescue SPEC_MISSING raise Error, "Cannot find dependency #{name}; is it installed locally?" end
known_dependencies()
click to toggle source
# File lib/xdep/ruby.rb, line 32 def known_dependencies KNOWN_DEPENDENCIES end
output_ruby(input, output, match)
click to toggle source
# File lib/xdep/ruby.rb, line 36 def output_ruby(input, output, match) last_line = nil input.each_line do |line| if line =~ match lead = $1 name = $3 if !ignore?(name) spec = find_spec(name) next unless spec comment = "#{lead}# #{spec.summary}" # Allow for multiple runs without adding the comment over and over # strip to account for changes in indentation output.puts(comment) unless last_line.strip == comment.strip end end last_line = line output.puts(line) end end