cape 1.6.2 → 1.7.0
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/Gemfile +7 -6
- data/Guardfile +29 -10
- data/History.markdown +4 -0
- data/README.markdown +38 -9
- data/Rakefile +35 -8
- data/features/dsl/each_rake_task/{without_arguments.feature → unqualified.feature} +16 -37
- data/features/dsl/each_rake_task/{with_defined_namespace_argument.feature → with_defined_namespace.feature} +2 -13
- data/features/dsl/each_rake_task/{with_defined_task_argument.feature → with_defined_task.feature} +2 -6
- data/features/dsl/each_rake_task/with_undefined_task_or_namespace.feature +24 -0
- data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace.feature +2 -2
- data/features/dsl/mirror_rake_tasks/{without_arguments.feature → unqualified.feature} +15 -11
- data/features/dsl/mirror_rake_tasks/with_cd.feature +63 -0
- data/features/dsl/mirror_rake_tasks/with_cd_and_environment_variables.feature +27 -0
- data/features/dsl/mirror_rake_tasks/{with_defined_namespace_argument.feature → with_defined_namespace.feature} +6 -8
- data/features/dsl/mirror_rake_tasks/{with_defined_task_argument.feature → with_defined_task.feature} +4 -4
- data/features/dsl/mirror_rake_tasks/{with_defined_task_argument_and_environment_variables.feature → with_defined_task_and_cd.feature} +8 -8
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_cd_and_environment_variables.feature +46 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_environment_variables.feature +92 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename.feature +47 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd.feature +49 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd_and_environment_variables.feature +52 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_environment_variables.feature +50 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options.feature +49 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd.feature +51 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd_and_environment_variables.feature +54 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_environment_variables.feature +52 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options.feature +53 -6
- data/features/dsl/mirror_rake_tasks/{with_defined_task_and_valid_options_arguments_and_environment_variables.feature → with_defined_task_and_valid_options_and_cd.feature} +10 -8
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_cd_and_environment_variables.feature +48 -0
- data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_environment_variables.feature +98 -0
- data/features/dsl/mirror_rake_tasks/with_environment_variables.feature +61 -4
- data/features/dsl/mirror_rake_tasks/with_rename.feature +27 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_cd.feature +28 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_cd_and_environment_variables.feature +30 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_environment_variables.feature +29 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options.feature +28 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd.feature +29 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd_and_environment_variables.feature +31 -0
- data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_environment_variables.feature +30 -0
- data/features/dsl/mirror_rake_tasks/{with_undefined_argument.feature → with_undefined_task_or_namespace.feature} +3 -4
- data/features/dsl/mirror_rake_tasks/with_valid_options.feature +46 -0
- data/features/dsl/mirror_rake_tasks/{with_valid_options_argument.feature → with_valid_options_and_cd.feature} +7 -5
- data/features/dsl/mirror_rake_tasks/with_valid_options_and_cd_and_environment_variables.feature +28 -0
- data/features/dsl/mirror_rake_tasks/with_valid_options_and_environment_variables.feature +51 -0
- data/features/dsl/rake_executable.feature +2 -2
- data/features/step_definitions.rb +40 -0
- data/lib/cape.rb +2 -0
- data/lib/cape/capistrano.rb +59 -32
- data/lib/cape/capistrano_deprecated.rb +165 -0
- data/lib/cape/core_ext.rb +2 -0
- data/lib/cape/deprecation.rb +12 -0
- data/lib/cape/deprecation/base.rb +59 -0
- data/lib/cape/deprecation/capistrano_deprecated_define_rake_wrapper.rb +168 -0
- data/lib/cape/deprecation/dsl_deprecated_mirror_rake_tasks.rb +145 -0
- data/lib/cape/dsl.rb +49 -60
- data/lib/cape/dsl_deprecated.rb +157 -0
- data/lib/cape/hash_list.rb +2 -0
- data/lib/cape/recipe_definition.rb +103 -0
- data/lib/cape/recipe_definition_deprecated.rb +41 -0
- data/lib/cape/util.rb +2 -0
- data/lib/cape/version.rb +1 -1
- data/lib/cape/xterm.rb +326 -0
- data/spec/cape/deprecation/base_sharedspec.rb +18 -0
- data/spec/cape/deprecation/capistrano_deprecated_define_rake_wrapper_spec.rb +157 -0
- data/spec/cape/deprecation/dsl_deprecated_mirror_rake_tasks_spec.rb +153 -0
- data/spec/cape/dsl_deprecated_spec.rb +307 -0
- data/spec/cape/dsl_spec.rb +10 -43
- data/spec/cape/recipe_definition_spec.rb +53 -0
- data/spec/cape/xterm_spec.rb +72 -0
- metadata +97 -28
- data/features/dsl/each_rake_task/with_undefined_argument.feature +0 -53
- data/features/dsl/mirror_rake_tasks/with_valid_options_arguments_and_environment_variables.feature +0 -26
data/Gemfile
CHANGED
|
@@ -3,18 +3,19 @@ source 'http://rubygems.org'
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
group :debug do
|
|
6
|
-
gem 'ruby-debug',
|
|
7
|
-
gem 'ruby-debug19',
|
|
6
|
+
gem 'ruby-debug', '~> 0', :platforms => :mri_18
|
|
7
|
+
gem 'ruby-debug19', '~> 0', :platforms => :mri_19, :require => 'ruby-debug'
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
group :doc do
|
|
11
|
-
gem 'yard',
|
|
12
|
-
gem 'rdiscount',
|
|
11
|
+
gem 'yard', '~> 0', :platforms => [:ruby, :mswin, :mingw]
|
|
12
|
+
gem 'rdiscount', :platforms => [:ruby, :mswin, :mingw]
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
group :tooling do
|
|
16
|
-
gem 'guard-
|
|
16
|
+
gem 'guard-cucumber', '~> 1'
|
|
17
|
+
gem 'guard-rspec', '~> 2'
|
|
17
18
|
if RUBY_PLATFORM =~ /darwin/i
|
|
18
|
-
gem 'rb-fsevent',
|
|
19
|
+
gem 'rb-fsevent', '~> 0', :require => false
|
|
19
20
|
end
|
|
20
21
|
end
|
data/Guardfile
CHANGED
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
interactor :off
|
|
2
|
+
|
|
3
|
+
guard :rspec, :cli => '--debug' do
|
|
2
4
|
# Run the corresponding spec (or all specs) when code changes.
|
|
3
|
-
watch(
|
|
4
|
-
|
|
5
|
-
if File.file?( File.expand_path( "../#{corresponding_spec}", __FILE__ ))
|
|
6
|
-
corresponding_spec
|
|
7
|
-
else
|
|
8
|
-
'spec'
|
|
9
|
-
end
|
|
5
|
+
watch(%r{^lib/(.+)\.rb$}) do |match|
|
|
6
|
+
Dir[File.join("**/#{match[1]}_spec.rb")].first || 'spec'
|
|
10
7
|
end
|
|
11
8
|
|
|
12
9
|
# Run a spec when it changes.
|
|
13
10
|
watch %r{^spec/.+_spec\.rb$}
|
|
14
11
|
|
|
15
12
|
# Run all specs when the RSpec configuration changes.
|
|
16
|
-
watch(
|
|
13
|
+
watch('.rspec' ) { 'spec' }
|
|
14
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
|
17
15
|
|
|
18
16
|
# Run all specs when the bundle changes.
|
|
19
|
-
watch(
|
|
17
|
+
watch('Gemfile.lock') { 'spec' }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
guard :cucumber do
|
|
21
|
+
# Run run all features when code changes.
|
|
22
|
+
watch(%r{^lib/(.+)\.rb$}) { 'features' }
|
|
23
|
+
|
|
24
|
+
# Run the corresponding feature (or all features) when a step definition
|
|
25
|
+
# changes.
|
|
26
|
+
watch(%r{^features/step_definitions\.rb$}) { 'features' }
|
|
27
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |match|
|
|
28
|
+
Dir[File.join("**/#{match[1]}.feature")].first || 'features'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Run a feature when it changes.
|
|
32
|
+
watch %r{^features/.+\.feature$}
|
|
33
|
+
|
|
34
|
+
# Run all features when the Cucumber configuration changes.
|
|
35
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
|
36
|
+
|
|
37
|
+
# Run all features when the bundle changes.
|
|
38
|
+
watch('Gemfile.lock') { 'features' }
|
|
20
39
|
end
|
data/History.markdown
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Version history for the _Cape_ project
|
|
2
2
|
|
|
3
|
+
## <a name="v1.7.0"></a>v1.7.0, Thu 3/07/2013
|
|
4
|
+
|
|
5
|
+
* Introduce a new DSL that supports task renaming and path switching, and deprecate the old one
|
|
6
|
+
|
|
3
7
|
## <a name="v1.6.2"></a>v1.6.2, Fri 2/22/2013
|
|
4
8
|
|
|
5
9
|
* Correctly update environment variables when set more than once
|
data/README.markdown
CHANGED
|
@@ -166,9 +166,9 @@ Cape lets you filter the Rake tasks to be mirrored. Note that Cape statements mu
|
|
|
166
166
|
mirror_rake_tasks :foo
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
### Mirror Rake tasks that require Capistrano recipe options and/or environment variables
|
|
169
|
+
### Mirror Rake tasks that require renaming, Capistrano recipe options, path switching, and/or environment variables
|
|
170
170
|
|
|
171
|
-
Cape lets you
|
|
171
|
+
Cape lets you customize mirrored Rake tasks to suit your needs. Note that Cape statements must be contained in a `Cape` block, and references to Capistrano variables such as `rails_env` and `release_path` must be contained in an inner block, lambda, or other callable object.
|
|
172
172
|
|
|
173
173
|
# config/deploy.rb
|
|
174
174
|
|
|
@@ -176,13 +176,37 @@ Cape lets you specify options used for defining Capistrano recipes. You can also
|
|
|
176
176
|
|
|
177
177
|
Cape do
|
|
178
178
|
# Display defined Rails routes on application server remote machines only.
|
|
179
|
-
mirror_rake_tasks :routes
|
|
179
|
+
mirror_rake_tasks :routes do |recipes|
|
|
180
|
+
recipes.options[:roles] = :app
|
|
181
|
+
end
|
|
180
182
|
|
|
181
183
|
# Execute database migration on application server remote machines only,
|
|
182
184
|
# and set the 'RAILS_ENV' environment variable to the value of the
|
|
183
185
|
# Capistrano variable 'rails_env'.
|
|
184
|
-
mirror_rake_tasks 'db:migrate'
|
|
185
|
-
|
|
186
|
+
mirror_rake_tasks 'db:migrate' do |recipes|
|
|
187
|
+
recipes.options[:roles] = :app
|
|
188
|
+
recipes.env['RAILS_ENV'] = lambda { rails_env }
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Support a Rake task that must be run on application server remote
|
|
192
|
+
# machines only, and in the remote directory 'release_path' instead of the
|
|
193
|
+
# default, 'current_path'.
|
|
194
|
+
before 'deploy:symlink', :spec
|
|
195
|
+
mirror_rake_tasks :spec do |recipes|
|
|
196
|
+
recipes.cd { release_path }
|
|
197
|
+
recipes.options[:roles] = :app
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Avoid collisions with the existing Ruby method #test, run tests on
|
|
201
|
+
# application server remote machines only, and set the 'RAILS_ENV'
|
|
202
|
+
# environment variable to the value of the Capistrano variable
|
|
203
|
+
# 'rails_env'.
|
|
204
|
+
mirror_rake_tasks :test do |recipes|
|
|
205
|
+
recipes.rename do |rake_task_name|
|
|
206
|
+
"#{rake_task_name}_task"
|
|
207
|
+
end
|
|
208
|
+
recipes.options[:roles] = :app
|
|
209
|
+
recipes.env['RAILS_ENV'] = lambda { rails_env }
|
|
186
210
|
end
|
|
187
211
|
end
|
|
188
212
|
|
|
@@ -215,6 +239,15 @@ The above is equivalent to the following manually-defined Capistrano recipes.
|
|
|
215
239
|
end
|
|
216
240
|
end
|
|
217
241
|
|
|
242
|
+
before 'deploy:symlink', :spec
|
|
243
|
+
task :spec, :roles => :app do
|
|
244
|
+
run "cd #{release_path} && #{RAKE} routes"
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
task :test_task, :roles => :app do
|
|
248
|
+
run "cd #{current_path} && #{RAKE} test RAILS_ENV=#{rails_env}"
|
|
249
|
+
end
|
|
250
|
+
|
|
218
251
|
### Mirror Rake tasks into a Capistrano namespace
|
|
219
252
|
|
|
220
253
|
Cape plays friendly with the Capistrano DSL for organizing Rake tasks in Capistrano namespaces. Note that Cape statements must be contained in a `Cape` block.
|
|
@@ -286,10 +319,6 @@ Note that Cape statements must be contained in a `Cape` block.
|
|
|
286
319
|
|
|
287
320
|
gem 'rake', '>= 0.9.3'
|
|
288
321
|
|
|
289
|
-
**A Rake task whose name collides with a Ruby method cannot be mirrored.** For example, the name of [Rails](http://rubyonrails.org)’s _db:fixtures:load_ task collides with the Ruby Core Library’s [_Kernel::load_ method](http://ruby-doc.org/core/Kernel.html#method-i-load) because that method is mixed into all objects. If you try to mirror _db:fixtures:load_, Capistrano will raise an exception. There is [a questionable workaround](http://github.com/njonsson/cape/issues/7#issuecomment-5632718 "Comment on Cape issue #7 (“defining a task named ‘load’ would shadow an existing method with that name (ArgumentError)”)") for this.
|
|
290
|
-
|
|
291
|
-
**A Rake task is always executed in the Capistrano deployment’s _current_path_.** You may need to execute a task under _release_path_ or another remote filesystem location, but this is not possible at present. [Discuss](http://github.com/njonsson/cape/issues/9 "Cape issue #9 (“Cape Always Runs the Mirrorred Rake Tasks Under $current_path”)") this.
|
|
292
|
-
|
|
293
322
|
## Contributing
|
|
294
323
|
|
|
295
324
|
Report defects and feature requests on [GitHub Issues](http://github.com/njonsson/cape/issues).
|
data/Rakefile
CHANGED
|
@@ -15,11 +15,33 @@ else
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
def define_features_task(name, options)
|
|
19
|
+
Cucumber::Rake::Task.new name, options[:desc] do |t|
|
|
20
|
+
t.bundler = false
|
|
21
|
+
t.cucumber_opts = options[:cucumber_opts] if options.key?(:cucumber_opts)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
tags = `grep -Ehr "^\\s*@\\S+\\s*$" features`.split("\n").
|
|
26
|
+
collect(&:strip).
|
|
27
|
+
uniq.
|
|
28
|
+
sort
|
|
29
|
+
options = {:desc => 'Test features'}
|
|
30
|
+
options[:cucumber_opts] = '-t @focus' if tags.delete('@focus')
|
|
31
|
+
define_features_task :features, options
|
|
32
|
+
|
|
33
|
+
unless tags.empty?
|
|
34
|
+
namespace :features do
|
|
35
|
+
tags.each do |t|
|
|
36
|
+
define_features_task t.gsub(/^@/, ''),
|
|
37
|
+
:desc => "Test features tagged #{t}",
|
|
38
|
+
:cucumber_opts => "-t #{t}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
20
41
|
end
|
|
21
42
|
|
|
22
43
|
def define_spec_task(name, options={})
|
|
44
|
+
desc options[:desc]
|
|
23
45
|
RSpec::Core::RakeTask.new name do |t|
|
|
24
46
|
t.rspec_opts ||= []
|
|
25
47
|
unless options[:debug] == false
|
|
@@ -30,12 +52,18 @@ def define_spec_task(name, options={})
|
|
|
30
52
|
t.rspec_opts << '--debug'
|
|
31
53
|
end
|
|
32
54
|
end
|
|
33
|
-
t.pattern = %w(spec/*_spec.rb spec/**/*_spec.rb)
|
|
55
|
+
t.pattern = options[:pattern] || %w(spec/*_spec.rb spec/**/*_spec.rb)
|
|
34
56
|
end
|
|
35
57
|
end
|
|
36
58
|
|
|
37
|
-
desc 'Run specs'
|
|
38
|
-
|
|
59
|
+
define_spec_task :spec, :desc => 'Run specs'
|
|
60
|
+
|
|
61
|
+
namespace :spec do
|
|
62
|
+
uncommitted_specs = `git ls-files --modified --others *_spec.rb`.split("\n")
|
|
63
|
+
desc = 'Run uncommitted specs'
|
|
64
|
+
desc += ' (none)' if uncommitted_specs.empty?
|
|
65
|
+
define_spec_task :uncommitted, :desc => desc, :pattern => uncommitted_specs
|
|
66
|
+
end
|
|
39
67
|
|
|
40
68
|
desc 'Run specs and test features'
|
|
41
69
|
task '' => [:spec, :features]
|
|
@@ -43,12 +71,11 @@ task :default => [:spec, :features]
|
|
|
43
71
|
|
|
44
72
|
# Support the 'gem test' command.
|
|
45
73
|
namespace :test do
|
|
46
|
-
desc ''
|
|
47
|
-
define_spec_task :specs, :debug => false
|
|
74
|
+
define_spec_task :spec, :desc => '', :debug => false
|
|
48
75
|
|
|
49
76
|
Cucumber::Rake::Task.new :features, '' do |t|
|
|
50
77
|
t.bundler = false
|
|
51
78
|
t.cucumber_opts = '--backtrace'
|
|
52
79
|
end
|
|
53
80
|
end
|
|
54
|
-
task :test => %w(test:
|
|
81
|
+
task :test => %w(test:spec test:features)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Feature: The #each_rake_task DSL method
|
|
1
|
+
Feature: The #each_rake_task DSL method
|
|
2
2
|
|
|
3
3
|
In order to use the metadata of Rake tasks in my Capistrano recipes,
|
|
4
4
|
As a developer using Cape,
|
|
@@ -25,58 +25,37 @@ Feature: The #each_rake_task DSL method without arguments
|
|
|
25
25
|
Then the output should contain:
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
Name: "
|
|
29
|
-
Description: "
|
|
30
|
-
"""
|
|
31
|
-
And the output should contain:
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
Name: "without_period"
|
|
35
|
-
Description: "Ends without period"
|
|
36
|
-
"""
|
|
37
|
-
And the output should contain:
|
|
38
|
-
"""
|
|
28
|
+
Name: "hidden_task"
|
|
29
|
+
Description: ""
|
|
39
30
|
|
|
40
31
|
Name: "long"
|
|
41
32
|
Description: "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"
|
|
42
|
-
"""
|
|
43
|
-
And the output should contain:
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
Name: "with_one_arg"
|
|
47
|
-
Parameters: ["the_arg"]
|
|
48
|
-
Description: "My task with one argument"
|
|
49
|
-
"""
|
|
50
|
-
And the output should contain:
|
|
51
|
-
"""
|
|
52
33
|
|
|
53
34
|
Name: "my_namespace"
|
|
54
35
|
Description: "A task that shadows a namespace"
|
|
55
36
|
Default
|
|
56
|
-
"""
|
|
57
|
-
And the output should contain:
|
|
58
|
-
"""
|
|
59
37
|
|
|
60
38
|
Name: "my_namespace:in_a_namespace"
|
|
61
39
|
Description: "My task in a namespace"
|
|
62
|
-
"""
|
|
63
|
-
And the output should contain:
|
|
64
|
-
"""
|
|
65
40
|
|
|
66
41
|
Name: "my_namespace:my_nested_namespace:in_a_nested_namespace"
|
|
67
42
|
Description: "My task in a nested namespace"
|
|
68
|
-
"""
|
|
69
|
-
And the output should contain:
|
|
70
|
-
"""
|
|
71
43
|
|
|
72
|
-
Name: "
|
|
73
|
-
Parameters: ["
|
|
74
|
-
Description: "My task with
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
""
|
|
44
|
+
Name: "with_one_arg"
|
|
45
|
+
Parameters: ["the_arg"]
|
|
46
|
+
Description: "My task with one argument"
|
|
47
|
+
|
|
48
|
+
Name: "with_period"
|
|
49
|
+
Description: "Ends with period."
|
|
78
50
|
|
|
79
51
|
Name: "with_three_args"
|
|
80
52
|
Parameters: ["an_arg1", "an_arg2", "an_arg3"]
|
|
81
53
|
Description: "My task with three arguments"
|
|
54
|
+
|
|
55
|
+
Name: "with_two_args"
|
|
56
|
+
Parameters: ["my_arg1", "my_arg2"]
|
|
57
|
+
Description: "My task with two arguments"
|
|
58
|
+
|
|
59
|
+
Name: "without_period"
|
|
60
|
+
Description: "Ends without period"
|
|
82
61
|
"""
|
|
@@ -22,28 +22,17 @@ Feature: The #each_rake_task DSL method with an argument of a defined namespace
|
|
|
22
22
|
end
|
|
23
23
|
"""
|
|
24
24
|
When I run `cap -vT`
|
|
25
|
-
Then the output should
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
Name: "with_period"
|
|
29
|
-
Description: "Ends with period."
|
|
30
|
-
"""
|
|
31
|
-
And the output should contain:
|
|
25
|
+
Then the output should contain:
|
|
32
26
|
"""
|
|
33
27
|
|
|
34
28
|
Name: "my_namespace"
|
|
35
29
|
Description: "A task that shadows a namespace"
|
|
36
30
|
Default
|
|
37
|
-
"""
|
|
38
|
-
And the output should contain:
|
|
39
|
-
"""
|
|
40
31
|
|
|
41
32
|
Name: "my_namespace:in_a_namespace"
|
|
42
33
|
Description: "My task in a namespace"
|
|
43
|
-
"""
|
|
44
|
-
And the output should contain:
|
|
45
|
-
"""
|
|
46
34
|
|
|
47
35
|
Name: "my_namespace:my_nested_namespace:in_a_nested_namespace"
|
|
48
36
|
Description: "My task in a nested namespace"
|
|
49
37
|
"""
|
|
38
|
+
And the output should not contain "with_period"
|
data/features/dsl/each_rake_task/{with_defined_task_argument.feature → with_defined_task.feature}
RENAMED
|
@@ -27,9 +27,5 @@ Feature: The #each_rake_task DSL method with an argument of a defined task
|
|
|
27
27
|
Name: "with_period"
|
|
28
28
|
Description: "Ends with period."
|
|
29
29
|
"""
|
|
30
|
-
And the output should not contain
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Name: "without_period"
|
|
34
|
-
Description: "Ends without period"
|
|
35
|
-
"""
|
|
30
|
+
And the output should not contain "without_period"
|
|
31
|
+
And the output should not contain "my_namespace"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Feature: The #each_rake_task DSL method with an undefined task or namespace
|
|
2
|
+
|
|
3
|
+
In order to use the metadata of Rake tasks in my Capistrano recipes,
|
|
4
|
+
As a developer using Cape,
|
|
5
|
+
I want to use the Cape DSL.
|
|
6
|
+
|
|
7
|
+
Scenario: do not enumerate any Rake tasks
|
|
8
|
+
Given a full-featured Rakefile
|
|
9
|
+
And a Capfile with:
|
|
10
|
+
"""
|
|
11
|
+
Cape do
|
|
12
|
+
each_rake_task 'period' do |t|
|
|
13
|
+
$stdout.puts '', "Name: #{t[:name].inspect}"
|
|
14
|
+
if t[:parameters]
|
|
15
|
+
$stdout.puts "Parameters: #{t[:parameters].inspect}"
|
|
16
|
+
end
|
|
17
|
+
if t[:description]
|
|
18
|
+
$stdout.puts "Description: #{t[:description].inspect}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
"""
|
|
23
|
+
When I run `cap -vT`
|
|
24
|
+
Then the output should not contain "period"
|
|
@@ -24,7 +24,7 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace
|
|
|
24
24
|
Given a full-featured Rakefile
|
|
25
25
|
And a Capfile with:
|
|
26
26
|
"""
|
|
27
|
-
set :current_path, '/
|
|
27
|
+
set :current_path, '/current/path'
|
|
28
28
|
|
|
29
29
|
namespace :ns do
|
|
30
30
|
Cape do |cape|
|
|
@@ -36,5 +36,5 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace
|
|
|
36
36
|
Then the output should contain:
|
|
37
37
|
"""
|
|
38
38
|
* executing `ns:with_period'
|
|
39
|
-
* executing "cd /
|
|
39
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
|
|
40
40
|
"""
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Feature: The #mirror_rake_tasks DSL method
|
|
1
|
+
Feature: The #mirror_rake_tasks DSL method
|
|
2
2
|
|
|
3
3
|
In order to include Rake tasks with descriptions in my Capistrano recipes,
|
|
4
4
|
As a developer using Cape,
|
|
@@ -49,6 +49,10 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
49
49
|
"""
|
|
50
50
|
cap with_three_args # My task with three arguments.
|
|
51
51
|
"""
|
|
52
|
+
And the output should contain:
|
|
53
|
+
"""
|
|
54
|
+
cap hidden_task #
|
|
55
|
+
"""
|
|
52
56
|
|
|
53
57
|
Scenario: mirror Rake task 'with_period' with its description
|
|
54
58
|
Given a full-featured Rakefile
|
|
@@ -73,7 +77,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
73
77
|
Given a full-featured Rakefile
|
|
74
78
|
And a Capfile with:
|
|
75
79
|
"""
|
|
76
|
-
set :current_path, '/
|
|
80
|
+
set :current_path, '/current/path'
|
|
77
81
|
|
|
78
82
|
Cape do
|
|
79
83
|
mirror_rake_tasks
|
|
@@ -83,7 +87,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
83
87
|
Then the output should contain:
|
|
84
88
|
"""
|
|
85
89
|
* executing `with_period'
|
|
86
|
-
* executing "cd /
|
|
90
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
|
|
87
91
|
`with_period' is only run for servers matching {}, but no servers matched
|
|
88
92
|
"""
|
|
89
93
|
|
|
@@ -171,7 +175,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
171
175
|
Given a full-featured Rakefile
|
|
172
176
|
And a Capfile with:
|
|
173
177
|
"""
|
|
174
|
-
set :current_path, '/
|
|
178
|
+
set :current_path, '/current/path'
|
|
175
179
|
|
|
176
180
|
Cape do
|
|
177
181
|
mirror_rake_tasks
|
|
@@ -181,7 +185,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
181
185
|
Then the output should contain:
|
|
182
186
|
"""
|
|
183
187
|
* executing `my_namespace'
|
|
184
|
-
* executing "cd /
|
|
188
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake my_namespace"
|
|
185
189
|
`my_namespace' is only run for servers matching {}, but no servers matched
|
|
186
190
|
"""
|
|
187
191
|
|
|
@@ -227,7 +231,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
227
231
|
Given a full-featured Rakefile
|
|
228
232
|
And a Capfile with:
|
|
229
233
|
"""
|
|
230
|
-
set :current_path, '/
|
|
234
|
+
set :current_path, '/current/path'
|
|
231
235
|
|
|
232
236
|
Cape do
|
|
233
237
|
mirror_rake_tasks
|
|
@@ -237,7 +241,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
237
241
|
Then the output should contain:
|
|
238
242
|
"""
|
|
239
243
|
* executing `my_namespace:my_nested_namespace:in_a_nested_namespace'
|
|
240
|
-
* executing "cd /
|
|
244
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake my_namespace:my_nested_namespace:in_a_nested_namespace"
|
|
241
245
|
`my_namespace:my_nested_namespace:in_a_nested_namespace' is only run for servers matching {}, but no servers matched
|
|
242
246
|
"""
|
|
243
247
|
|
|
@@ -289,7 +293,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
289
293
|
Given a full-featured Rakefile
|
|
290
294
|
And a Capfile with:
|
|
291
295
|
"""
|
|
292
|
-
set :current_path, '/
|
|
296
|
+
set :current_path, '/current/path'
|
|
293
297
|
|
|
294
298
|
Cape do
|
|
295
299
|
mirror_rake_tasks
|
|
@@ -299,7 +303,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
299
303
|
Then the output should contain:
|
|
300
304
|
"""
|
|
301
305
|
* executing `with_three_args'
|
|
302
|
-
* executing "cd /
|
|
306
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_three_args[\"a value for an_arg1\",\"a value for an_arg2\",\"a value for an_arg3\"]"
|
|
303
307
|
`with_three_args' is only run for servers matching {}, but no servers matched
|
|
304
308
|
"""
|
|
305
309
|
|
|
@@ -307,7 +311,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
307
311
|
Given a full-featured Rakefile
|
|
308
312
|
And a Capfile with:
|
|
309
313
|
"""
|
|
310
|
-
set :current_path, '/
|
|
314
|
+
set :current_path, '/current/path'
|
|
311
315
|
|
|
312
316
|
Cape do
|
|
313
317
|
mirror_rake_tasks
|
|
@@ -317,6 +321,6 @@ Feature: The #mirror_rake_tasks DSL method without arguments
|
|
|
317
321
|
Then the output should contain:
|
|
318
322
|
"""
|
|
319
323
|
* executing `with_three_args'
|
|
320
|
-
* executing "cd /
|
|
324
|
+
* executing "cd /current/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_three_args[,\"a value for an_arg2\",]"
|
|
321
325
|
`with_three_args' is only run for servers matching {}, but no servers matched
|
|
322
326
|
"""
|