cape 1.7.0 → 1.8.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.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -1
  3. data/.rspec +1 -1
  4. data/.travis.yml +6 -2
  5. data/Appraisals +11 -0
  6. data/Gemfile +4 -4
  7. data/Guardfile +10 -4
  8. data/History.markdown +6 -0
  9. data/README.markdown +32 -17
  10. data/Rakefile +33 -13
  11. data/cape.gemspec +6 -2
  12. data/features/dsl/each_rake_task/unqualified.feature +0 -6
  13. data/features/dsl/each_rake_task/with_defined_namespace.feature +1 -1
  14. data/features/dsl/each_rake_task/with_defined_task.feature +4 -4
  15. data/features/dsl/each_rake_task/with_undefined_task_or_namespace.feature +2 -2
  16. data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace.feature +3 -4
  17. data/features/dsl/mirror_rake_tasks/unqualified.feature +89 -32
  18. data/features/dsl/mirror_rake_tasks/with_cd.feature +18 -12
  19. data/features/dsl/mirror_rake_tasks/with_cd_and_environment_variables.feature +6 -4
  20. data/features/dsl/mirror_rake_tasks/with_defined_namespace.feature +7 -3
  21. data/features/dsl/mirror_rake_tasks/with_defined_task.feature +10 -8
  22. data/features/dsl/mirror_rake_tasks/with_defined_task_and_cd.feature +10 -8
  23. data/features/dsl/mirror_rake_tasks/with_defined_task_and_cd_and_environment_variables.feature +10 -8
  24. data/features/dsl/mirror_rake_tasks/with_defined_task_and_environment_variables.feature +21 -17
  25. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename.feature +4 -2
  26. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd.feature +4 -2
  27. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd_and_environment_variables.feature +4 -2
  28. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_environment_variables.feature +4 -2
  29. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options.feature +4 -2
  30. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd.feature +4 -2
  31. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd_and_environment_variables.feature +4 -2
  32. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_environment_variables.feature +4 -2
  33. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options.feature +22 -18
  34. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_cd.feature +10 -8
  35. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_cd_and_environment_variables.feature +10 -8
  36. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_environment_variables.feature +22 -18
  37. data/features/dsl/mirror_rake_tasks/with_environment_variables.feature +14 -10
  38. data/features/dsl/mirror_rake_tasks/with_rename.feature +3 -1
  39. data/features/dsl/mirror_rake_tasks/with_rename_and_cd.feature +3 -1
  40. data/features/dsl/mirror_rake_tasks/with_rename_and_cd_and_environment_variables.feature +3 -1
  41. data/features/dsl/mirror_rake_tasks/with_rename_and_environment_variables.feature +3 -1
  42. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options.feature +3 -1
  43. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd.feature +3 -1
  44. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd_and_environment_variables.feature +3 -1
  45. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_environment_variables.feature +3 -1
  46. data/features/dsl/mirror_rake_tasks/with_undefined_task_or_namespace.feature +2 -2
  47. data/features/dsl/mirror_rake_tasks/with_valid_options.feature +12 -8
  48. data/features/dsl/mirror_rake_tasks/with_valid_options_and_cd.feature +6 -4
  49. data/features/dsl/mirror_rake_tasks/with_valid_options_and_cd_and_environment_variables.feature +6 -4
  50. data/features/dsl/mirror_rake_tasks/with_valid_options_and_environment_variables.feature +14 -10
  51. data/features/dsl/rake_executable.feature +1 -6
  52. data/features/step_definitions.rb +0 -12
  53. data/gemfiles/capistrano_v2.x.gemfile +7 -0
  54. data/gemfiles/capistrano_v2.x.gemfile.lock +66 -0
  55. data/gemfiles/rake_v0.9.3.gemfile +7 -0
  56. data/gemfiles/rake_v0.9.3.gemfile.lock +66 -0
  57. data/gemfiles/rake_v10.x.gemfile +7 -0
  58. data/gemfiles/rake_v10.x.gemfile.lock +66 -0
  59. data/lib/cape/capistrano.rb +39 -29
  60. data/lib/cape/version.rb +1 -1
  61. data/lib/cape/xterm.rb +1 -1
  62. data/spec/cape/capistrano_spec.rb +13 -3
  63. data/spec/cape/core_ext/hash_spec.rb +5 -5
  64. data/spec/cape/core_ext/symbol_spec.rb +10 -8
  65. data/spec/cape/deprecation/base_sharedspec.rb +6 -2
  66. data/spec/cape/deprecation/capistrano_deprecated_define_rake_wrapper_spec.rb +123 -101
  67. data/spec/cape/deprecation/dsl_deprecated_mirror_rake_tasks_spec.rb +119 -97
  68. data/spec/cape/dsl_deprecated_spec.rb +128 -134
  69. data/spec/cape/dsl_spec.rb +56 -63
  70. data/spec/cape/hash_list_spec.rb +40 -20
  71. data/spec/cape/rake_spec.rb +59 -51
  72. data/spec/cape/recipe_definition_spec.rb +44 -32
  73. data/spec/cape/util_spec.rb +18 -18
  74. data/spec/cape/version_spec.rb +1 -1
  75. data/spec/cape/xterm_spec.rb +33 -33
  76. data/spec/cape_spec.rb +9 -7
  77. data/spec/spec_helper.rb +5 -1
  78. metadata +100 -86
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b8c93fd87ae0e7a2c861676359add0efc890738
4
+ data.tar.gz: facf4122c6d6ef37ef33d9391c47e92f84f4747c
5
+ SHA512:
6
+ metadata.gz: 4ded790d2ab3ea29d8ceabdaa7d086302ede1d6dbd555d44d50d1b5f06eea8de544ca1da70c80d4aa5335631e4de7284238a93daf829684602e9d9649600469c
7
+ data.tar.gz: 28c4b013f8e699a67c84fd87771a6028674a98d61ce1546b1c849a5abcfa4a3cca16be77c3b70d0e60c75831a0f93df90b3e5c50947cc128238a4e60f9c1dab5
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  .bundle
2
2
  .rbx
3
- .rvmrc
3
+ .ruby-gemset
4
+ .ruby-version
4
5
  .yardoc
5
6
  Gemfile.lock
6
7
  doc
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format progress
2
+ --format documentation
@@ -1,9 +1,14 @@
1
1
  language: ruby
2
2
  bundler_args: --without debug doc tooling
3
+ gemfile:
4
+ - gemfiles/capistrano_v2.x.gemfile
5
+ - gemfiles/rake_v0.9.3.gemfile
6
+ - gemfiles/rake_v10.x.gemfile
3
7
  rvm:
4
8
  - 1.8.7
5
9
  - 1.9.2
6
10
  - 1.9.3
11
+ - 2.0.0
7
12
  - ruby-head
8
13
  - ree
9
14
  - jruby-18mode
@@ -12,10 +17,9 @@ rvm:
12
17
  - rbx-18mode
13
18
  - rbx-19mode
14
19
  - rbx-head
15
- script: "bundle exec rake"
20
+ script: "bundle exec rake test"
16
21
  matrix:
17
22
  allow_failures:
18
- - rvm: 1.9.2
19
23
  - rvm: ruby-head
20
24
  - rvm: jruby-18mode
21
25
  - rvm: jruby-19mode
@@ -0,0 +1,11 @@
1
+ appraise 'capistrano-v2.x' do
2
+ gem 'capistrano', '~> 2'
3
+ end
4
+
5
+ appraise 'rake-v0.9.3' do
6
+ gem 'rake', '0.9.3'
7
+ end
8
+
9
+ appraise 'rake-v10.x' do
10
+ gem 'rake', '~> 10'
11
+ end
data/Gemfile CHANGED
@@ -3,8 +3,8 @@ source 'http://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :debug do
6
- gem 'ruby-debug', '~> 0', :platforms => :mri_18
7
- gem 'ruby-debug19', '~> 0', :platforms => :mri_19, :require => 'ruby-debug'
6
+ gem 'ruby-debug', :platforms => [:mri_18, :jruby]
7
+ gem 'debugger', :platforms => [:mri_19, :mri_20]
8
8
  end
9
9
 
10
10
  group :doc do
@@ -14,8 +14,8 @@ end
14
14
 
15
15
  group :tooling do
16
16
  gem 'guard-cucumber', '~> 1'
17
- gem 'guard-rspec', '~> 2'
17
+ gem 'guard-rspec', '~> 4'
18
18
  if RUBY_PLATFORM =~ /darwin/i
19
- gem 'rb-fsevent', '~> 0', :require => false
19
+ gem 'rb-fsevent', '~> 0', :require => false
20
20
  end
21
21
  end
data/Guardfile CHANGED
@@ -1,9 +1,12 @@
1
1
  interactor :off
2
2
 
3
- guard :rspec, :cli => '--debug' do
3
+ guard :rspec, :all_after_pass => true,
4
+ :all_on_start => false,
5
+ :keep_failed => false,
6
+ :cmd => "bundle exec rspec --debug --format progress" do
4
7
  # Run the corresponding spec (or all specs) when code changes.
5
8
  watch(%r{^lib/(.+)\.rb$}) do |match|
6
- Dir[File.join("**/#{match[1]}_spec.rb")].first || 'spec'
9
+ Dir["spec/#{match[1]}_spec.rb"].first || 'spec'
7
10
  end
8
11
 
9
12
  # Run a spec when it changes.
@@ -17,7 +20,10 @@ guard :rspec, :cli => '--debug' do
17
20
  watch('Gemfile.lock') { 'spec' }
18
21
  end
19
22
 
20
- guard :cucumber do
23
+ guard :cucumber, :all_after_pass => true,
24
+ :all_on_start => false,
25
+ :keep_failed => false,
26
+ :focus_on => 'focus' do
21
27
  # Run run all features when code changes.
22
28
  watch(%r{^lib/(.+)\.rb$}) { 'features' }
23
29
 
@@ -25,7 +31,7 @@ guard :cucumber do
25
31
  # changes.
26
32
  watch(%r{^features/step_definitions\.rb$}) { 'features' }
27
33
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |match|
28
- Dir[File.join("**/#{match[1]}.feature")].first || 'features'
34
+ Dir["features/**/#{match[1]}.feature"].first || 'features'
29
35
  end
30
36
 
31
37
  # Run a feature when it changes.
@@ -1,5 +1,11 @@
1
1
  # Version history for the _Cape_ project
2
2
 
3
+ ## <a name="v1.8.0"></a>v1.8.0, Mon 11/18/2013
4
+
5
+ * Add official support for MRI v1.9.2 and v2.0
6
+ * Add official support for Rake v10.x
7
+ * Don’t crash if the user attempts to mirror a task whose name collides with a Ruby method
8
+
3
9
  ## <a name="v1.7.0"></a>v1.7.0, Thu 3/07/2013
4
10
 
5
11
  * Introduce a new DSL that supports task renaming and path switching, and deprecate the old one
@@ -29,21 +29,21 @@
29
29
  <hNNBNBh=(. / \ `
30
30
  ..
31
31
 
32
- # [<img align="right" src="https://badge.fury.io/rb/cape.png" title="RubyGems release" height="13" />][rubygems-release] [<img align="right" src="https://codeclimate.com/github/njonsson/cape.png" title="Code Climate report" height="13" />][code-climate-report] [<img align="right" src="https://gemnasium.com/njonsson/cape.png" title="Gemnasium build status" height="13" />][gemnasium-build-status] [<img align="right" src="https://secure.travis-ci.org/njonsson/cape.png?branch=master" title="Travis CI build status" height="13" />][travis-ci-build-status] Cape
32
+ # Cape
33
33
 
34
- [rubygems-release]: http://rubygems.org/gems/cape
35
- [code-climate-report]: http://codeclimate.com/github/njonsson/cape
36
- [gemnasium-build-status]: http://gemnasium.com/njonsson/cape
37
- [travis-ci-build-status]: http://travis-ci.org/njonsson/cape
34
+ [![Travis CI build status]](http://travis-ci.org/njonsson/cape "Travis CI build status")
35
+ [![Gemnasium build status]](http://gemnasium.com/njonsson/cape "Gemnasium build status")
36
+ [![Code Climate report] ](http://codeclimate.com/github/njonsson/cape "Code Climate report")
37
+ [![RubyGems release] ](http://rubygems.org/gems/cape "RubyGems release")
38
38
 
39
39
  If
40
40
 
41
- * **You use [Capistrano](http://capify.org)** to deploy your application, and
41
+ * **You use [Capistrano](http://capistranorb.com)** to deploy your application, and
42
42
  * **You have [Rake](http://rake.rubyforge.org) tasks that you want to execute remotely** — but you don’t want to hand-code Capistrano recipes for each Rake task —
43
43
 
44
44
  Then
45
45
 
46
- * **You can use the [Cape](http://njonsson.github.com/cape) DSL** within Capistrano recipes to dynamically add recipes for your application’s Rake tasks, and
46
+ * **You can use the [Cape](http://njonsson.github.io/cape) DSL** within Capistrano recipes to dynamically add recipes for your application’s Rake tasks, and
47
47
  * **You can execute your Rake tasks on your deployed servers,** friction-free, and look like a superhero. _[cue fanfare]_
48
48
 
49
49
  ## Features
@@ -70,6 +70,26 @@ Or you may want to make Cape a dependency of your project by using [Bundler](htt
70
70
 
71
71
  gem 'cape', '~> 1'
72
72
 
73
+ ## Compatibility
74
+
75
+ Cape [runs](http://travis-ci.org/njonsson/cape) on the following Ruby versions:
76
+
77
+ * MRI v1.8.7, v1.9.2, v1.9.3, v2.0.0
78
+ * REE v1.8.7
79
+
80
+ Cape integrates with the following RubyGems:
81
+
82
+ * Capistrano v2.x
83
+ * Rake v0.8.7 and later
84
+
85
+ **A Rake task that lacks a description can be mirrored or enumerated only if Rake v0.9.3 or newer is installed.** Older versions of Rake did not support enumerating such tasks. You may want to make Rake v0.9.3 a dependency of your project.
86
+
87
+ # Gemfile
88
+
89
+ source 'http://rubygems.org'
90
+
91
+ gem 'rake', '>= 0.9.3'
92
+
73
93
  ## Examples
74
94
 
75
95
  Assume the following Rake tasks are defined.
@@ -309,16 +329,6 @@ Note that Cape statements must be contained in a `Cape` block.
309
329
  mirror_rake_tasks
310
330
  end
311
331
 
312
- ## Known issues
313
-
314
- **A Rake task that lacks a description can be mirrored or enumerated only if Rake v0.9.3 or newer is installed.** Older versions of Rake did not support enumerating such tasks. You may want to make Rake v0.9.3 a dependency of your project.
315
-
316
- # Gemfile
317
-
318
- source 'http://rubygems.org'
319
-
320
- gem 'rake', '>= 0.9.3'
321
-
322
332
  ## Contributing
323
333
 
324
334
  Report defects and feature requests on [GitHub Issues](http://github.com/njonsson/cape/issues).
@@ -328,3 +338,8 @@ Your patches are welcome, and you will receive attribution here for good stuff.
328
338
  ## License
329
339
 
330
340
  Released under the [MIT License](http://github.com/njonsson/cape/blob/master/License.markdown).
341
+
342
+ [Travis CI build status]: https://secure.travis-ci.org/njonsson/cape.png?branch=v1.x
343
+ [Gemnasium build status]: https://gemnasium.com/njonsson/cape.png
344
+ [Code Climate report]: https://codeclimate.com/github/njonsson/cape.png
345
+ [RubyGems release]: https://badge.fury.io/rb/cape.png
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'appraisal'
1
2
  begin
2
3
  require 'bundler/gem_tasks'
3
4
  rescue LoadError
@@ -18,7 +19,16 @@ end
18
19
  def define_features_task(name, options)
19
20
  Cucumber::Rake::Task.new name, options[:desc] do |t|
20
21
  t.bundler = false
21
- t.cucumber_opts = options[:cucumber_opts] if options.key?(:cucumber_opts)
22
+
23
+ cucumber_opts = [t.cucumber_opts]
24
+ cucumber_opts << "--backtrace" if options[:backtrace]
25
+ if options.key?(:format)
26
+ cucumber_opts << "--format #{options[:format]}"
27
+ else
28
+ cucumber_opts << '--format pretty'
29
+ end
30
+ cucumber_opts << "--tags #{options[:tags]}" if options.key?(:tags)
31
+ t.cucumber_opts = cucumber_opts.join(' ')
22
32
  end
23
33
  end
24
34
 
@@ -27,15 +37,14 @@ tags = `grep -Ehr "^\\s*@\\S+\\s*$" features`.split("\n").
27
37
  uniq.
28
38
  sort
29
39
  options = {:desc => 'Test features'}
30
- options[:cucumber_opts] = '-t @focus' if tags.delete('@focus')
40
+ options[:tags] = '@focus' if tags.delete('@focus')
31
41
  define_features_task :features, options
32
42
 
33
43
  unless tags.empty?
34
44
  namespace :features do
35
45
  tags.each do |t|
36
46
  define_features_task t.gsub(/^@/, ''),
37
- :desc => "Test features tagged #{t}",
38
- :cucumber_opts => "-t #{t}"
47
+ :desc => "Test features tagged #{t}", :tags => t
39
48
  end
40
49
  end
41
50
  end
@@ -44,14 +53,25 @@ def define_spec_task(name, options={})
44
53
  desc options[:desc]
45
54
  RSpec::Core::RakeTask.new name do |t|
46
55
  t.rspec_opts ||= []
56
+ t.rspec_opts << "--backtrace" if options[:backtrace]
47
57
  unless options[:debug] == false
48
- begin
49
- require 'ruby-debug'
50
- rescue LoadError
51
- else
58
+ available = %w(debugger ruby-debug).detect do |debugger_library|
59
+ begin
60
+ require debugger_library
61
+ rescue LoadError
62
+ false
63
+ else
64
+ true
65
+ end
66
+ end
67
+ if available
52
68
  t.rspec_opts << '--debug'
69
+ else
70
+ require 'cape/xterm'
71
+ $stderr.puts Cape::XTerm.bold('*** Debugging tools not installed')
53
72
  end
54
73
  end
74
+ t.rspec_opts << "--format #{options[:format]}" if options.key?(:format)
55
75
  t.pattern = options[:pattern] || %w(spec/*_spec.rb spec/**/*_spec.rb)
56
76
  end
57
77
  end
@@ -71,11 +91,11 @@ task :default => [:spec, :features]
71
91
 
72
92
  # Support the 'gem test' command.
73
93
  namespace :test do
74
- define_spec_task :spec, :desc => '', :debug => false
94
+ define_spec_task :spec, :desc => '', :backtrace => true,
95
+ :debug => false,
96
+ :format => :progress
75
97
 
76
- Cucumber::Rake::Task.new :features, '' do |t|
77
- t.bundler = false
78
- t.cucumber_opts = '--backtrace'
79
- end
98
+ define_features_task :features, :desc => '', :backtrace => true,
99
+ :format => :progress
80
100
  end
81
101
  task :test => %w(test:spec test:features)
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.platform = Gem::Platform::RUBY
16
16
  s.authors = ['Nils Jonsson']
17
17
  s.email = %w(cape@nilsjonsson.com)
18
- s.homepage = 'http://njonsson.github.com/cape'
18
+ s.homepage = 'http://njonsson.github.io/cape'
19
19
  s.license = 'MIT'
20
20
 
21
21
  s.rubyforge_project = 'cape'
@@ -30,8 +30,12 @@ Gem::Specification.new do |s|
30
30
  s.require_paths = %w(lib)
31
31
  s.has_rdoc = true
32
32
 
33
+ s.add_development_dependency 'appraisal', '~> 0'
33
34
  s.add_development_dependency 'aruba', '~> 0'
34
35
  s.add_development_dependency 'capistrano', '~> 2'
35
- s.add_development_dependency 'rake'
36
+ s.add_development_dependency 'rake', '>= 0.9.3'
36
37
  s.add_development_dependency 'rspec', '~> 2'
38
+
39
+ # Avoid Cucumber's warnings about JSON parser performance.
40
+ s.add_development_dependency 'json_pure'
37
41
  end
@@ -45,9 +45,6 @@ Feature: The #each_rake_task DSL method
45
45
  Parameters: ["the_arg"]
46
46
  Description: "My task with one argument"
47
47
 
48
- Name: "with_period"
49
- Description: "Ends with period."
50
-
51
48
  Name: "with_three_args"
52
49
  Parameters: ["an_arg1", "an_arg2", "an_arg3"]
53
50
  Description: "My task with three arguments"
@@ -55,7 +52,4 @@ Feature: The #each_rake_task DSL method
55
52
  Name: "with_two_args"
56
53
  Parameters: ["my_arg1", "my_arg2"]
57
54
  Description: "My task with two arguments"
58
-
59
- Name: "without_period"
60
- Description: "Ends without period"
61
55
  """
@@ -35,4 +35,4 @@ Feature: The #each_rake_task DSL method with an argument of a defined namespace
35
35
  Name: "my_namespace:my_nested_namespace:in_a_nested_namespace"
36
36
  Description: "My task in a nested namespace"
37
37
  """
38
- And the output should not contain "with_period"
38
+ And the output should not contain "long"
@@ -9,7 +9,7 @@ Feature: The #each_rake_task DSL method with an argument of a defined task
9
9
  And a Capfile with:
10
10
  """
11
11
  Cape do
12
- each_rake_task 'with_period' do |t|
12
+ each_rake_task 'long' do |t|
13
13
  $stdout.puts '', "Name: #{t[:name].inspect}"
14
14
  if t[:parameters]
15
15
  $stdout.puts "Parameters: #{t[:parameters].inspect}"
@@ -24,8 +24,8 @@ Feature: The #each_rake_task DSL method with an argument of a defined task
24
24
  Then the output should contain:
25
25
  """
26
26
 
27
- Name: "with_period"
28
- Description: "Ends with period."
27
+ Name: "long"
28
+ 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"
29
29
  """
30
- And the output should not contain "without_period"
30
+ And the output should not contain "with_one_arg"
31
31
  And the output should not contain "my_namespace"
@@ -9,7 +9,7 @@ Feature: The #each_rake_task DSL method with an undefined task or namespace
9
9
  And a Capfile with:
10
10
  """
11
11
  Cape do
12
- each_rake_task 'period' do |t|
12
+ each_rake_task 'lon' do |t|
13
13
  $stdout.puts '', "Name: #{t[:name].inspect}"
14
14
  if t[:parameters]
15
15
  $stdout.puts "Parameters: #{t[:parameters].inspect}"
@@ -21,4 +21,4 @@ Feature: The #each_rake_task DSL method with an undefined task or namespace
21
21
  end
22
22
  """
23
23
  When I run `cap -vT`
24
- Then the output should not contain "period"
24
+ Then the output should not contain "lon"
@@ -17,7 +17,7 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace
17
17
  When I run `cap -vT`
18
18
  Then the output should contain:
19
19
  """
20
- cap ns:with_period # Ends with period.
20
+ cap ns:long # My long task -- it has a ve...
21
21
  """
22
22
 
23
23
  Scenario: mirror a Rake task with its implementation
@@ -32,9 +32,8 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace
32
32
  end
33
33
  end
34
34
  """
35
- When I run `cap ns:with_period`
35
+ When I run `cap ns:long`
36
36
  Then the output should contain:
37
37
  """
38
- * executing `ns:with_period'
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"
38
+ * executing `ns:long'
40
39
  """
@@ -15,13 +15,47 @@ Feature: The #mirror_rake_tasks DSL method
15
15
  When I run `cap -vT`
16
16
  Then the output should contain:
17
17
  """
18
- cap with_period # Ends with period.
18
+ cap long # My long task -- it has a ve...
19
+ """
20
+ And the output should contain:
21
+ """
22
+ cap with_one_arg # My task with one argument.
23
+ """
24
+ And the output should contain:
25
+ """
26
+ cap my_namespace # A task that shadows a names...
27
+ """
28
+ And the output should contain:
29
+ """
30
+ cap my_namespace:in_a_namespace # My task in a namespace.
31
+ """
32
+ And the output should contain:
33
+ """
34
+ cap my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
19
35
  """
20
36
  And the output should contain:
21
37
  """
22
- cap without_period # Ends without period.
38
+ cap with_two_args # My task with two arguments.
39
+ """
40
+ And the output should contain:
41
+ """
42
+ cap with_three_args # My task with three arguments.
23
43
  """
24
44
  And the output should contain:
45
+ """
46
+ cap hidden_task #
47
+ """
48
+
49
+ Scenario: mirror all Rake tasks except a Ruby-method-shadowing task
50
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
51
+ And a Capfile with:
52
+ """
53
+ Cape do
54
+ mirror_rake_tasks
55
+ end
56
+ """
57
+ When I run `cap -vT`
58
+ Then the output should contain:
25
59
  """
26
60
  cap long # My long task -- it has a ve...
27
61
  """
@@ -53,8 +87,13 @@ Feature: The #mirror_rake_tasks DSL method
53
87
  """
54
88
  cap hidden_task #
55
89
  """
90
+ And the output should not contain "cap load"
91
+ And the output should contain:
92
+ """
93
+ *** WARNING: You must use Cape's renaming API in order to mirror Rake task load (defining a task named `load' would shadow an existing method with that name)
94
+ """
56
95
 
57
- Scenario: mirror Rake task 'with_period' with its description
96
+ Scenario: mirror Rake task 'long' with its description
58
97
  Given a full-featured Rakefile
59
98
  And a Capfile with:
60
99
  """
@@ -62,18 +101,20 @@ Feature: The #mirror_rake_tasks DSL method
62
101
  mirror_rake_tasks
63
102
  end
64
103
  """
65
- When I run `cap -e with_period`
104
+ When I run `cap -e long`
66
105
  Then the output should contain exactly:
67
106
  """
68
107
  ------------------------------------------------------------
69
- cap with_period
108
+ cap long
70
109
  ------------------------------------------------------------
71
- Ends with period.
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.
72
113
 
73
114
 
74
115
  """
75
116
 
76
- Scenario: mirror Rake task 'with_period' with its implementation
117
+ Scenario: mirror Rake task 'long' with its implementation
77
118
  Given a full-featured Rakefile
78
119
  And a Capfile with:
79
120
  """
@@ -83,52 +124,60 @@ Feature: The #mirror_rake_tasks DSL method
83
124
  mirror_rake_tasks
84
125
  end
85
126
  """
86
- When I run `cap with_period`
127
+ When I run `cap long`
87
128
  Then the output should contain:
88
129
  """
89
- * executing `with_period'
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"
91
- `with_period' is only run for servers matching {}, but no servers matched
130
+ * executing `long'
131
+ """
132
+ And the output should contain:
133
+ """
134
+ `long' is only run for servers matching {}, but no servers matched
92
135
  """
93
136
 
94
- Scenario: mirror Rake task 'without_period' with its description
95
- Given a full-featured Rakefile
137
+ Scenario: mirror Rake task 'long' with its description when a Ruby-method-shadowing task is defined
138
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
96
139
  And a Capfile with:
97
140
  """
98
141
  Cape do
99
142
  mirror_rake_tasks
100
143
  end
101
144
  """
102
- When I run `cap -e without_period`
145
+ When I run `cap -e long`
103
146
  Then the output should contain exactly:
104
147
  """
105
148
  ------------------------------------------------------------
106
- cap without_period
149
+ cap long
107
150
  ------------------------------------------------------------
108
- Ends without period.
151
+ My long task -- it has a very, very, very, very, very, very, very, very, very,
152
+ very, very, very, very, very, very, very, very, very, very, very, very, very,
153
+ very, very, very, very long description.
109
154
 
155
+ *** WARNING: You must use Cape's renaming API in order to mirror Rake task load (defining a task named `load' would shadow an existing method with that name)
110
156
 
111
157
  """
112
158
 
113
- Scenario: mirror Rake task 'long' with its description
114
- Given a full-featured Rakefile
159
+ Scenario: mirror Rake task 'long' with its implementation when a Ruby-method-shadowing task is defined
160
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
115
161
  And a Capfile with:
116
162
  """
163
+ set :current_path, '/current/path'
164
+
117
165
  Cape do
118
166
  mirror_rake_tasks
119
167
  end
120
168
  """
121
- When I run `cap -e long`
122
- Then the output should contain exactly:
169
+ When I run `cap long`
170
+ Then the output should contain:
123
171
  """
124
- ------------------------------------------------------------
125
- cap long
126
- ------------------------------------------------------------
127
- My long task -- it has a very, very, very, very, very, very, very, very, very,
128
- very, very, very, very, very, very, very, very, very, very, very, very, very,
129
- very, very, very, very long description.
130
-
131
-
172
+ * executing `long'
173
+ """
174
+ And the output should contain:
175
+ """
176
+ `long' is only run for servers matching {}, but no servers matched
177
+ """
178
+ And the output should contain:
179
+ """
180
+ *** WARNING: You must use Cape's renaming API in order to mirror Rake task load (defining a task named `load' would shadow an existing method with that name)
132
181
  """
133
182
 
134
183
  Scenario: mirror Rake task 'with_one_arg' with its description
@@ -185,7 +234,9 @@ Feature: The #mirror_rake_tasks DSL method
185
234
  Then the output should contain:
186
235
  """
187
236
  * executing `my_namespace'
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"
237
+ """
238
+ And the output should contain:
239
+ """
189
240
  `my_namespace' is only run for servers matching {}, but no servers matched
190
241
  """
191
242
 
@@ -241,7 +292,9 @@ Feature: The #mirror_rake_tasks DSL method
241
292
  Then the output should contain:
242
293
  """
243
294
  * executing `my_namespace:my_nested_namespace:in_a_nested_namespace'
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"
295
+ """
296
+ And the output should contain:
297
+ """
245
298
  `my_namespace:my_nested_namespace:in_a_nested_namespace' is only run for servers matching {}, but no servers matched
246
299
  """
247
300
 
@@ -303,7 +356,9 @@ Feature: The #mirror_rake_tasks DSL method
303
356
  Then the output should contain:
304
357
  """
305
358
  * executing `with_three_args'
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\"]"
359
+ """
360
+ And the output should contain:
361
+ """
307
362
  `with_three_args' is only run for servers matching {}, but no servers matched
308
363
  """
309
364
 
@@ -321,6 +376,8 @@ Feature: The #mirror_rake_tasks DSL method
321
376
  Then the output should contain:
322
377
  """
323
378
  * executing `with_three_args'
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\",]"
379
+ """
380
+ And the output should contain:
381
+ """
325
382
  `with_three_args' is only run for servers matching {}, but no servers matched
326
383
  """