Class: LambdaWhenever::Task
- Inherits:
-
Object
- Object
- LambdaWhenever::Task
show all
- Defined in:
- lib/lambda_whenever/task.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(environment, verbose, bundle_command, expression) ⇒ Task
Returns a new instance of Task.
7
8
9
10
11
12
13
|
# File 'lib/lambda_whenever/task.rb', line 7
def initialize(environment, verbose, bundle_command, expression)
@environment = environment
@verbose_mode = verbose ? nil : "--silent"
@bundle_command = bundle_command.split(" ")
@expression = expression
@commands = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_args) ⇒ Object
31
32
33
|
# File 'lib/lambda_whenever/task.rb', line 31
def method_missing(name, *_args)
Logger.instance.warn("Skipping unsupported method: #{name}")
end
|
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
5
6
7
|
# File 'lib/lambda_whenever/task.rb', line 5
def commands
@commands
end
|
#expression ⇒ Object
Returns the value of attribute expression.
5
6
7
|
# File 'lib/lambda_whenever/task.rb', line 5
def expression
@expression
end
|
Instance Method Details
#command(task) ⇒ Object
15
16
17
|
# File 'lib/lambda_whenever/task.rb', line 15
def command(task)
@commands << task.split(" ")
end
|
#rake(task) ⇒ Object
19
20
21
|
# File 'lib/lambda_whenever/task.rb', line 19
def rake(task)
@commands << [@bundle_command, "rake", task, @verbose_mode].flatten.compact
end
|
#runner(src) ⇒ Object
23
24
25
|
# File 'lib/lambda_whenever/task.rb', line 23
def runner(src)
@commands << [@bundle_command, "rails", "runner", "-e", @environment, src].flatten
end
|
#script(script) ⇒ Object
27
28
29
|
# File 'lib/lambda_whenever/task.rb', line 27
def script(script)
@commands << [@bundle_command, "script/#{script}"].flatten
end
|