bora 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1619e3e4e231e87f3814cb08cc63f37492f2131
4
- data.tar.gz: 25a29e25c975b0603ddcaf60cf34a0d1ccf97191
3
+ metadata.gz: de47b9b1631554ad77efc354c4447578222a53c6
4
+ data.tar.gz: b51627a1b45dbfbee39bca5177a27cfc6e0aa3a3
5
5
  SHA512:
6
- metadata.gz: b849204fbd61285510d8572af88086fe945f5a02b615bda669481006fccbda14ec50b079257aead29724d1d2b51d7d2b7b971aacb216bea3e46beca4851f5697
7
- data.tar.gz: cd57b6e5bb232da8876c00008d04fa9f3baf868791e322ea524b762e711404f4cc8ffd8301445014592828c887cc920224d44730cf8c5b35313e729534044fc2
6
+ metadata.gz: e7c30f5101af8e515e8dad0ec32dce09c4fbf57f4aedfbede036a6ccceb7ed1927ca0d10e797dee95f45b8852990b4bf554012c5b0eda36933cd2c5a2b7ef524
7
+ data.tar.gz: abea4067375197a723f3755fc11c86996117a650f2a40e269f1a75ade074377466580e8fb91dd6dd28680e6b7f4e906373e8f6646c2f515bf3f4b4d033e04e0a
data/README.md CHANGED
@@ -70,6 +70,22 @@ end
70
70
  You must at a minimum specify either the `template_body` or `template_url` option.
71
71
 
72
72
 
73
+ ### Dynamically Generated Templates
74
+ If you are generating your templates dynamically using a DSL such as [cfndsl](https://github.com/stevenjack/cfndsl) you can easily hook this into the Bora tasks by defining a `generate` task within the Bora::Tasks constructor.
75
+
76
+ ```ruby
77
+ Bora::Tasks.new("example") do |t|
78
+ desc "Generates the template"
79
+ task :generate do
80
+ # Generate your template and write it into "example.json" here
81
+ end
82
+
83
+ t.stack_options = {
84
+ template_body: File.read("example.json")
85
+ }
86
+ end
87
+ ```
88
+
73
89
  ### API
74
90
 
75
91
  You can use this gem without using Rake. Most of the logic is implemented in [stack.rb](https://github.com/ampedandwired/bora/blob/master/lib/bora/stack.rb) and is fairly self-explanatory.
@@ -8,7 +8,11 @@ module Bora
8
8
  @stack_name = stack_name
9
9
  @stack = Stack.new(stack_name)
10
10
  @colorize = true
11
- yield self if block_given?
11
+ if block_given?
12
+ within_namespace do
13
+ yield self
14
+ end
15
+ end
12
16
  define_tasks
13
17
  end
14
18
 
@@ -27,6 +31,7 @@ module Bora
27
31
  define_delete_task
28
32
  define_diff_task
29
33
  define_events_task
34
+ define_generate_task
30
35
  define_new_template_task
31
36
  define_outputs_task
32
37
  define_recreate_task
@@ -37,7 +42,7 @@ module Bora
37
42
  def define_apply_task
38
43
  within_namespace do
39
44
  desc "Creates (or updates) the '#{@stack_name}' stack"
40
- task :apply do
45
+ task :apply => :generate do
41
46
  success = invoke_action(@stack.exists? ? "update" : "create", @stack_options)
42
47
  if success
43
48
  outputs = @stack.outputs
@@ -72,7 +77,7 @@ module Bora
72
77
  def define_diff_task
73
78
  within_namespace do
74
79
  desc "Diffs the new template with the '#{@stack_name}' stack's current template"
75
- task :diff do
80
+ task :diff => :generate do
76
81
  puts @stack.diff(@stack_options).to_s(@colorize ? :color : :text)
77
82
  end
78
83
  end
@@ -97,10 +102,16 @@ module Bora
97
102
  end
98
103
  end
99
104
 
105
+ def define_generate_task
106
+ within_namespace do
107
+ task :generate
108
+ end
109
+ end
110
+
100
111
  def define_new_template_task
101
112
  within_namespace do
102
113
  desc "Shows the new template for '#{@stack_name}' stack"
103
- task :new_template do
114
+ task :new_template => :generate do
104
115
  puts @stack.new_template(@stack_options)
105
116
  end
106
117
  end
@@ -128,7 +139,7 @@ module Bora
128
139
  def define_recreate_task
129
140
  within_namespace do
130
141
  desc "Recreates (deletes then creates) the '#{@stack_name}' stack"
131
- task :recreate do
142
+ task :recreate => :generate do
132
143
  invoke_action("recreate", @stack_options)
133
144
  end
134
145
  end
@@ -146,7 +157,7 @@ module Bora
146
157
  def define_validate_task
147
158
  within_namespace do
148
159
  desc "Checks the '#{@stack_name}' stack's template for validity"
149
- task :validate do
160
+ task :validate => :generate do
150
161
  puts "Template for stack '#{@stack_name}' is valid" if @stack.validate(@stack_options)
151
162
  end
152
163
  end
@@ -1,3 +1,3 @@
1
1
  module Bora
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Blaxland
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-20 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk