class Duct::Cli

Constants

BUNDLER_COMMANDS
USAGE

Public Class Methods

new(args) click to toggle source
# File lib/duct/cli.rb, line 24
def initialize(args)
  @args = args
end

Public Instance Methods

command() click to toggle source
# File lib/duct/cli.rb, line 32
def command
  @args[0..-2].join(' ') if BUNDLER_COMMANDS.include?(@args.first)
end
error?() click to toggle source
# File lib/duct/cli.rb, line 40
def error?
  !(command || filename)
end
filename() click to toggle source
# File lib/duct/cli.rb, line 28
def filename
  command ? @args.last : @args.first
end
params() click to toggle source
# File lib/duct/cli.rb, line 36
def params
  command ? [] : @args[1..-1]
end
run() click to toggle source
# File lib/duct/cli.rb, line 44
def run
  if error?
    puts(USAGE)
    exit(-1)
  end
  runner.run
end

Private Instance Methods

runner() click to toggle source
# File lib/duct/cli.rb, line 54
def runner
  @runner ||= Duct::Runner.new(self)
end