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: DataOption, DataOptionArray, DataOptionFile, DataOptionHash
Constant Summary collapse
- STACKUP_CLI =
path to the “stackup” executable
File.("../../bin/stackup", __dir__)
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#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.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stackup/rake_tasks.rb', line 23 def initialize(name, template = nil) @name = name @stack = name @template = template yield self if block_given? raise ArgumentError, "no name provided" unless @name raise ArgumentError, "no template provided" unless @template define end |
Instance Attribute Details
#capabilities ⇒ Object
Returns the value of attribute capabilities.
19 20 21 |
# File 'lib/stackup/rake_tasks.rb', line 19 def capabilities @capabilities end |
#name ⇒ Object
Returns the value of attribute name.
14 15 16 |
# File 'lib/stackup/rake_tasks.rb', line 14 def name @name end |
#parameters ⇒ Object
Returns the value of attribute parameters.
17 18 19 |
# File 'lib/stackup/rake_tasks.rb', line 17 def parameters @parameters end |
#stack ⇒ Object
Returns the value of attribute stack.
15 16 17 |
# File 'lib/stackup/rake_tasks.rb', line 15 def stack @stack end |
#tags ⇒ Object
Returns the value of attribute tags.
18 19 20 |
# File 'lib/stackup/rake_tasks.rb', line 18 def @tags end |
#template ⇒ Object
Returns the value of attribute template.
16 17 18 |
# File 'lib/stackup/rake_tasks.rb', line 16 def template @template end |
Instance Method Details
#define ⇒ Object
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 76 77 78 79 80 |
# File 'lib/stackup/rake_tasks.rb', line 41 def define namespace(name) do = [DataOption.for("--template", template)] << DataOption.for("--parameters", parameters) if parameters << DataOption.for("--tags", ) if desc "Update #{stack} stack" task "up" => .grep(DataOptionFile).map(&:argument) do << DataOption.for("--capability", capabilities) if capabilities stackup "up", *.map(&:to_a).flatten end desc "Cancel update of #{stack} stack" task "cancel" do stackup "cancel-update" end desc "Show pending changes to #{stack} stack" task "diff" => .grep(DataOptionFile).map(&:argument) do stackup "diff", *.map(&:to_a).flatten 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
37 38 39 |
# File 'lib/stackup/rake_tasks.rb', line 37 def stackup(*rest) sh STACKUP_CLI, "-Y", stack, *rest end |