Class: Pushapp::Tasks::Base
- Inherits:
-
Object
- Object
- Pushapp::Tasks::Base
show all
- Defined in:
- lib/pushapp/tasks/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
10
11
12
13
|
# File 'lib/pushapp/tasks/base.rb', line 10
def initialize options={}
@options = options
@logger = Pushapp::Logger.new
end
|
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
8
9
10
|
# File 'lib/pushapp/tasks/base.rb', line 8
def logger
@logger
end
|
#options ⇒ Object
Returns the value of attribute options.
7
8
9
|
# File 'lib/pushapp/tasks/base.rb', line 7
def options
@options
end
|
Class Method Details
.register_as(name) ⇒ Object
Instance Method Details
#app_name_from_path ⇒ Object
35
36
37
|
# File 'lib/pushapp/tasks/base.rb', line 35
def app_name_from_path
options[:remote].path ? options[:remote].path.split('/').last : nil
end
|
#env ⇒ Object
18
19
20
|
# File 'lib/pushapp/tasks/base.rb', line 18
def env
Hash[env_options.map {|k, v| [k.to_s, v.to_s] }]
end
|
#env_options ⇒ Object
22
23
24
|
# File 'lib/pushapp/tasks/base.rb', line 22
def env_options
options[:env] || {}
end
|
#inspect ⇒ Object
43
44
45
|
# File 'lib/pushapp/tasks/base.rb', line 43
def inspect
options[:task_name]
end
|
#run ⇒ Object
15
16
|
# File 'lib/pushapp/tasks/base.rb', line 15
def run
end
|
#sudo ⇒ Object
26
27
28
|
# File 'lib/pushapp/tasks/base.rb', line 26
def sudo
options[:sudo] || 'sudo'
end
|
#system(cmd) ⇒ Object
30
31
32
33
|
# File 'lib/pushapp/tasks/base.rb', line 30
def system cmd
logger.debug cmd
Pipe.run cmd
end
|