Class: Strobe::CLI
Defined Under Namespace
Modules: Preview
Classes: DeployProgress, Deploys, Input, Main, Settings, Table, Ticker, Users
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/strobe/cli.rb', line 99
def initialize(*)
super
@resource = nil
@input = Input.new
@in_group = false
@success = false
settings.connect!
end
|
Class Method Details
.__haxlias(name) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/strobe/cli.rb', line 79
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
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/strobe/cli.rb', line 65
def self.action(name, *args, &blk)
@haxliases ||= []
@haxliases << name.to_s
options = args.last if args.last.is_a?(Hash)
usage = if options && options[:usage]
options[:usage]
else
self == Users ? "users #{name}" : name
end
desc usage, *args
define_method("__hax__#{name}", &blk)
map name => "__hax__#{name}"
end
|
.application_path_option ⇒ Object
91
92
93
|
# File 'lib/strobe/cli.rb', line 91
def self.application_path_option
method_option :path, :type => :string, :banner => "Path to your application"
end
|
.handle_argument_error(task, error) ⇒ Object
95
96
97
|
# File 'lib/strobe/cli.rb', line 95
def self.handle_argument_error(task, error) raise InvocationError, "#{task.name.sub('__hax__','').inspect} was called incorrectly. Call as #{self.banner(task).inspect}."
end
|
.start(args) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/strobe/cli.rb', line 23
def self.start(args)
begin
$__ARGV = args
IdentityMap.wrap do
super
end
rescue Strobe::UnauthenticatedError => e
if Settings.global[:token]
puts "[ERROR] Your token is invalid, please login to get a valid token"
CLI::Main.start( [ "login" ] )
retry
else
raise e
end
end
rescue NotifiableError => e
if $__ARGV.include?('--backtrace')
require 'pp'
puts "=== ERROR DATA ==="
pp e.data
puts "\n"
raise
end
STDERR.puts "[ERROR] #{e.message}"
ExceptionNotifier.notify(e, :action => args.join(" "))
abort
rescue StrobeError => e
raise if $__ARGV.include?('--backtrace')
STDERR.puts "[ERROR] #{e.message}"
abort
rescue Interrupt
abort "\nQuitting..."
rescue SystemExit => e
exit e.status
rescue Exception => e
warn "Unfortunately, a fatal error has occurred. " +
"Please report this error to Strobe Support at " +
"http://support.strobeapp.com/home so that we can fix it. Thanks!\n\n" +
"VERSION: #{Strobe.user_agent}"
raise e
end
|