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