cape 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +6 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/Gemfile +18 -0
- data/History.markdown +7 -0
- data/MIT-LICENSE.markdown +10 -0
- data/README.markdown +157 -0
- data/Rakefile +49 -0
- data/cape.gemspec +36 -0
- data/features/dsl/each_rake_task/with_defined_namespace_argument.feature +43 -0
- data/features/dsl/each_rake_task/with_defined_task_argument.feature +37 -0
- data/features/dsl/each_rake_task/with_undefined_argument.feature +31 -0
- data/features/dsl/each_rake_task/without_arguments.feature +81 -0
- data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/with_defined_namespace_argument.feature +93 -0
- data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/with_defined_task_argument.feature +66 -0
- data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/with_undefined_argument.feature +39 -0
- data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/without_arguments.feature +263 -0
- data/features/dsl/mirror_rake_tasks/with_defined_namespace_argument.feature +85 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_argument.feature +60 -0
- data/features/dsl/mirror_rake_tasks/with_undefined_argument.feature +35 -0
- data/features/dsl/mirror_rake_tasks/without_arguments.feature +243 -0
- data/features/step_definitions.rb +33 -0
- data/features/support/env.rb +1 -0
- data/features/task_invocation/nonparameterized.feature +69 -0
- data/features/task_invocation/parameterized.feature +70 -0
- data/lib/cape.rb +22 -0
- data/lib/cape/capistrano.rb +86 -0
- data/lib/cape/core_ext.rb +10 -0
- data/lib/cape/core_ext/hash.rb +24 -0
- data/lib/cape/core_ext/symbol.rb +25 -0
- data/lib/cape/dsl.rb +81 -0
- data/lib/cape/rake.rb +60 -0
- data/lib/cape/strings.rb +25 -0
- data/lib/cape/version.rb +6 -0
- data/spec/cape/capistrano_spec.rb +0 -0
- data/spec/cape/core_ext/hash_spec.rb +12 -0
- data/spec/cape/core_ext/symbol_spec.rb +7 -0
- data/spec/cape/dsl_spec.rb +128 -0
- data/spec/cape/rake_spec.rb +0 -0
- data/spec/cape/strings_spec.rb +44 -0
- data/spec/cape/task_spec.rb +0 -0
- data/spec/cape/version_spec.rb +6 -0
- data/spec/cape_spec.rb +5 -0
- metadata +192 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, with an argument of a defined namespace
|
2
|
+
|
3
|
+
In order to include Rake tasks with descriptions in my Capistrano recipes,
|
4
|
+
As a developer using Cape,
|
5
|
+
I want to use the Cape DSL.
|
6
|
+
|
7
|
+
Scenario: mirror only the Rake tasks in the matching namespace
|
8
|
+
Given a full-featured Rakefile
|
9
|
+
And a file named "Capfile" with:
|
10
|
+
"""
|
11
|
+
require 'cape'
|
12
|
+
|
13
|
+
namespace :ns do
|
14
|
+
Cape do |cape|
|
15
|
+
cape.mirror_rake_tasks 'my_namespace'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
When I run `cap -T`
|
20
|
+
Then the output should not contain "cap ns:with_period"
|
21
|
+
And the output should contain:
|
22
|
+
"""
|
23
|
+
cap ns:my_namespace:in_a_namespace # My task in a namespace.
|
24
|
+
"""
|
25
|
+
And the output should contain:
|
26
|
+
"""
|
27
|
+
cap ns:my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
|
28
|
+
"""
|
29
|
+
|
30
|
+
Scenario: do not mirror Rake task 'with_period'
|
31
|
+
Given a full-featured Rakefile
|
32
|
+
And a file named "Capfile" with:
|
33
|
+
"""
|
34
|
+
require 'cape'
|
35
|
+
|
36
|
+
namespace :ns do
|
37
|
+
Cape do |cape|
|
38
|
+
cape.mirror_rake_tasks :my_namespace
|
39
|
+
end
|
40
|
+
end
|
41
|
+
"""
|
42
|
+
When I run `cap -e ns:with_period`
|
43
|
+
Then the output should contain exactly:
|
44
|
+
"""
|
45
|
+
The task `ns:with_period' does not exist.
|
46
|
+
|
47
|
+
"""
|
48
|
+
|
49
|
+
Scenario: mirror Rake task 'my_namespace:in_a_namespace' with its description
|
50
|
+
Given a full-featured Rakefile
|
51
|
+
And a file named "Capfile" with:
|
52
|
+
"""
|
53
|
+
require 'cape'
|
54
|
+
|
55
|
+
namespace :ns do
|
56
|
+
Cape do |cape|
|
57
|
+
cape.mirror_rake_tasks :my_namespace
|
58
|
+
end
|
59
|
+
end
|
60
|
+
"""
|
61
|
+
When I run `cap -e ns:my_namespace:in_a_namespace`
|
62
|
+
Then the output should contain exactly:
|
63
|
+
"""
|
64
|
+
------------------------------------------------------------
|
65
|
+
cap ns:my_namespace:in_a_namespace
|
66
|
+
------------------------------------------------------------
|
67
|
+
My task in a namespace.
|
68
|
+
|
69
|
+
|
70
|
+
"""
|
71
|
+
|
72
|
+
Scenario: mirror Rake task 'my_namespace:my_nested_namespace:in_a_nested_namespace' with its description
|
73
|
+
Given a full-featured Rakefile
|
74
|
+
And a file named "Capfile" with:
|
75
|
+
"""
|
76
|
+
require 'cape'
|
77
|
+
|
78
|
+
namespace :ns do
|
79
|
+
Cape do |cape|
|
80
|
+
cape.mirror_rake_tasks :my_namespace
|
81
|
+
end
|
82
|
+
end
|
83
|
+
"""
|
84
|
+
When I run `cap -e ns:my_namespace:my_nested_namespace:in_a_nested_namespace`
|
85
|
+
Then the output should contain exactly:
|
86
|
+
"""
|
87
|
+
------------------------------------------------------------
|
88
|
+
cap ns:my_namespace:my_nested_namespace:in_a_nested_namespace
|
89
|
+
------------------------------------------------------------
|
90
|
+
My task in a nested namespace.
|
91
|
+
|
92
|
+
|
93
|
+
"""
|
data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/with_defined_task_argument.feature
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, with an argument of a defined task
|
2
|
+
|
3
|
+
In order to include Rake tasks with descriptions in my Capistrano recipes,
|
4
|
+
As a developer using Cape,
|
5
|
+
I want to use the Cape DSL.
|
6
|
+
|
7
|
+
Scenario: mirror only the matching Rake task
|
8
|
+
Given a full-featured Rakefile
|
9
|
+
And a file named "Capfile" with:
|
10
|
+
"""
|
11
|
+
require 'cape'
|
12
|
+
|
13
|
+
namespace :ns do
|
14
|
+
Cape do |cape|
|
15
|
+
cape.mirror_rake_tasks 'with_period'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
When I run `cap -T`
|
20
|
+
Then the output should contain:
|
21
|
+
"""
|
22
|
+
cap ns:with_period # Ends with period.
|
23
|
+
"""
|
24
|
+
And the output should not contain "cap ns:without_period"
|
25
|
+
|
26
|
+
Scenario: mirror Rake task 'with_period' with its description
|
27
|
+
Given a full-featured Rakefile
|
28
|
+
And a file named "Capfile" with:
|
29
|
+
"""
|
30
|
+
require 'cape'
|
31
|
+
|
32
|
+
namespace :ns do
|
33
|
+
Cape do |cape|
|
34
|
+
cape.mirror_rake_tasks :with_period
|
35
|
+
end
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I run `cap -e ns:with_period`
|
39
|
+
Then the output should contain exactly:
|
40
|
+
"""
|
41
|
+
------------------------------------------------------------
|
42
|
+
cap ns:with_period
|
43
|
+
------------------------------------------------------------
|
44
|
+
Ends with period.
|
45
|
+
|
46
|
+
|
47
|
+
"""
|
48
|
+
|
49
|
+
Scenario: do not mirror Rake task 'without_period'
|
50
|
+
Given a full-featured Rakefile
|
51
|
+
And a file named "Capfile" with:
|
52
|
+
"""
|
53
|
+
require 'cape'
|
54
|
+
|
55
|
+
namespace :ns do
|
56
|
+
Cape do |cape|
|
57
|
+
cape.mirror_rake_tasks :with_period
|
58
|
+
end
|
59
|
+
end
|
60
|
+
"""
|
61
|
+
When I run `cap -e ns:without_period`
|
62
|
+
Then the output should contain exactly:
|
63
|
+
"""
|
64
|
+
The task `ns:without_period' does not exist.
|
65
|
+
|
66
|
+
"""
|
data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace/with_undefined_argument.feature
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, with an undefined argument
|
2
|
+
|
3
|
+
In order to include Rake tasks with descriptions in my Capistrano recipes,
|
4
|
+
As a developer using Cape,
|
5
|
+
I want to use the Cape DSL.
|
6
|
+
|
7
|
+
Scenario: do not mirror any Rake tasks
|
8
|
+
Given a full-featured Rakefile
|
9
|
+
And a file named "Capfile" with:
|
10
|
+
"""
|
11
|
+
require 'cape'
|
12
|
+
|
13
|
+
namespace :ns do
|
14
|
+
Cape do |cape|
|
15
|
+
cape.mirror_rake_tasks 'this_does_not_exist'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
When I run `cap -T`
|
20
|
+
Then the output should not contain "cap ns:with_period"
|
21
|
+
|
22
|
+
Scenario: do not mirror Rake task 'with_period'
|
23
|
+
Given a full-featured Rakefile
|
24
|
+
And a file named "Capfile" with:
|
25
|
+
"""
|
26
|
+
require 'cape'
|
27
|
+
|
28
|
+
namespace :ns do
|
29
|
+
Cape do |cape|
|
30
|
+
cape.mirror_rake_tasks :this_does_not_exist
|
31
|
+
end
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
When I run `cap -e ns:with_period`
|
35
|
+
Then the output should contain exactly:
|
36
|
+
"""
|
37
|
+
The task `ns:with_period' does not exist.
|
38
|
+
|
39
|
+
"""
|
@@ -0,0 +1,263 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, without arguments
|
2
|
+
|
3
|
+
In order to include Rake tasks with descriptions in my Capistrano recipes,
|
4
|
+
As a developer using Cape,
|
5
|
+
I want to use the Cape DSL.
|
6
|
+
|
7
|
+
Scenario: mirror all non-hidden Rake tasks
|
8
|
+
Given a full-featured Rakefile
|
9
|
+
And a file named "Capfile" with:
|
10
|
+
"""
|
11
|
+
require 'cape'
|
12
|
+
|
13
|
+
namespace :ns do
|
14
|
+
Cape do |cape|
|
15
|
+
cape.mirror_rake_tasks
|
16
|
+
end
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
When I run `cap -T`
|
20
|
+
Then the output should contain:
|
21
|
+
"""
|
22
|
+
cap ns:with_period # Ends with period.
|
23
|
+
"""
|
24
|
+
And the output should contain:
|
25
|
+
"""
|
26
|
+
cap ns:without_period # Ends without period.
|
27
|
+
"""
|
28
|
+
And the output should contain:
|
29
|
+
"""
|
30
|
+
cap ns:long # My long task -- it has a ve...
|
31
|
+
"""
|
32
|
+
And the output should contain:
|
33
|
+
"""
|
34
|
+
cap ns:with_one_arg # My task with one argument.
|
35
|
+
"""
|
36
|
+
And the output should contain:
|
37
|
+
"""
|
38
|
+
cap ns:my_namespace:in_a_namespace # My task in a namespace.
|
39
|
+
"""
|
40
|
+
And the output should contain:
|
41
|
+
"""
|
42
|
+
cap ns:my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
|
43
|
+
"""
|
44
|
+
And the output should contain:
|
45
|
+
"""
|
46
|
+
cap ns:with_two_args # My task with two arguments.
|
47
|
+
"""
|
48
|
+
And the output should contain:
|
49
|
+
"""
|
50
|
+
cap ns:with_three_args # My task with three arguments.
|
51
|
+
"""
|
52
|
+
And the output should not contain "cap hidden_task"
|
53
|
+
|
54
|
+
Scenario: mirror Rake task 'with_period' with its description
|
55
|
+
Given a full-featured Rakefile
|
56
|
+
And a file named "Capfile" with:
|
57
|
+
"""
|
58
|
+
require 'cape'
|
59
|
+
|
60
|
+
namespace :ns do
|
61
|
+
Cape do |cape|
|
62
|
+
cape.mirror_rake_tasks
|
63
|
+
end
|
64
|
+
end
|
65
|
+
"""
|
66
|
+
When I run `cap -e ns:with_period`
|
67
|
+
Then the output should contain exactly:
|
68
|
+
"""
|
69
|
+
------------------------------------------------------------
|
70
|
+
cap ns:with_period
|
71
|
+
------------------------------------------------------------
|
72
|
+
Ends with period.
|
73
|
+
|
74
|
+
|
75
|
+
"""
|
76
|
+
|
77
|
+
Scenario: mirror Rake task 'without_period' with its description
|
78
|
+
Given a full-featured Rakefile
|
79
|
+
And a file named "Capfile" with:
|
80
|
+
"""
|
81
|
+
require 'cape'
|
82
|
+
|
83
|
+
namespace :ns do
|
84
|
+
Cape do |cape|
|
85
|
+
cape.mirror_rake_tasks
|
86
|
+
end
|
87
|
+
end
|
88
|
+
"""
|
89
|
+
When I run `cap -e ns:without_period`
|
90
|
+
Then the output should contain exactly:
|
91
|
+
"""
|
92
|
+
------------------------------------------------------------
|
93
|
+
cap ns:without_period
|
94
|
+
------------------------------------------------------------
|
95
|
+
Ends without period.
|
96
|
+
|
97
|
+
|
98
|
+
"""
|
99
|
+
|
100
|
+
Scenario: mirror Rake task 'long' with its description
|
101
|
+
Given a full-featured Rakefile
|
102
|
+
And a file named "Capfile" with:
|
103
|
+
"""
|
104
|
+
require 'cape'
|
105
|
+
|
106
|
+
namespace :ns do
|
107
|
+
Cape do |cape|
|
108
|
+
cape.mirror_rake_tasks
|
109
|
+
end
|
110
|
+
end
|
111
|
+
"""
|
112
|
+
When I run `cap -e ns:long`
|
113
|
+
Then the output should contain exactly:
|
114
|
+
"""
|
115
|
+
------------------------------------------------------------
|
116
|
+
cap ns:long
|
117
|
+
------------------------------------------------------------
|
118
|
+
My long task -- it has a very, very, very, very, very, very, very, very, very,
|
119
|
+
very, very, very, very, very, very, very, very, very, very, very, very, very,
|
120
|
+
very, very, very, very long description.
|
121
|
+
|
122
|
+
|
123
|
+
"""
|
124
|
+
|
125
|
+
Scenario: mirror Rake task 'with_one_arg' with its description
|
126
|
+
Given a full-featured Rakefile
|
127
|
+
And a file named "Capfile" with:
|
128
|
+
"""
|
129
|
+
require 'cape'
|
130
|
+
|
131
|
+
namespace :ns do
|
132
|
+
Cape do |cape|
|
133
|
+
cape.mirror_rake_tasks
|
134
|
+
end
|
135
|
+
end
|
136
|
+
"""
|
137
|
+
When I run `cap -e ns:with_one_arg`
|
138
|
+
Then the output should contain exactly:
|
139
|
+
"""
|
140
|
+
------------------------------------------------------------
|
141
|
+
cap ns:with_one_arg
|
142
|
+
------------------------------------------------------------
|
143
|
+
My task with one argument.
|
144
|
+
|
145
|
+
You must set environment variable THE_ARG.
|
146
|
+
|
147
|
+
|
148
|
+
"""
|
149
|
+
|
150
|
+
Scenario: mirror Rake task 'my_namespace:in_a_namespace' with its description
|
151
|
+
Given a full-featured Rakefile
|
152
|
+
And a file named "Capfile" with:
|
153
|
+
"""
|
154
|
+
require 'cape'
|
155
|
+
|
156
|
+
namespace :ns do
|
157
|
+
Cape do |cape|
|
158
|
+
cape.mirror_rake_tasks
|
159
|
+
end
|
160
|
+
end
|
161
|
+
"""
|
162
|
+
When I run `cap -e ns:my_namespace:in_a_namespace`
|
163
|
+
Then the output should contain exactly:
|
164
|
+
"""
|
165
|
+
------------------------------------------------------------
|
166
|
+
cap ns:my_namespace:in_a_namespace
|
167
|
+
------------------------------------------------------------
|
168
|
+
My task in a namespace.
|
169
|
+
|
170
|
+
|
171
|
+
"""
|
172
|
+
|
173
|
+
Scenario: mirror Rake task 'my_namespace:my_nested_namespace:in_a_nested_namespace' with its description
|
174
|
+
Given a full-featured Rakefile
|
175
|
+
And a file named "Capfile" with:
|
176
|
+
"""
|
177
|
+
require 'cape'
|
178
|
+
|
179
|
+
namespace :ns do
|
180
|
+
Cape do |cape|
|
181
|
+
cape.mirror_rake_tasks
|
182
|
+
end
|
183
|
+
end
|
184
|
+
"""
|
185
|
+
When I run `cap -e ns:my_namespace:my_nested_namespace:in_a_nested_namespace`
|
186
|
+
Then the output should contain exactly:
|
187
|
+
"""
|
188
|
+
------------------------------------------------------------
|
189
|
+
cap ns:my_namespace:my_nested_namespace:in_a_nested_namespace
|
190
|
+
------------------------------------------------------------
|
191
|
+
My task in a nested namespace.
|
192
|
+
|
193
|
+
|
194
|
+
"""
|
195
|
+
|
196
|
+
Scenario: mirror Rake task 'with_two_args' with its description
|
197
|
+
Given a full-featured Rakefile
|
198
|
+
And a file named "Capfile" with:
|
199
|
+
"""
|
200
|
+
require 'cape'
|
201
|
+
|
202
|
+
namespace :ns do
|
203
|
+
Cape do |cape|
|
204
|
+
cape.mirror_rake_tasks
|
205
|
+
end
|
206
|
+
end
|
207
|
+
"""
|
208
|
+
When I run `cap -e ns:with_two_args`
|
209
|
+
Then the output should contain exactly:
|
210
|
+
"""
|
211
|
+
------------------------------------------------------------
|
212
|
+
cap ns:with_two_args
|
213
|
+
------------------------------------------------------------
|
214
|
+
My task with two arguments.
|
215
|
+
|
216
|
+
You must set environment variables MY_ARG1 and MY_ARG2.
|
217
|
+
|
218
|
+
|
219
|
+
"""
|
220
|
+
|
221
|
+
Scenario: mirror Rake task 'with_three_args' with its description
|
222
|
+
Given a full-featured Rakefile
|
223
|
+
And a file named "Capfile" with:
|
224
|
+
"""
|
225
|
+
require 'cape'
|
226
|
+
|
227
|
+
namespace :ns do
|
228
|
+
Cape do |cape|
|
229
|
+
cape.mirror_rake_tasks
|
230
|
+
end
|
231
|
+
end
|
232
|
+
"""
|
233
|
+
When I run `cap -e ns:with_three_args`
|
234
|
+
Then the output should contain exactly:
|
235
|
+
"""
|
236
|
+
------------------------------------------------------------
|
237
|
+
cap ns:with_three_args
|
238
|
+
------------------------------------------------------------
|
239
|
+
My task with three arguments.
|
240
|
+
|
241
|
+
You must set environment variables AN_ARG1, AN_ARG2, and AN_ARG3.
|
242
|
+
|
243
|
+
|
244
|
+
"""
|
245
|
+
|
246
|
+
Scenario: do not mirror Rake task 'hidden_task'
|
247
|
+
Given a full-featured Rakefile
|
248
|
+
And a file named "Capfile" with:
|
249
|
+
"""
|
250
|
+
require 'cape'
|
251
|
+
|
252
|
+
namespace :ns do
|
253
|
+
Cape do |cape|
|
254
|
+
cape.mirror_rake_tasks
|
255
|
+
end
|
256
|
+
end
|
257
|
+
"""
|
258
|
+
When I run `cap -e ns:hidden_task`
|
259
|
+
Then the output should contain exactly:
|
260
|
+
"""
|
261
|
+
The task `ns:hidden_task' does not exist.
|
262
|
+
|
263
|
+
"""
|