borg-rb 0.0.4 → 0.0.5
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 +8 -8
- data/CHANGELOG.md +5 -4
- data/lib/borg/configuration/stages.rb +1 -1
- data/lib/borg/version.rb +1 -1
- data/spec/acceptance/application_spec.rb +37 -71
- data/spec/acceptance/stage_spec.rb +16 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTU2Mzc2MGFjZTM4Nzg3M2FhNGM5NTQwMjNhMTkwNTI2MGMxM2VlOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTk4NGZjNzEyOWJhZGM2MDUyYzMxOWRhMGNiODZiODFhZGY0NDdlYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2Q1MzlmMmIwNjFlZDYzZDQwYjZjYTdmYWNkMTFhMGM3OWY3YWE5MTFhY2Rh
|
10
|
+
ZDQ3MDZmNTlmZjNhYjE5OWMwODcxNDJmOGRmNGJmMDJmYjEzMDMxMjMxYzZi
|
11
|
+
MWRhMzdjZGMzNzhhMmYzYWY0ZTljYWViYTEzODBmYjBiNTQzODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDE3ZjBmYTVmNTFmYTY0ZTZjMzJkNzIxOTJlNjQ5NTU1YjMyNjRiNzJlMGU1
|
14
|
+
YzQ2M2FhN2IyZjgyOWZiMGViM2RmMzQ2ZGNlZDBmMGE3YjMwMGI3ZDM3ZTQz
|
15
|
+
NzQxOTExZmUyNmFmNzRjZjhiNWU2OWI1ZTQ2N2I5OTM0MzJhZWY=
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
-
## 0.0.
|
4
|
-
|
5
|
-
*
|
3
|
+
## 0.0.5 / 3-27-2013
|
4
|
+
* Allow stage definitions with empty blocks
|
5
|
+
* Allow access to `application` and `stage` in an application configuration by creating a capistrano variable for them (0.0.4)
|
6
6
|
* Change load borg-rb to a require (0.0.3)
|
7
|
-
*
|
7
|
+
* Fix load problem in Capfile in generated skeleton (0.0.2)
|
8
|
+
|
8
9
|
|
9
10
|
|
10
11
|
## 0.0.1 / 3-21-2013
|
@@ -13,7 +13,7 @@ module Borg
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
@applications[app].stages[name] ||= Stage.new(name, @applications[app])
|
16
|
-
@applications[app].stages[name].execution_blocks << block
|
16
|
+
@applications[app].stages[name].execution_blocks << block if block_given?
|
17
17
|
end
|
18
18
|
|
19
19
|
class Stage
|
data/lib/borg/version.rb
CHANGED
@@ -3,65 +3,42 @@ require 'spec_helper'
|
|
3
3
|
describe 'borg app:stage task' do
|
4
4
|
include_context 'acceptance'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
let(:app_config_with_stages) {
|
17
|
-
<<-RUBY
|
18
|
-
application :app do
|
19
|
-
task :common_task do
|
20
|
-
end
|
21
|
-
end
|
22
|
-
stage :app, :prd do
|
23
|
-
task :prd_task do
|
24
|
-
end
|
25
|
-
end
|
26
|
-
stage :app, :stg do
|
27
|
-
task :stg_task do
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBY
|
31
|
-
}
|
32
|
-
|
33
|
-
let(:app_config_with_display_app_task) {
|
34
|
-
<<-RUBY
|
35
|
-
application :app do
|
36
|
-
task :display_app do
|
37
|
-
puts "The application is set to: \#{application}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
RUBY
|
6
|
+
let(:app_config) { <<-RUBY.gsub(/^ {4}/, '')
|
7
|
+
application :app do
|
8
|
+
task :app_task do
|
9
|
+
end
|
10
|
+
task :display_app do
|
11
|
+
puts "The application is set to: \#{application}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
RUBY
|
41
15
|
}
|
42
16
|
|
43
|
-
let(:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
17
|
+
let(:app_config_with_stages) { app_config.concat <<-RUBY.gsub(/^ {6}/, '')
|
18
|
+
stage :app, :prd do
|
19
|
+
task :prd_task do
|
20
|
+
end
|
21
|
+
end
|
22
|
+
stage :app, :stg do
|
23
|
+
task :stg_task do
|
24
|
+
end
|
25
|
+
end
|
26
|
+
stage :app, :alf
|
27
|
+
RUBY
|
51
28
|
}
|
52
29
|
|
53
30
|
before do
|
54
31
|
assert_execute('borgify')
|
55
32
|
end
|
56
33
|
|
57
|
-
context
|
34
|
+
context 'app with no stages' do
|
58
35
|
before do
|
59
|
-
environment.create_file('cap/applications/app.rb',
|
36
|
+
environment.create_file('cap/applications/app.rb', app_config)
|
60
37
|
end
|
61
38
|
|
62
|
-
it
|
39
|
+
it 'allows us to execute tasks defined for the app' do
|
63
40
|
# a task defined for the app
|
64
|
-
assert_execute('borg', 'app', '
|
41
|
+
assert_execute('borg', 'app', 'app_task')
|
65
42
|
|
66
43
|
# an undefined task
|
67
44
|
expect(execute('borg', 'app', 'undefined_task')).to_not succeed
|
@@ -69,17 +46,23 @@ end
|
|
69
46
|
# an undefined app
|
70
47
|
expect(execute('borg', 'undefined_app', 'some_task')).to_not succeed
|
71
48
|
end
|
49
|
+
|
50
|
+
it 'can read the `application` capistrano variable' do
|
51
|
+
result = execute('borg', 'app', 'display_app')
|
52
|
+
expect(result.stdout).to match(/The application is set to: app/)
|
53
|
+
end
|
72
54
|
end
|
73
55
|
|
74
|
-
context
|
56
|
+
context 'app config with stages: prd, stg' do
|
75
57
|
before do
|
76
58
|
environment.create_file('cap/applications/app.rb', app_config_with_stages)
|
77
59
|
end
|
78
60
|
|
79
|
-
it
|
61
|
+
it 'allows us to execute common/stage-specific tasks' do
|
80
62
|
# commonly defined tasks
|
81
|
-
assert_execute('borg', 'app:prd', '
|
82
|
-
assert_execute('borg', 'app:stg', '
|
63
|
+
assert_execute('borg', 'app:prd', 'app_task')
|
64
|
+
assert_execute('borg', 'app:stg', 'app_task')
|
65
|
+
assert_execute('borg', 'app:alf', 'app_task')
|
83
66
|
|
84
67
|
# stage specific tasks in their respective stages
|
85
68
|
assert_execute('borg', 'app:prd', 'prd_task')
|
@@ -89,27 +72,10 @@ end
|
|
89
72
|
expect(execute('borg', 'app:stg', 'prd_task')).to_not succeed
|
90
73
|
expect(execute('borg', 'app:prd', 'stg_task')).to_not succeed
|
91
74
|
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'app with a task `display_app` which prints `application`' do
|
95
|
-
before do
|
96
|
-
environment.create_file('cap/applications/app.rb', app_config_with_display_app_task)
|
97
|
-
end
|
98
75
|
|
99
|
-
it '
|
100
|
-
|
101
|
-
expect(
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'app with stages: prd, and a task `display_app` which prints `application`' do
|
106
|
-
before do
|
107
|
-
environment.create_file('cap/applications/app.rb', app_config_with_stage_with_display_app_task)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'the task prints `app`' do
|
111
|
-
result = execute('borg', 'app:prd', 'display_app')
|
112
|
-
expect(result.stdout).to match(/The application is set to: app/)
|
76
|
+
it 'can read the `application` capistrano variable' do
|
77
|
+
expect(execute('borg', 'app:prd', 'display_app').stdout).to match(/The application is set to: app/)
|
78
|
+
expect(execute('borg', 'app:stg', 'display_app').stdout).to match(/The application is set to: app/)
|
113
79
|
end
|
114
80
|
end
|
115
81
|
|
@@ -3,14 +3,18 @@ require 'spec_helper'
|
|
3
3
|
describe 'borg app:stage task' do
|
4
4
|
include_context 'acceptance'
|
5
5
|
|
6
|
-
let(:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
let(:app_config) { <<-RUBY.gsub(/^ {4}/, '')
|
7
|
+
stage :app, :prd do
|
8
|
+
task :display_stage do
|
9
|
+
puts "The stage is set to: \#{stage}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
stage :app, :stg do
|
13
|
+
task :display_stage do
|
14
|
+
puts "The stage is set to: \#{stage}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
RUBY
|
14
18
|
}
|
15
19
|
|
16
20
|
before do
|
@@ -19,12 +23,14 @@ end
|
|
19
23
|
|
20
24
|
context 'app with stages: prd, and a task `display_stage` which prints `stage`' do
|
21
25
|
before do
|
22
|
-
environment.create_file('cap/applications/app.rb',
|
26
|
+
environment.create_file('cap/applications/app.rb', app_config)
|
23
27
|
end
|
24
28
|
|
25
|
-
it 'the task prints `prd`' do
|
29
|
+
it 'the task prints `prd` for app:prd, and `stg` for app:stg' do
|
26
30
|
result = execute('borg', 'app:prd', 'display_stage')
|
27
31
|
expect(result.stdout).to match(/The stage is set to: prd/)
|
32
|
+
result = execute('borg', 'app:stg', 'display_stage')
|
33
|
+
expect(result.stdout).to match(/The stage is set to: stg/)
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|