Class: Stackup::RakeTasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Stackup::RakeTasks
- Defined in:
- lib/stackup/rake_tasks.rb
Overview
Declare Rake tasks for managing a stack.
Defined Under Namespace
Classes: DataOptions
Constant Summary collapse
- STACKUP_CLI =
path to the “stackup” executable
File.("../../../bin/stackup", __FILE__)
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#stack ⇒ Object
Returns the value of attribute stack.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name, template = nil) {|_self| ... } ⇒ RakeTasks
constructor
A new instance of RakeTasks.
- #stackup(*rest) ⇒ Object
Constructor Details
#initialize(name, template = nil) {|_self| ... } ⇒ RakeTasks
Returns a new instance of RakeTasks.
19 20 21 22 23 24 25 26 27 |
# File 'lib/stackup/rake_tasks.rb', line 19 def initialize(name, template = nil) @name = name @stack = name @template = template yield self if block_given? fail ArgumentError, "no name provided" unless @name fail ArgumentError, "no template provided" unless @template define end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/stackup/rake_tasks.rb', line 11 def name @name end |
#parameters ⇒ Object
Returns the value of attribute parameters.
14 15 16 |
# File 'lib/stackup/rake_tasks.rb', line 14 def parameters @parameters end |
#stack ⇒ Object
Returns the value of attribute stack.
12 13 14 |
# File 'lib/stackup/rake_tasks.rb', line 12 def stack @stack end |
#tags ⇒ Object
Returns the value of attribute tags.
15 16 17 |
# File 'lib/stackup/rake_tasks.rb', line 15 def @tags end |
#template ⇒ Object
Returns the value of attribute template.
13 14 15 |
# File 'lib/stackup/rake_tasks.rb', line 13 def template @template end |
Instance Method Details
#define ⇒ Object
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 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/stackup/rake_tasks.rb', line 36 def define namespace(name) do = DataOptions.new ["--template"] = template ["--parameters"] = parameters if parameters ["--tags"] = if desc "Update #{stack} stack" task "up" => .files do stackup "up", *.to_a end desc "Cancel update of #{stack} stack" task "cancel" do stackup "cancel-update" end desc "Show pending changes to #{stack} stack" task "diff" => .files do stackup "diff", *.to_a end desc "Show #{stack} stack outputs and resources" task "inspect" do stackup "inspect" end desc "Show #{stack} stack outputs only" task "outputs" do stackup "outputs" end desc "Delete #{stack} stack" task "down" do stackup "down" end end end |
#stackup(*rest) ⇒ Object
32 33 34 |
# File 'lib/stackup/rake_tasks.rb', line 32 def stackup(*rest) sh STACKUP_CLI, "-Y", stack, *rest end |