blazing 0.2.7 → 0.2.9
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.
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +17 -0
- data/Guardfile +2 -4
- data/README.md +131 -44
- data/bin/blazing +2 -34
- data/blazing.gemspec +4 -2
- data/lib/blazing.rb +9 -1
- data/lib/blazing/cli.rb +65 -0
- data/lib/blazing/config.rb +13 -9
- data/lib/blazing/recipe.rb +4 -15
- data/lib/blazing/runner.rb +56 -36
- data/lib/blazing/shell.rb +1 -1
- data/lib/blazing/target.rb +41 -4
- data/lib/blazing/templates/config.erb +43 -17
- data/lib/blazing/templates/hook.erb +3 -3
- data/lib/blazing/version.rb +5 -1
- data/spec/blazing/config_spec.rb +4 -33
- data/spec/blazing/integration/init_spec.rb +1 -1
- data/spec/blazing/integration/{recipes_list_spec.rb → list_spec.rb} +2 -4
- data/spec/blazing/integration/{recipes_run_spec.rb → recipes_spec.rb} +8 -6
- data/spec/blazing/integration/setup_spec.rb +41 -0
- data/spec/blazing/integration/update_spec.rb +44 -49
- data/spec/blazing/recipe_spec.rb +2 -21
- data/spec/blazing/target_spec.rb +24 -0
- data/spec/spec_helper.rb +29 -10
- metadata +57 -32
- data/spec/blazing/integration/setup_remote_spec.rb +0 -32
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'blazing setup' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
setup_sandbox
|
7
|
+
@config = Blazing::Config.new
|
8
|
+
@config.target :production, "#{@sandbox_directory}/target"
|
9
|
+
@config.target :staging, "#{@sandbox_directory}/staging"
|
10
|
+
@cli = Blazing::CLI.new
|
11
|
+
Blazing::Config.stub(:parse).and_return @config
|
12
|
+
end
|
13
|
+
|
14
|
+
after :each do
|
15
|
+
teardown_sandbox
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when a target is specified' do
|
19
|
+
|
20
|
+
before :each do
|
21
|
+
capture(:stdout, :stderr) { @cli.setup(:production) }
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'prepares the repository on the target location' do
|
25
|
+
File.exists?("#{@sandbox_directory}/target/.git").should be true
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'configures the repository to allow pushing to the checked out branch' do
|
29
|
+
Grit::Repo.new("#{@sandbox_directory}/target").config['receive.denycurrentbranch'].should == 'ignore'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when all is specified as target' do
|
34
|
+
it 'updates all targets' do
|
35
|
+
capture(:stdout, :stderr) { @cli.setup('all') }
|
36
|
+
File.exists?("#{@sandbox_directory}/target/.git/hooks/post-receive").should be true
|
37
|
+
File.exists?("#{@sandbox_directory}/staging/.git/hooks/post-receive").should be true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -1,50 +1,45 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
@runner.exec('update')
|
47
|
-
Grit::Repo.new(Dir.pwd).config['remote.production.url'].should == @production_url
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
2
|
+
|
3
|
+
describe 'blazing update' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
setup_sandbox
|
7
|
+
@config = Blazing::Config.new
|
8
|
+
@config.target :production, "#{@sandbox_directory}/target"
|
9
|
+
@config.target :staging, "#{@sandbox_directory}/staging"
|
10
|
+
@cli = Blazing::CLI.new
|
11
|
+
Blazing::Config.stub(:parse).and_return @config
|
12
|
+
end
|
13
|
+
|
14
|
+
after :each do
|
15
|
+
teardown_sandbox
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
context 'when a target is specified' do
|
20
|
+
|
21
|
+
before :each do
|
22
|
+
capture(:stdout, :stderr) { @cli.setup(:production) }
|
23
|
+
capture(:stdout, :stderr) { @cli.update(:production) }
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'generates a post-receive hook based on the current blazing config' do
|
27
|
+
File.exists?("/tmp/post-receive").should be true
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'copies the generated post-receive hook to the target' do
|
31
|
+
File.exists?("#{@sandbox_directory}/target/.git/hooks/post-receive").should be true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when all is specified as target' do
|
36
|
+
it 'updates all targets' do
|
37
|
+
capture(:stdout, :stderr) { @cli.setup('all') }
|
38
|
+
capture(:stdout, :stderr) { @cli.update('all') }
|
39
|
+
File.exists?("#{@sandbox_directory}/target/.git/hooks/post-receive").should be true
|
40
|
+
File.exists?("#{@sandbox_directory}/staging/.git/hooks/post-receive").should be true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
data/spec/blazing/recipe_spec.rb
CHANGED
@@ -19,33 +19,14 @@ describe Blazing::Recipe do
|
|
19
19
|
|
20
20
|
describe '.list' do
|
21
21
|
it 'retunrs an array of the available recipe classes' do
|
22
|
-
Blazing::Recipe.list.first.should
|
22
|
+
Blazing::Recipe.list.first.should == Blazing::Recipe::Dummy
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
describe '.parse_gemfile' do
|
27
|
-
|
28
|
-
it 'works when the recipe gems are specified with versions' do
|
29
|
-
gemfile = 'spec/support/gemfile_with_versions'
|
30
|
-
Blazing::Recipe.parse_gemfile(gemfile).should == ["blazing-passenger", "blazing-rails"]
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'works when the recipe gems are specified without' do
|
34
|
-
gemfile = 'spec/support/gemfile_without_versions'
|
35
|
-
Blazing::Recipe.parse_gemfile(gemfile).should == ["blazing-passenger", "blazing-rails"]
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'does not load gems that are commented out' do
|
39
|
-
pending
|
40
|
-
gemfile = 'spec/support/gemfile_with_comments'
|
41
|
-
Blazing::Recipe.parse_gemfile(gemfile).should == ["blazing-passenger"]
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
26
|
describe '#run' do
|
47
27
|
|
48
28
|
before :each do
|
29
|
+
@production_url = '/some/target'
|
49
30
|
@dummy_recipe = Blazing::Recipe::Dummy.new(:some_option => 'global')
|
50
31
|
@config = Blazing::Config.new
|
51
32
|
@config.target(:production, @production_url, :some_option => 'target-specific')
|
data/spec/blazing/target_spec.rb
CHANGED
@@ -46,4 +46,28 @@ describe Blazing::Target do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
describe '#rake_command' do
|
50
|
+
|
51
|
+
it 'prepends the environment variables specified in the rake call' do
|
52
|
+
config = Blazing::Config.new
|
53
|
+
config.rake :deploy, 'SOMEFUNKYVARIABLE=foobar'
|
54
|
+
target = Blazing::Target.new(:sometarget, '/path', config)
|
55
|
+
target.rake_command.should == 'SOMEFUNKYVARIABLE=foobar bundle exec rake deploy'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'appends the RAILS_ENV specified as :rails_env option to the target call' do
|
59
|
+
config = Blazing::Config.new
|
60
|
+
config.rake :deploy
|
61
|
+
target = Blazing::Target.new(:sometarget, '/path', config, :rails_env => 'production')
|
62
|
+
target.rake_command.should == ' RAILS_ENV=production bundle exec rake deploy'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns nil when no rake task was specified in config' do
|
66
|
+
config = Blazing::Config.new
|
67
|
+
target = Blazing::Target.new(:sometarget, '/path', config, :rails_env => 'production')
|
68
|
+
target.rake_command.should be nil
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
49
73
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'blazing'
|
2
|
+
require 'rspec'
|
3
|
+
require 'stringio'
|
4
|
+
require 'pry'
|
2
5
|
|
3
6
|
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
7
|
|
@@ -21,17 +24,16 @@ RSpec.configure do |config|
|
|
21
24
|
|
22
25
|
Logging.logger.root.appenders = 'string_io'
|
23
26
|
|
24
|
-
def capture(
|
27
|
+
def capture(*streams)
|
28
|
+
streams.map! { |stream| stream.to_s }
|
25
29
|
begin
|
26
|
-
|
27
|
-
eval "$#{stream} =
|
30
|
+
result = StringIO.new
|
31
|
+
streams.each { |stream| eval "$#{stream} = result" }
|
28
32
|
yield
|
29
|
-
result = eval("$#{stream}").string
|
30
33
|
ensure
|
31
|
-
eval("$#{stream} = #{stream.upcase}")
|
34
|
+
streams.each { |stream| eval("$#{stream} = #{stream.upcase}") }
|
32
35
|
end
|
33
|
-
|
34
|
-
result
|
36
|
+
result.string
|
35
37
|
end
|
36
38
|
|
37
39
|
def setup_sandbox
|
@@ -44,7 +46,17 @@ RSpec.configure do |config|
|
|
44
46
|
# Setup Sandbox and cd into it
|
45
47
|
Dir.mkdir(@sandbox_directory)
|
46
48
|
Dir.chdir(@sandbox_directory)
|
47
|
-
|
49
|
+
|
50
|
+
# Setup dummy repository
|
51
|
+
Dir.mkdir('repository')
|
52
|
+
`git init repository`
|
53
|
+
|
54
|
+
# Setup dummy project
|
55
|
+
Dir.mkdir('project')
|
56
|
+
`git init project`
|
57
|
+
|
58
|
+
# cd into project
|
59
|
+
Dir.chdir('project')
|
48
60
|
end
|
49
61
|
|
50
62
|
def teardown_sandbox
|
@@ -53,7 +65,14 @@ RSpec.configure do |config|
|
|
53
65
|
FileUtils.rm_rf(@sandbox_directory)
|
54
66
|
end
|
55
67
|
|
56
|
-
def
|
57
|
-
File.
|
68
|
+
def spec_root
|
69
|
+
File.dirname(__FILE__)
|
58
70
|
end
|
71
|
+
|
72
|
+
#def prepare_sample_config
|
73
|
+
#sample_config = File.join(spec_root, 'support', 'sample_config_1.rb')
|
74
|
+
#Dir.mkdir(@sandbox_directory + '/config')
|
75
|
+
#FileUtils.cp(sample_config, @sandbox_directory + '/config/blazing.rb')
|
76
|
+
#end
|
77
|
+
|
59
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blazing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
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:
|
12
|
+
date: 2012-02-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &70200998141120 !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: *70200998141120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70200998140340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70200998140340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70200998139680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70200998139680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70200998139220 !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: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70200998139220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name: guard-
|
60
|
-
requirement: &
|
59
|
+
name: guard-rspectacle
|
60
|
+
requirement: &70200998138800 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70200998138800
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: &
|
70
|
+
name: ruby_gntp
|
71
|
+
requirement: &70200998138380 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70200998138380
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rb-fsevent
|
82
|
-
requirement: &
|
82
|
+
requirement: &70200998137940 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,21 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70200998137940
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: pry
|
93
|
+
requirement: &70200998137420 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70200998137420
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
name: grit
|
93
|
-
requirement: &
|
104
|
+
requirement: &70200998136960 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ! '>='
|
@@ -98,10 +109,21 @@ dependencies:
|
|
98
109
|
version: '0'
|
99
110
|
type: :runtime
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70200998136960
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: logging
|
104
|
-
requirement: &
|
115
|
+
requirement: &70200998136440 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :runtime
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70200998136440
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: thor
|
126
|
+
requirement: &70200998135940 !ruby/object:Gem::Requirement
|
105
127
|
none: false
|
106
128
|
requirements:
|
107
129
|
- - ! '>='
|
@@ -109,10 +131,10 @@ dependencies:
|
|
109
131
|
version: '0'
|
110
132
|
type: :runtime
|
111
133
|
prerelease: false
|
112
|
-
version_requirements: *
|
134
|
+
version_requirements: *70200998135940
|
113
135
|
- !ruby/object:Gem::Dependency
|
114
136
|
name: activesupport
|
115
|
-
requirement: &
|
137
|
+
requirement: &70200998135300 !ruby/object:Gem::Requirement
|
116
138
|
none: false
|
117
139
|
requirements:
|
118
140
|
- - ! '>='
|
@@ -120,10 +142,10 @@ dependencies:
|
|
120
142
|
version: '0'
|
121
143
|
type: :runtime
|
122
144
|
prerelease: false
|
123
|
-
version_requirements: *
|
145
|
+
version_requirements: *70200998135300
|
124
146
|
- !ruby/object:Gem::Dependency
|
125
147
|
name: i18n
|
126
|
-
requirement: &
|
148
|
+
requirement: &70200998134480 !ruby/object:Gem::Requirement
|
127
149
|
none: false
|
128
150
|
requirements:
|
129
151
|
- - ! '>='
|
@@ -131,7 +153,7 @@ dependencies:
|
|
131
153
|
version: '0'
|
132
154
|
type: :runtime
|
133
155
|
prerelease: false
|
134
|
-
version_requirements: *
|
156
|
+
version_requirements: *70200998134480
|
135
157
|
description: painless git push deployments for everyone
|
136
158
|
email:
|
137
159
|
- felipekaufmann@gmail.com
|
@@ -141,7 +163,9 @@ extensions: []
|
|
141
163
|
extra_rdoc_files: []
|
142
164
|
files:
|
143
165
|
- .gitignore
|
166
|
+
- .rspec
|
144
167
|
- .rvmrc
|
168
|
+
- .travis.yml
|
145
169
|
- CHANGELOG.md
|
146
170
|
- Gemfile
|
147
171
|
- Guardfile
|
@@ -151,6 +175,7 @@ files:
|
|
151
175
|
- bin/blazing
|
152
176
|
- blazing.gemspec
|
153
177
|
- lib/blazing.rb
|
178
|
+
- lib/blazing/cli.rb
|
154
179
|
- lib/blazing/config.rb
|
155
180
|
- lib/blazing/dsl_setter.rb
|
156
181
|
- lib/blazing/logger.rb
|
@@ -163,9 +188,9 @@ files:
|
|
163
188
|
- lib/blazing/version.rb
|
164
189
|
- spec/blazing/config_spec.rb
|
165
190
|
- spec/blazing/integration/init_spec.rb
|
166
|
-
- spec/blazing/integration/
|
167
|
-
- spec/blazing/integration/
|
168
|
-
- spec/blazing/integration/
|
191
|
+
- spec/blazing/integration/list_spec.rb
|
192
|
+
- spec/blazing/integration/recipes_spec.rb
|
193
|
+
- spec/blazing/integration/setup_spec.rb
|
169
194
|
- spec/blazing/integration/update_spec.rb
|
170
195
|
- spec/blazing/recipe_spec.rb
|
171
196
|
- spec/blazing/runner_spec.rb
|
@@ -202,9 +227,9 @@ summary: git push deployment helper
|
|
202
227
|
test_files:
|
203
228
|
- spec/blazing/config_spec.rb
|
204
229
|
- spec/blazing/integration/init_spec.rb
|
205
|
-
- spec/blazing/integration/
|
206
|
-
- spec/blazing/integration/
|
207
|
-
- spec/blazing/integration/
|
230
|
+
- spec/blazing/integration/list_spec.rb
|
231
|
+
- spec/blazing/integration/recipes_spec.rb
|
232
|
+
- spec/blazing/integration/setup_spec.rb
|
208
233
|
- spec/blazing/integration/update_spec.rb
|
209
234
|
- spec/blazing/recipe_spec.rb
|
210
235
|
- spec/blazing/runner_spec.rb
|