class Grub::CLI
Public Instance Methods
run(args)
click to toggle source
# File lib/grub/cli.rb, line 5 def run(args) options = Options.new.parse!(args) if args.empty? run_for_gemfile(options) else run_for_gem(args.pop, options) end end
run_for_gem(gem_name, options = {})
click to toggle source
# File lib/grub/cli.rb, line 24 def run_for_gem(gem_name, options = {}) gem_line = GemLine.new(name: gem_name, options: options) SpecFinder.find_specs_for(gem_line, &self.method(:print_progress)) info = gem_line.info info = "No information to show" if info.strip.empty? puts info end
run_for_gemfile(options = {})
click to toggle source
# File lib/grub/cli.rb, line 14 def run_for_gemfile(options = {}) Bundler.configure gemfile = Gemfile.new(Bundler.default_gemfile, options) gemfile.parse unless gemfile.gem_lines.empty? SpecFinder.find_specs_for(gemfile.gem_lines, &self.method(:print_progress)) gemfile.write_comments end end
Private Instance Methods
print_progress(processing, total)
click to toggle source
# File lib/grub/cli.rb, line 35 def print_progress(processing, total) print "Fetching gem metadata..." if processing.zero? print "." print "\n" if processing == total end