Sha256: 0b322d93b5462064d02c65f83ed403769c97ca8642f463ebc348f464d4e437b7

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

require "grub/options"

module Grub
  class CLI
    def run(args)
      options = Options.new.parse!(args)
      if args.empty?
        run_for_gemfile(options)
      else
        run_for_gem(args.pop, options)
      end
    end

    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)
        gemfile.write_comments
      end
    end

    def run_for_gem(gem_name, options = {})
      gem_line = GemLine.new(name: gem_name, options: options)
      SpecFinder.find_specs_for(gem_line)
      info = gem_line.info
      info = "No information to show" if info.strip.empty?
      puts info
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grub-0.0.4 lib/grub/cli.rb
grub-0.0.3 lib/grub/cli.rb
grub-0.0.2 lib/grub/cli.rb