borg-rb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWZmNWNmZDM1M2Y1YzdlNGIwNzQ4ZmJlNGI0NTVlMTMyODAyMTNiYw==
4
+ YTU2Mzc2MGFjZTM4Nzg3M2FhNGM5NTQwMjNhMTkwNTI2MGMxM2VlOA==
5
5
  data.tar.gz: !binary |-
6
- OTU4ZDg4MTQ3NjlkYjkyZTFhMWJmNTdhOTI2MWYyNWRmZDRmMzZlNA==
6
+ NTk4NGZjNzEyOWJhZGM2MDUyYzMxOWRhMGNiODZiODFhZGY0NDdlYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTJjNmY1MjVhMTEzY2RlNWE5ZmI0ZTVlYWQ1OGE1OWFkMWM0ZjU5ZDZkOTRj
10
- ZmFhNzY5ODE4MjBhNTQ3MTkwOWMzNjk0OGY1YjM4MDE5NWIzYjJmNTY1ZWEz
11
- ZDRmMjkyM2IwZDcyZGYzYzA5MWYzNDEyZmU3MGE0NzhiNDcxNjQ=
9
+ Y2Q1MzlmMmIwNjFlZDYzZDQwYjZjYTdmYWNkMTFhMGM3OWY3YWE5MTFhY2Rh
10
+ ZDQ3MDZmNTlmZjNhYjE5OWMwODcxNDJmOGRmNGJmMDJmYjEzMDMxMjMxYzZi
11
+ MWRhMzdjZGMzNzhhMmYzYWY0ZTljYWViYTEzODBmYjBiNTQzODA=
12
12
  data.tar.gz: !binary |-
13
- NjA5ZDBhMGU2ZmI0ODkwNTI0ZjI0OGU4YzlmNmQyMDc3ZjFhMTUxODBlMGUy
14
- MmFmOTc5ZjE1ZjljZjA0MTIwOWIwOGE2ZTJiMTY4ZTVlYzg4YWM0ZDYwYTc5
15
- Mzk2OWQ1ZmU2YWIzYWEzZWNmMjZlN2I0YzY0NTgyZjA4NDhjNzI=
13
+ MDE3ZjBmYTVmNTFmYTY0ZTZjMzJkNzIxOTJlNjQ5NTU1YjMyNjRiNzJlMGU1
14
+ YzQ2M2FhN2IyZjgyOWZiMGViM2RmMzQ2ZGNlZDBmMGE3YjMwMGI3ZDM3ZTQz
15
+ NzQxOTExZmUyNmFmNzRjZjhiNWU2OWI1ZTQ2N2I5OTM0MzJhZWY=
data/CHANGELOG.md CHANGED
@@ -1,10 +1,11 @@
1
1
  ## HEAD
2
2
 
3
- ## 0.0.4 / 3-22-2013
4
-
5
- * Fix load problem in Capfile in generated skeleton (0.0.2)
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
- * Allow access to `application` and `stage` in an application configuration by creating a capistrano variable for them
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
@@ -1,3 +1,3 @@
1
1
  module Borg
2
- VERSION = "0.0.4"
2
+ VERSION = '0.0.5'
3
3
  end
@@ -3,65 +3,42 @@ require 'spec_helper'
3
3
  describe 'borg app:stage task' do
4
4
  include_context 'acceptance'
5
5
 
6
- # TODO: probably want to have some factory that generates what we want in an app config to DRY this out
7
- let(:basic_app_config) {
8
- <<-RUBY
9
- application :app do
10
- task :some_task do
11
- end
12
- end
13
- RUBY
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(:app_config_with_stage_with_display_app_task) {
44
- <<-RUBY
45
- stage :app, :prd do
46
- task :display_app do
47
- puts "The application is set to: \#{application}"
48
- end
49
- end
50
- RUBY
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 "app with no stages" do
34
+ context 'app with no stages' do
58
35
  before do
59
- environment.create_file('cap/applications/app.rb', basic_app_config)
36
+ environment.create_file('cap/applications/app.rb', app_config)
60
37
  end
61
38
 
62
- it "allows us to run tasks for that app" do
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', 'some_task')
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 "app with stages: prd, stg" do
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 "allows us to set common/stage-specific tasks" do
61
+ it 'allows us to execute common/stage-specific tasks' do
80
62
  # commonly defined tasks
81
- assert_execute('borg', 'app:prd', 'common_task')
82
- assert_execute('borg', 'app:stg', 'common_task')
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 'the task prints `app`' do
100
- result = execute('borg', 'app', 'display_app')
101
- expect(result.stdout).to match(/The application is set to: app/)
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(:stage_test_config) {
7
- <<-RUBY
8
- stage :app, :prd do
9
- task :display_stage do
10
- puts "The stage is set to: \#{stage}"
11
- end
12
- end
13
- RUBY
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', stage_test_config)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: borg-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Identified