simple_deploy 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/simple_deploy/cli/attributes.rb +34 -9
- data/lib/simple_deploy/version.rb +1 -1
- data/script/ci_setup +4 -4
- data/spec/cli/attributes_spec.rb +54 -0
- metadata +16 -14
data/CHANGELOG
CHANGED
@@ -2,9 +2,10 @@ require 'trollop'
|
|
2
2
|
|
3
3
|
module SimpleDeploy
|
4
4
|
module CLI
|
5
|
+
|
5
6
|
class Attributes
|
6
7
|
def show
|
7
|
-
opts = Trollop::options do
|
8
|
+
@opts = Trollop::options do
|
8
9
|
version SimpleDeploy::VERSION
|
9
10
|
banner <<-EOS
|
10
11
|
|
@@ -14,25 +15,49 @@ simple_deploy attributes -n STACK_NAME -e ENVIRONMENT
|
|
14
15
|
|
15
16
|
EOS
|
16
17
|
opt :help, "Display Help"
|
18
|
+
opt :as_command_args,
|
19
|
+
"Displays the attributes in a format suitable for using on the command line"
|
17
20
|
opt :environment, "Set the target environment", :type => :string
|
18
21
|
opt :log_level, "Log level: debug, info, warn, error", :type => :string,
|
19
22
|
:default => 'info'
|
20
23
|
opt :name, "Stack name to manage", :type => :string
|
21
24
|
end
|
22
25
|
|
23
|
-
CLI::Shared.valid_options? :provided => opts,
|
26
|
+
CLI::Shared.valid_options? :provided => @opts,
|
24
27
|
:required => [:environment, :name]
|
25
28
|
|
26
|
-
|
29
|
+
@opts[:as_command_args] ? command_args_output : default_output
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def attribute_data
|
34
|
+
Hash[stack.attributes.sort]
|
35
|
+
end
|
27
36
|
|
28
|
-
|
37
|
+
def command_args_output
|
38
|
+
puts attribute_data.map { |k, v| "-a #{k}=#{v}" }.join(' ')
|
39
|
+
end
|
40
|
+
|
41
|
+
def config
|
42
|
+
@config ||= Config.new.environment @opts[:environment]
|
43
|
+
end
|
29
44
|
|
30
|
-
|
31
|
-
|
32
|
-
:config => config,
|
33
|
-
:logger => logger
|
34
|
-
Hash[stack.attributes.sort].each_pair { |k, v| puts "#{k}=#{v}" }
|
45
|
+
def default_output
|
46
|
+
attribute_data.each_pair { |k, v| puts "#{k}=#{v}" }
|
35
47
|
end
|
48
|
+
|
49
|
+
def logger
|
50
|
+
@logger ||= SimpleDeployLogger.new :log_level => @opts[:log_level]
|
51
|
+
end
|
52
|
+
|
53
|
+
def stack
|
54
|
+
@stack = Stack.new :environment => @opts[:environment],
|
55
|
+
:name => @opts[:name],
|
56
|
+
:config => config,
|
57
|
+
:logger => logger
|
58
|
+
end
|
59
|
+
|
36
60
|
end
|
61
|
+
|
37
62
|
end
|
38
63
|
end
|
data/script/ci_setup
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
# Source RVM profile and set ruby / gemset
|
4
4
|
. /etc/profile
|
5
|
-
|
5
|
+
|
6
|
+
# Exit with error if any command returns non zero
|
7
|
+
set -e
|
6
8
|
|
7
9
|
# Bundle gems
|
10
|
+
rvm use "1.9.3-p125@simple_deploy" --create
|
8
11
|
bundle
|
9
12
|
|
10
|
-
# Create blank deployment config
|
11
|
-
touch $HOME/.simple_deploy.yml
|
12
|
-
|
13
13
|
# Run spec tests
|
14
14
|
rspec spec
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SimpleDeploy::CLI::Attributes do
|
4
|
+
|
5
|
+
describe 'show' do
|
6
|
+
before do
|
7
|
+
@config = mock 'config'
|
8
|
+
@logger = stub 'logger'
|
9
|
+
@options = { :environment => 'my_env',
|
10
|
+
:log_level => 'debug',
|
11
|
+
:name => 'my_stack' }
|
12
|
+
@stack = stub :attributes => { 'foo' => 'bar', 'baz' => 'blah' }
|
13
|
+
|
14
|
+
SimpleDeploy::Config.stub(:new).and_return(@config)
|
15
|
+
@config.should_receive(:environment).with('my_env').and_return(@config)
|
16
|
+
SimpleDeploy::SimpleDeployLogger.should_receive(:new).
|
17
|
+
with(:log_level => 'debug').
|
18
|
+
and_return(@logger)
|
19
|
+
SimpleDeploy::Stack.should_receive(:new).
|
20
|
+
with(:config => @config,
|
21
|
+
:environment => 'my_env',
|
22
|
+
:logger => @logger,
|
23
|
+
:name => 'my_stack').
|
24
|
+
and_return(@stack)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should output the attributes' do
|
28
|
+
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
29
|
+
with(:provided => @options,
|
30
|
+
:required => [:environment, :name])
|
31
|
+
Trollop.stub(:options).and_return(@options)
|
32
|
+
subject.should_receive(:puts).with("foo=bar")
|
33
|
+
subject.should_receive(:puts).with("baz=blah")
|
34
|
+
subject.show
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with --as-command-args' do
|
38
|
+
before do
|
39
|
+
@options[:as_command_args] = true
|
40
|
+
Trollop.stub(:options).and_return(@options)
|
41
|
+
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
42
|
+
with(:provided => @options,
|
43
|
+
:required => [:environment, :name])
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should output the attributes as command arguments' do
|
47
|
+
subject.should_receive(:puts).with("-a baz=blah -a foo=bar")
|
48
|
+
subject.show
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70332846279420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70332846279420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano
|
27
|
-
requirement: &
|
27
|
+
requirement: &70332846278440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70332846278440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: stackster
|
38
|
-
requirement: &
|
38
|
+
requirement: &70332846256720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.9
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70332846256720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: tinder
|
49
|
-
requirement: &
|
49
|
+
requirement: &70332846255020 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70332846255020
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: trollop
|
60
|
-
requirement: &
|
60
|
+
requirement: &70332846253680 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70332846253680
|
69
69
|
description: I am designed to deploy artifacts uploaded by Heirloom
|
70
70
|
email:
|
71
71
|
- brett@weav.net
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- script/ci_setup
|
113
113
|
- simple_deploy.gemspec
|
114
114
|
- spec/artifact_spec.rb
|
115
|
+
- spec/cli/attributes_spec.rb
|
115
116
|
- spec/cli_spec.rb
|
116
117
|
- spec/config_spec.rb
|
117
118
|
- spec/logger_spec.rb
|
@@ -136,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
137
|
version: '0'
|
137
138
|
segments:
|
138
139
|
- 0
|
139
|
-
hash:
|
140
|
+
hash: 2975550354035595728
|
140
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
142
|
none: false
|
142
143
|
requirements:
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
segments:
|
147
148
|
- 0
|
148
|
-
hash:
|
149
|
+
hash: 2975550354035595728
|
149
150
|
requirements: []
|
150
151
|
rubyforge_project: simple_deploy
|
151
152
|
rubygems_version: 1.8.16
|
@@ -154,6 +155,7 @@ specification_version: 3
|
|
154
155
|
summary: I help with deployments
|
155
156
|
test_files:
|
156
157
|
- spec/artifact_spec.rb
|
158
|
+
- spec/cli/attributes_spec.rb
|
157
159
|
- spec/cli_spec.rb
|
158
160
|
- spec/config_spec.rb
|
159
161
|
- spec/logger_spec.rb
|