Class: Strobe::CLI

Inherits:
Thor
  • Object
show all
Includes:
Resources
Defined in:
lib/strobe/cli.rb

Direct Known Subclasses

Main, Users

Defined Under Namespace

Classes: Main, Settings, Table, Users

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/strobe/cli.rb', line 52

def initialize(*)
  super

  @resource = nil
  @highline = HighLine.new

  # State
  @in_group = false
  @success  = false

  settings.connect!
end

Class Method Details

.__haxlias(name) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/strobe/cli.rb', line 36

def self.__haxlias(name)
  @haxliases ||= []

  return name if Class === name

  if @haxliases.include?(name.to_s)
    "__hax__#{name}"
  else
    name
  end
end

.action(name, *args, &blk) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/strobe/cli.rb', line 27

def self.action(name, *args, &blk)
  @haxliases ||= []
  @haxliases << name.to_s
  usage = self == Users ? "users #{name}" : name
  desc usage, *args
  define_method("__hax__#{name}", &blk)
  map name => "__hax__#{name}"
end

.application_path_optionObject



48
49
50
# File 'lib/strobe/cli.rb', line 48

def self.application_path_option
  method_option :path, :type => :string, :banner => "Path to your application"
end

.start(args) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/strobe/cli.rb', line 17

def self.start(args)
  $ARGV = args
  IdentityMap.wrap do
    super
  end
rescue Strobe::StrobeError => e
  raise if $ARGV.include?('--backtrace')
  abort "[ERROR] #{e.message}"
end