stack_master 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2c8551f813ec21a55926c685bf281cf9aae2f33
4
- data.tar.gz: eabcb88f9bc07a017659ebac349e5a476aca605c
3
+ metadata.gz: 5a3ed3d56cf859f61ca5a72f89d42cfefea0cd0d
4
+ data.tar.gz: af141896b5817e2ff3a30b3811c3b3fedb1cade9
5
5
  SHA512:
6
- metadata.gz: 2b3242170d4615b24c88b85f1bf948bd69c00eacb83bafb6120dd37b247928648e4f9f0890e0ba3516b4e5e10eaa7bfacb5d1806bc7c3771a53bd5d02a7cd187
7
- data.tar.gz: 0466d851277d7ec84ff4d1d1ed619f078a08bd0da8de70aad2c5e020537faa99a2a7ab6fa6c5c7229504a9455b5d2db87b140e7438707bfda86d4f21ebda73dd
6
+ metadata.gz: 13e318d63d1a51aa9c379a571694cf43bc640aabc9e55d4cc0fb6570d0e44031609cd463fb655805620c39e60877d816d79a4ad6f1fbb909df652bdb27a3ebb1
7
+ data.tar.gz: 5fa3fad8464793c9d2d91738095e3e22e09d4029fcff28888f46f9fa30b92ff576761ad0db3df7ce74bc86d2c6237f9ff6813a2b9d81874008bc8659e99d691a
data/README.md CHANGED
@@ -175,12 +175,12 @@ web_ami:
175
175
  stack_master help # Display up to date docs on the commands available
176
176
  stack_master init # Initialises a directory structure and stack_master.yml file
177
177
  stack_master list # Lists stack definitions
178
- stack_master apply [region-or-alias] [stack-name] # Create or update a stack
179
- stack_master diff [region-or-alias] [stack-name] # Display a stack tempalte and parameter diff
180
- stack_master delete [region-or-alias] [stack-name] # Delete a stack
181
- stack_master events [region-or-alias] [stack-name] # Display events for a stack
182
- stack_master outputs [region-or-alias] [stack-name] # Display outputs for a stack
183
- stack_master resources [region-or-alias] [stack-name] # Display outputs for a stack
178
+ stack_master apply <region-or-alias> <stack-name> # Create or update a stack
179
+ stack_master diff <region-or-alias> <stack-name> # Display a stack tempalte and parameter diff
180
+ stack_master delete <region-or-alias> <stack-name> # Delete a stack
181
+ stack_master events <region-or-alias> <stack-name> # Display events for a stack
182
+ stack_master outputs <region-or-alias> <stack-name> # Display outputs for a stack
183
+ stack_master resources <region-or-alias> <stack-name> # Display outputs for a stack
184
184
  stack_master status # Displays the status of each stack
185
185
  ```
186
186
 
@@ -11,6 +11,7 @@ module StackMaster
11
11
 
12
12
  def perform
13
13
  if stack
14
+ tp.set :max_width, 80
14
15
  tp stack.outputs, :output_key, :output_value, :description
15
16
  else
16
17
  StackMaster.stdout.puts "Stack doesn't exist"
@@ -4,7 +4,7 @@ module StackMaster
4
4
  include Command
5
5
  include Commander::UI
6
6
 
7
- def initialize(config, stack_definition)
7
+ def initialize(config, stack_definition, options = {})
8
8
  @config = config
9
9
  @stack_definition = stack_definition
10
10
  end
@@ -4,8 +4,9 @@ require 'active_support/core_ext/object/deep_dup'
4
4
  module StackMaster
5
5
  class Config
6
6
  def self.load!(config_file = 'stack_master.yml')
7
- config = YAML.load(File.read(config_file))
8
- base_dir = File.dirname(File.expand_path(config_file))
7
+ resolved_config_file = search_up_and_chdir(config_file)
8
+ config = YAML.load(File.read(resolved_config_file))
9
+ base_dir = File.dirname(File.expand_path(resolved_config_file))
9
10
  new(config, base_dir)
10
11
  end
11
12
 
@@ -15,6 +16,19 @@ module StackMaster
15
16
  :region_defaults,
16
17
  :region_aliases
17
18
 
19
+ def self.search_up_and_chdir(config_file)
20
+ return config_file unless File.dirname(config_file) == "."
21
+
22
+ dir = Dir.pwd
23
+ parent_dir = File.expand_path("..", Dir.pwd)
24
+ while parent_dir != dir && !File.exists?(File.join(dir, config_file))
25
+ dir = parent_dir
26
+ parent_dir = File.expand_path("..", dir)
27
+ end
28
+
29
+ File.join(dir, config_file)
30
+ end
31
+
18
32
  def initialize(config, base_dir)
19
33
  @config = config
20
34
  @base_dir = base_dir
@@ -16,7 +16,11 @@ module StackMaster
16
16
 
17
17
  def resolve
18
18
  @parameters.reduce({}) do |parameters, (key, value)|
19
- parameters[key] = resolve_parameter_value(value)
19
+ begin
20
+ parameters[key] = resolve_parameter_value(value)
21
+ rescue InvalidParameter
22
+ raise InvalidParameter, "Unable to resolve parameter #{key.inspect} value causing error: #{$!.message}"
23
+ end
20
24
  parameters
21
25
  end
22
26
  end
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,9 +1,10 @@
1
1
  RSpec.describe StackMaster::Commands::Validate do
2
2
 
3
- subject(:validate) { described_class.new(config, stack_definition) }
3
+ subject(:validate) { described_class.new(config, stack_definition, options) }
4
4
  let(:config) { instance_double(StackMaster::Config) }
5
5
  let(:region) { "us-east-1" }
6
6
  let(:stack_name) { "mystack" }
7
+ let(:options) { }
7
8
  let(:stack_definition) do
8
9
  StackMaster::StackDefinition.new(
9
10
  region: region,
@@ -15,6 +15,22 @@ RSpec.describe StackMaster::Config do
15
15
  )
16
16
  }
17
17
 
18
+ context ".load!" do
19
+ it "fails to load the config if no stack_master.yml in parent directories" do
20
+ expect { StackMaster::Config.load!('stack_master.yml') }.to raise_error Errno::ENOENT
21
+ end
22
+
23
+ it "searches up the tree for stack master yaml" do
24
+ begin
25
+ orig_dir = Dir.pwd
26
+ Dir.chdir './spec/fixtures/templates'
27
+ expect(StackMaster::Config.load!('stack_master.yml')).to_not be_nil
28
+ ensure
29
+ Dir.chdir orig_dir
30
+ end
31
+ end
32
+ end
33
+
18
34
  it 'returns an object that can find stack definitions' do
19
35
  stack = loaded_config.find_stack('us-east-1', 'myapp-vpc')
20
36
  expect(stack).to eq(myapp_vpc_definition)
data/stack_master.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "ruby-progressbar"
29
29
  spec.add_dependency "commander"
30
30
  spec.add_dependency "virtus"
31
- spec.add_dependency "aws-sdk"
31
+ spec.add_dependency "aws-sdk", "~> 2.1"
32
32
  spec.add_dependency "diffy"
33
33
  spec.add_dependency "colorize"
34
34
  spec.add_dependency "activesupport"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-06 00:00:00.000000000 Z
12
+ date: 2015-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -155,16 +155,16 @@ dependencies:
155
155
  name: aws-sdk
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '0'
160
+ version: '2.1'
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '0'
167
+ version: '2.1'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: diffy
170
170
  requirement: !ruby/object:Gem::Requirement