Class: ExtJS::XTheme::Command::Base
- Inherits:
-
Object
- Object
- ExtJS::XTheme::Command::Base
show all
- Defined in:
- lib/extjs-xtheme/commands/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args, config) ⇒ Base
Returns a new instance of Base.
10
11
12
13
|
# File 'lib/extjs-xtheme/commands/base.rb', line 10
def initialize(args, config)
@args = args
@config = config
end
|
Instance Attribute Details
#args ⇒ Object
7
8
9
|
# File 'lib/extjs-xtheme/commands/base.rb', line 7
def args
@args
end
|
#config ⇒ Object
Returns the value of attribute config.
8
9
10
|
# File 'lib/extjs-xtheme/commands/base.rb', line 8
def config
@config
end
|
Instance Method Details
#ask ⇒ Object
28
29
30
|
# File 'lib/extjs-xtheme/commands/base.rb', line 28
def ask
gets.strip
end
|
#display(msg, newline = true) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/extjs-xtheme/commands/base.rb', line 15
def display(msg, newline=true)
if newline
puts(msg)
else
print(msg)
STDOUT.flush
end
end
|
#escape(value) ⇒ Object
70
71
72
|
# File 'lib/extjs-xtheme/commands/base.rb', line 70
def escape(value)
heroku.escape(value)
end
|
40
41
42
43
44
45
46
47
48
|
# File 'lib/extjs-xtheme/commands/base.rb', line 40
def (force=true)
app = ('--app')
unless app
app = (Dir.pwd) ||
raise(CommandFailed, "No app specified.\nRun this command from app folder or set it adding --app <app name>") if force
@autodetected_app = true
end
app
end
|
50
51
52
|
# File 'lib/extjs-xtheme/commands/base.rb', line 50
def (dir)
end
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/extjs-xtheme/commands/base.rb', line 54
def (options, default=true)
values = options.is_a?(Array) ? options : [options]
return unless opt_index = args.select { |a| values.include? a }.first
opt_position = args.index(opt_index) + 1
if args.size > opt_position && opt_value = args[opt_position]
if opt_value.include?('--')
opt_value = nil
else
args.delete_at(opt_position)
end
end
opt_value ||= default
args.delete(opt_index)
block_given? ? yield(opt_value) : opt_value
end
|
#heroku ⇒ Object
36
37
38
|
# File 'lib/extjs-xtheme/commands/base.rb', line 36
def heroku
end
|
#shell(cmd) ⇒ Object
32
33
34
|
# File 'lib/extjs-xtheme/commands/base.rb', line 32
def shell(cmd)
FileUtils.cd(Dir.pwd) {|d| return `#{cmd}`}
end
|