Class: Unbundler::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/unbundler/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



7
8
9
10
# File 'lib/unbundler/cli.rb', line 7

def self.start
  cli = CLI.new
  cli.run(cli.parse_args)
end

Instance Method Details

#parse_argsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/unbundler/cli.rb', line 20

def parse_args
  opts = { :action => :unbundle }
  case ARGV.first
  when "show", "list"
    opts[:action] = :show
  when "edit_keep_list"
    opts[:action] = :edit_keep_list
  end
  opts.merge( Trollop::options do
                version "unbundler v#{Unbundler::VERSION}"
                opt :keep, "List of gems to keep", :type => :strings
                opt :plain, "Plain output for unbundle list"
                opt :interactive, "Interactive unbundle(ask about each gem)"
                opt :quiet, "Produce no output"
              end)
end

#run(opts) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/unbundler/cli.rb', line 12

def run(opts)
  @interactive = opts[:interactive]
  @plain = opts[:plain]
  @quiet = opts[:quiet]
  @gems = GemList.new(opts[:keep])
  self.send(opts[:action])
end