class RubyLang
Public Class Methods
latest_version(name)
click to toggle source
# File lib/cutting_edge/langs/ruby.rb, line 29 def latest_version(name) # Fancy todo: cache these? begin Gem::SpecFetcher.fetcher.spec_for_dependency(Gem::Dependency.new(name, nil)).flatten.first.version rescue StandardError => e log_error("Encountered error when fetching latest version of #{name}: #{e.class} #{e.message}") nil end end
locations(name)
click to toggle source
Defaults for projects in this language
# File lib/cutting_edge/langs/ruby.rb, line 9 def locations(name) ["#{name}.gemspec", 'Gemfile'] end
parse_file(name, content)
click to toggle source
Parse a dependency file
name - String contents of the file content - String contents of the file
Returns an Array of tuples of each dependency and its latest version: [[<Bundler::Dependency>, <Gem::Version>]]
# File lib/cutting_edge/langs/ruby.rb, line 23 def parse_file(name, content) return nil unless content results = name =~ /gemspec/ ? parse_gemspec(content) : parse_gemfile(content) dependency_with_latest(results) end
parse_gemfile(content)
click to toggle source
# File lib/cutting_edge/langs/ruby.rb, line 47 def parse_gemfile(content) parse_ruby(:gemfile, content) end
parse_gemspec(content)
click to toggle source
# File lib/cutting_edge/langs/ruby.rb, line 43 def parse_gemspec(content) parse_ruby(:gemspec, content) end
parse_ruby(type, content)
click to toggle source
# File lib/cutting_edge/langs/ruby.rb, line 39 def parse_ruby(type, content) Gemnasium::Parser.send(type, content).dependencies end
website(name)
click to toggle source
# File lib/cutting_edge/langs/ruby.rb, line 13 def website(name) "https://rubygems.org/gems/#{name}" end