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,85 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method 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
|
+
Cape do
|
14
|
+
mirror_rake_tasks 'my_namespace'
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I run `cap -T`
|
18
|
+
Then the output should not contain "cap with_period"
|
19
|
+
And the output should contain:
|
20
|
+
"""
|
21
|
+
cap my_namespace:in_a_namespace # My task in a namespace.
|
22
|
+
"""
|
23
|
+
And the output should contain:
|
24
|
+
"""
|
25
|
+
cap my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
|
26
|
+
"""
|
27
|
+
|
28
|
+
Scenario: do not mirror Rake task 'with_period'
|
29
|
+
Given a full-featured Rakefile
|
30
|
+
And a file named "Capfile" with:
|
31
|
+
"""
|
32
|
+
require 'cape'
|
33
|
+
|
34
|
+
Cape do
|
35
|
+
mirror_rake_tasks :my_namespace
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I run `cap -e with_period`
|
39
|
+
Then the output should contain exactly:
|
40
|
+
"""
|
41
|
+
The task `with_period' does not exist.
|
42
|
+
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario: mirror Rake task 'my_namespace:in_a_namespace' with its description
|
46
|
+
Given a full-featured Rakefile
|
47
|
+
And a file named "Capfile" with:
|
48
|
+
"""
|
49
|
+
require 'cape'
|
50
|
+
|
51
|
+
Cape do
|
52
|
+
mirror_rake_tasks :my_namespace
|
53
|
+
end
|
54
|
+
"""
|
55
|
+
When I run `cap -e my_namespace:in_a_namespace`
|
56
|
+
Then the output should contain exactly:
|
57
|
+
"""
|
58
|
+
------------------------------------------------------------
|
59
|
+
cap my_namespace:in_a_namespace
|
60
|
+
------------------------------------------------------------
|
61
|
+
My task in a namespace.
|
62
|
+
|
63
|
+
|
64
|
+
"""
|
65
|
+
|
66
|
+
Scenario: mirror Rake task 'my_namespace:my_nested_namespace:in_a_nested_namespace' with its description
|
67
|
+
Given a full-featured Rakefile
|
68
|
+
And a file named "Capfile" with:
|
69
|
+
"""
|
70
|
+
require 'cape'
|
71
|
+
|
72
|
+
Cape do
|
73
|
+
mirror_rake_tasks :my_namespace
|
74
|
+
end
|
75
|
+
"""
|
76
|
+
When I run `cap -e my_namespace:my_nested_namespace:in_a_nested_namespace`
|
77
|
+
Then the output should contain exactly:
|
78
|
+
"""
|
79
|
+
------------------------------------------------------------
|
80
|
+
cap my_namespace:my_nested_namespace:in_a_nested_namespace
|
81
|
+
------------------------------------------------------------
|
82
|
+
My task in a nested namespace.
|
83
|
+
|
84
|
+
|
85
|
+
"""
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method 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
|
+
Cape do
|
14
|
+
mirror_rake_tasks 'with_period'
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I run `cap -T`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
cap with_period # Ends with period.
|
21
|
+
"""
|
22
|
+
And the output should not contain "cap without_period"
|
23
|
+
|
24
|
+
Scenario: mirror Rake task 'with_period' with its description
|
25
|
+
Given a full-featured Rakefile
|
26
|
+
And a file named "Capfile" with:
|
27
|
+
"""
|
28
|
+
require 'cape'
|
29
|
+
|
30
|
+
Cape do
|
31
|
+
mirror_rake_tasks :with_period
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
When I run `cap -e with_period`
|
35
|
+
Then the output should contain exactly:
|
36
|
+
"""
|
37
|
+
------------------------------------------------------------
|
38
|
+
cap with_period
|
39
|
+
------------------------------------------------------------
|
40
|
+
Ends with period.
|
41
|
+
|
42
|
+
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario: do not mirror Rake task 'without_period'
|
46
|
+
Given a full-featured Rakefile
|
47
|
+
And a file named "Capfile" with:
|
48
|
+
"""
|
49
|
+
require 'cape'
|
50
|
+
|
51
|
+
Cape do
|
52
|
+
mirror_rake_tasks :with_period
|
53
|
+
end
|
54
|
+
"""
|
55
|
+
When I run `cap -e without_period`
|
56
|
+
Then the output should contain exactly:
|
57
|
+
"""
|
58
|
+
The task `without_period' does not exist.
|
59
|
+
|
60
|
+
"""
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method 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
|
+
Cape do
|
14
|
+
mirror_rake_tasks 'this_does_not_exist'
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I run `cap -T`
|
18
|
+
Then the output should not contain "cap with_period"
|
19
|
+
|
20
|
+
Scenario: do not mirror Rake task 'with_period'
|
21
|
+
Given a full-featured Rakefile
|
22
|
+
And a file named "Capfile" with:
|
23
|
+
"""
|
24
|
+
require 'cape'
|
25
|
+
|
26
|
+
Cape do
|
27
|
+
mirror_rake_tasks :this_does_not_exist
|
28
|
+
end
|
29
|
+
"""
|
30
|
+
When I run `cap -e with_period`
|
31
|
+
Then the output should contain exactly:
|
32
|
+
"""
|
33
|
+
The task `with_period' does not exist.
|
34
|
+
|
35
|
+
"""
|
@@ -0,0 +1,243 @@
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method 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
|
+
Cape do
|
14
|
+
mirror_rake_tasks
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I run `cap -T`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
cap with_period # Ends with period.
|
21
|
+
"""
|
22
|
+
And the output should contain:
|
23
|
+
"""
|
24
|
+
cap without_period # Ends without period.
|
25
|
+
"""
|
26
|
+
And the output should contain:
|
27
|
+
"""
|
28
|
+
cap long # My long task -- it has a ve...
|
29
|
+
"""
|
30
|
+
And the output should contain:
|
31
|
+
"""
|
32
|
+
cap with_one_arg # My task with one argument.
|
33
|
+
"""
|
34
|
+
And the output should contain:
|
35
|
+
"""
|
36
|
+
cap my_namespace:in_a_namespace # My task in a namespace.
|
37
|
+
"""
|
38
|
+
And the output should contain:
|
39
|
+
"""
|
40
|
+
cap my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
|
41
|
+
"""
|
42
|
+
And the output should contain:
|
43
|
+
"""
|
44
|
+
cap with_two_args # My task with two arguments.
|
45
|
+
"""
|
46
|
+
And the output should contain:
|
47
|
+
"""
|
48
|
+
cap with_three_args # My task with three arguments.
|
49
|
+
"""
|
50
|
+
And the output should not contain "cap hidden_task"
|
51
|
+
|
52
|
+
Scenario: mirror Rake task 'with_period' with its description
|
53
|
+
Given a full-featured Rakefile
|
54
|
+
And a file named "Capfile" with:
|
55
|
+
"""
|
56
|
+
require 'cape'
|
57
|
+
|
58
|
+
Cape do
|
59
|
+
mirror_rake_tasks
|
60
|
+
end
|
61
|
+
"""
|
62
|
+
When I run `cap -e with_period`
|
63
|
+
Then the output should contain exactly:
|
64
|
+
"""
|
65
|
+
------------------------------------------------------------
|
66
|
+
cap with_period
|
67
|
+
------------------------------------------------------------
|
68
|
+
Ends with period.
|
69
|
+
|
70
|
+
|
71
|
+
"""
|
72
|
+
|
73
|
+
Scenario: mirror Rake task 'without_period' with its description
|
74
|
+
Given a full-featured Rakefile
|
75
|
+
And a file named "Capfile" with:
|
76
|
+
"""
|
77
|
+
require 'cape'
|
78
|
+
|
79
|
+
Cape do
|
80
|
+
mirror_rake_tasks
|
81
|
+
end
|
82
|
+
"""
|
83
|
+
When I run `cap -e without_period`
|
84
|
+
Then the output should contain exactly:
|
85
|
+
"""
|
86
|
+
------------------------------------------------------------
|
87
|
+
cap without_period
|
88
|
+
------------------------------------------------------------
|
89
|
+
Ends without period.
|
90
|
+
|
91
|
+
|
92
|
+
"""
|
93
|
+
|
94
|
+
Scenario: mirror Rake task 'long' with its description
|
95
|
+
Given a full-featured Rakefile
|
96
|
+
And a file named "Capfile" with:
|
97
|
+
"""
|
98
|
+
require 'cape'
|
99
|
+
|
100
|
+
Cape do
|
101
|
+
mirror_rake_tasks
|
102
|
+
end
|
103
|
+
"""
|
104
|
+
When I run `cap -e long`
|
105
|
+
Then the output should contain exactly:
|
106
|
+
"""
|
107
|
+
------------------------------------------------------------
|
108
|
+
cap long
|
109
|
+
------------------------------------------------------------
|
110
|
+
My long task -- it has a very, very, very, very, very, very, very, very, very,
|
111
|
+
very, very, very, very, very, very, very, very, very, very, very, very, very,
|
112
|
+
very, very, very, very long description.
|
113
|
+
|
114
|
+
|
115
|
+
"""
|
116
|
+
|
117
|
+
Scenario: mirror Rake task 'with_one_arg' with its description
|
118
|
+
Given a full-featured Rakefile
|
119
|
+
And a file named "Capfile" with:
|
120
|
+
"""
|
121
|
+
require 'cape'
|
122
|
+
|
123
|
+
Cape do
|
124
|
+
mirror_rake_tasks
|
125
|
+
end
|
126
|
+
"""
|
127
|
+
When I run `cap -e with_one_arg`
|
128
|
+
Then the output should contain exactly:
|
129
|
+
"""
|
130
|
+
------------------------------------------------------------
|
131
|
+
cap with_one_arg
|
132
|
+
------------------------------------------------------------
|
133
|
+
My task with one argument.
|
134
|
+
|
135
|
+
You must set environment variable THE_ARG.
|
136
|
+
|
137
|
+
|
138
|
+
"""
|
139
|
+
|
140
|
+
Scenario: mirror Rake task 'my_namespace:in_a_namespace' with its description
|
141
|
+
Given a full-featured Rakefile
|
142
|
+
And a file named "Capfile" with:
|
143
|
+
"""
|
144
|
+
require 'cape'
|
145
|
+
|
146
|
+
Cape do
|
147
|
+
mirror_rake_tasks
|
148
|
+
end
|
149
|
+
"""
|
150
|
+
When I run `cap -e my_namespace:in_a_namespace`
|
151
|
+
Then the output should contain exactly:
|
152
|
+
"""
|
153
|
+
------------------------------------------------------------
|
154
|
+
cap my_namespace:in_a_namespace
|
155
|
+
------------------------------------------------------------
|
156
|
+
My task in a namespace.
|
157
|
+
|
158
|
+
|
159
|
+
"""
|
160
|
+
|
161
|
+
Scenario: mirror Rake task 'my_namespace:my_nested_namespace:in_a_nested_namespace' with its description
|
162
|
+
Given a full-featured Rakefile
|
163
|
+
And a file named "Capfile" with:
|
164
|
+
"""
|
165
|
+
require 'cape'
|
166
|
+
|
167
|
+
Cape do
|
168
|
+
mirror_rake_tasks
|
169
|
+
end
|
170
|
+
"""
|
171
|
+
When I run `cap -e my_namespace:my_nested_namespace:in_a_nested_namespace`
|
172
|
+
Then the output should contain exactly:
|
173
|
+
"""
|
174
|
+
------------------------------------------------------------
|
175
|
+
cap my_namespace:my_nested_namespace:in_a_nested_namespace
|
176
|
+
------------------------------------------------------------
|
177
|
+
My task in a nested namespace.
|
178
|
+
|
179
|
+
|
180
|
+
"""
|
181
|
+
|
182
|
+
Scenario: mirror Rake task 'with_two_args' with its description
|
183
|
+
Given a full-featured Rakefile
|
184
|
+
And a file named "Capfile" with:
|
185
|
+
"""
|
186
|
+
require 'cape'
|
187
|
+
|
188
|
+
Cape do
|
189
|
+
mirror_rake_tasks
|
190
|
+
end
|
191
|
+
"""
|
192
|
+
When I run `cap -e with_two_args`
|
193
|
+
Then the output should contain exactly:
|
194
|
+
"""
|
195
|
+
------------------------------------------------------------
|
196
|
+
cap with_two_args
|
197
|
+
------------------------------------------------------------
|
198
|
+
My task with two arguments.
|
199
|
+
|
200
|
+
You must set environment variables MY_ARG1 and MY_ARG2.
|
201
|
+
|
202
|
+
|
203
|
+
"""
|
204
|
+
|
205
|
+
Scenario: mirror Rake task 'with_three_args' with its description
|
206
|
+
Given a full-featured Rakefile
|
207
|
+
And a file named "Capfile" with:
|
208
|
+
"""
|
209
|
+
require 'cape'
|
210
|
+
|
211
|
+
Cape do
|
212
|
+
mirror_rake_tasks
|
213
|
+
end
|
214
|
+
"""
|
215
|
+
When I run `cap -e with_three_args`
|
216
|
+
Then the output should contain exactly:
|
217
|
+
"""
|
218
|
+
------------------------------------------------------------
|
219
|
+
cap with_three_args
|
220
|
+
------------------------------------------------------------
|
221
|
+
My task with three arguments.
|
222
|
+
|
223
|
+
You must set environment variables AN_ARG1, AN_ARG2, and AN_ARG3.
|
224
|
+
|
225
|
+
|
226
|
+
"""
|
227
|
+
|
228
|
+
Scenario: do not mirror Rake task 'hidden_task'
|
229
|
+
Given a full-featured Rakefile
|
230
|
+
And a file named "Capfile" with:
|
231
|
+
"""
|
232
|
+
require 'cape'
|
233
|
+
|
234
|
+
Cape do
|
235
|
+
mirror_rake_tasks
|
236
|
+
end
|
237
|
+
"""
|
238
|
+
When I run `cap -e hidden_task`
|
239
|
+
Then the output should contain exactly:
|
240
|
+
"""
|
241
|
+
The task `hidden_task' does not exist.
|
242
|
+
|
243
|
+
"""
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Given 'a full-featured Rakefile' do
|
2
|
+
step 'a file named "Rakefile" with:', <<-end_step
|
3
|
+
desc 'Ends with period.'
|
4
|
+
task :with_period
|
5
|
+
|
6
|
+
desc 'Ends without period'
|
7
|
+
task :without_period
|
8
|
+
|
9
|
+
desc 'My long task -- it has a very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very long description'
|
10
|
+
task :long
|
11
|
+
|
12
|
+
desc 'My task with one argument'
|
13
|
+
task :with_one_arg, [:the_arg]
|
14
|
+
|
15
|
+
namespace :my_namespace do
|
16
|
+
desc 'My task in a namespace'
|
17
|
+
task :in_a_namespace
|
18
|
+
|
19
|
+
namespace :my_nested_namespace do
|
20
|
+
desc 'My task in a nested namespace'
|
21
|
+
task :in_a_nested_namespace
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'My task with two arguments'
|
26
|
+
task :with_two_args, [:my_arg1, :my_arg2]
|
27
|
+
|
28
|
+
desc 'My task with three arguments'
|
29
|
+
task :with_three_args, [:an_arg1, :an_arg2, :an_arg3]
|
30
|
+
|
31
|
+
task :hidden_task
|
32
|
+
end_step
|
33
|
+
end
|