cape 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/Gemfile +7 -6
  2. data/Guardfile +29 -10
  3. data/History.markdown +4 -0
  4. data/README.markdown +38 -9
  5. data/Rakefile +35 -8
  6. data/features/dsl/each_rake_task/{without_arguments.feature → unqualified.feature} +16 -37
  7. data/features/dsl/each_rake_task/{with_defined_namespace_argument.feature → with_defined_namespace.feature} +2 -13
  8. data/features/dsl/each_rake_task/{with_defined_task_argument.feature → with_defined_task.feature} +2 -6
  9. data/features/dsl/each_rake_task/with_undefined_task_or_namespace.feature +24 -0
  10. data/features/dsl/mirror_rake_tasks/inside_capistrano_namespace.feature +2 -2
  11. data/features/dsl/mirror_rake_tasks/{without_arguments.feature → unqualified.feature} +15 -11
  12. data/features/dsl/mirror_rake_tasks/with_cd.feature +63 -0
  13. data/features/dsl/mirror_rake_tasks/with_cd_and_environment_variables.feature +27 -0
  14. data/features/dsl/mirror_rake_tasks/{with_defined_namespace_argument.feature → with_defined_namespace.feature} +6 -8
  15. data/features/dsl/mirror_rake_tasks/{with_defined_task_argument.feature → with_defined_task.feature} +4 -4
  16. data/features/dsl/mirror_rake_tasks/{with_defined_task_argument_and_environment_variables.feature → with_defined_task_and_cd.feature} +8 -8
  17. data/features/dsl/mirror_rake_tasks/with_defined_task_and_cd_and_environment_variables.feature +46 -0
  18. data/features/dsl/mirror_rake_tasks/with_defined_task_and_environment_variables.feature +92 -0
  19. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename.feature +47 -0
  20. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd.feature +49 -0
  21. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_cd_and_environment_variables.feature +52 -0
  22. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_environment_variables.feature +50 -0
  23. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options.feature +49 -0
  24. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd.feature +51 -0
  25. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_cd_and_environment_variables.feature +54 -0
  26. data/features/dsl/mirror_rake_tasks/with_defined_task_and_rename_and_valid_options_and_environment_variables.feature +52 -0
  27. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options.feature +53 -6
  28. 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
  29. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_cd_and_environment_variables.feature +48 -0
  30. data/features/dsl/mirror_rake_tasks/with_defined_task_and_valid_options_and_environment_variables.feature +98 -0
  31. data/features/dsl/mirror_rake_tasks/with_environment_variables.feature +61 -4
  32. data/features/dsl/mirror_rake_tasks/with_rename.feature +27 -0
  33. data/features/dsl/mirror_rake_tasks/with_rename_and_cd.feature +28 -0
  34. data/features/dsl/mirror_rake_tasks/with_rename_and_cd_and_environment_variables.feature +30 -0
  35. data/features/dsl/mirror_rake_tasks/with_rename_and_environment_variables.feature +29 -0
  36. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options.feature +28 -0
  37. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd.feature +29 -0
  38. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_cd_and_environment_variables.feature +31 -0
  39. data/features/dsl/mirror_rake_tasks/with_rename_and_valid_options_and_environment_variables.feature +30 -0
  40. data/features/dsl/mirror_rake_tasks/{with_undefined_argument.feature → with_undefined_task_or_namespace.feature} +3 -4
  41. data/features/dsl/mirror_rake_tasks/with_valid_options.feature +46 -0
  42. data/features/dsl/mirror_rake_tasks/{with_valid_options_argument.feature → with_valid_options_and_cd.feature} +7 -5
  43. data/features/dsl/mirror_rake_tasks/with_valid_options_and_cd_and_environment_variables.feature +28 -0
  44. data/features/dsl/mirror_rake_tasks/with_valid_options_and_environment_variables.feature +51 -0
  45. data/features/dsl/rake_executable.feature +2 -2
  46. data/features/step_definitions.rb +40 -0
  47. data/lib/cape.rb +2 -0
  48. data/lib/cape/capistrano.rb +59 -32
  49. data/lib/cape/capistrano_deprecated.rb +165 -0
  50. data/lib/cape/core_ext.rb +2 -0
  51. data/lib/cape/deprecation.rb +12 -0
  52. data/lib/cape/deprecation/base.rb +59 -0
  53. data/lib/cape/deprecation/capistrano_deprecated_define_rake_wrapper.rb +168 -0
  54. data/lib/cape/deprecation/dsl_deprecated_mirror_rake_tasks.rb +145 -0
  55. data/lib/cape/dsl.rb +49 -60
  56. data/lib/cape/dsl_deprecated.rb +157 -0
  57. data/lib/cape/hash_list.rb +2 -0
  58. data/lib/cape/recipe_definition.rb +103 -0
  59. data/lib/cape/recipe_definition_deprecated.rb +41 -0
  60. data/lib/cape/util.rb +2 -0
  61. data/lib/cape/version.rb +1 -1
  62. data/lib/cape/xterm.rb +326 -0
  63. data/spec/cape/deprecation/base_sharedspec.rb +18 -0
  64. data/spec/cape/deprecation/capistrano_deprecated_define_rake_wrapper_spec.rb +157 -0
  65. data/spec/cape/deprecation/dsl_deprecated_mirror_rake_tasks_spec.rb +153 -0
  66. data/spec/cape/dsl_deprecated_spec.rb +307 -0
  67. data/spec/cape/dsl_spec.rb +10 -43
  68. data/spec/cape/recipe_definition_spec.rb +53 -0
  69. data/spec/cape/xterm_spec.rb +72 -0
  70. metadata +97 -28
  71. data/features/dsl/each_rake_task/with_undefined_argument.feature +0 -53
  72. data/features/dsl/mirror_rake_tasks/with_valid_options_arguments_and_environment_variables.feature +0 -26
@@ -0,0 +1,63 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a different directory
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 a Rake task with its implementation, using a Capistrano variable inside a lambda
8
+ Given a full-featured Rakefile
9
+ And a Capfile with:
10
+ """
11
+ set :release_path, '/release/path'
12
+
13
+ Cape do
14
+ mirror_rake_tasks do |recipes|
15
+ recipes.cd lambda { release_path }
16
+ end
17
+ end
18
+ """
19
+ When I run `cap with_period`
20
+ Then the output should contain:
21
+ """
22
+ * executing `with_period'
23
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
24
+ `with_period' is only run for servers matching {}, but no servers matched
25
+ """
26
+
27
+ Scenario: mirror a Rake task with its implementation, using a Capistrano variable inside a block
28
+ Given a full-featured Rakefile
29
+ And a Capfile with:
30
+ """
31
+ set :release_path, '/release/path'
32
+
33
+ Cape do
34
+ mirror_rake_tasks do |recipes|
35
+ recipes.cd { release_path }
36
+ end
37
+ end
38
+ """
39
+ When I run `cap with_period`
40
+ Then the output should contain:
41
+ """
42
+ * executing `with_period'
43
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
44
+ `with_period' is only run for servers matching {}, but no servers matched
45
+ """
46
+
47
+ Scenario: mirror a Rake task with its implementation, using a string
48
+ Given a full-featured Rakefile
49
+ And a Capfile with:
50
+ """
51
+ Cape do
52
+ mirror_rake_tasks do |recipes|
53
+ recipes.cd '/release/path'
54
+ end
55
+ end
56
+ """
57
+ When I run `cap with_period`
58
+ Then the output should contain:
59
+ """
60
+ * executing `with_period'
61
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
62
+ `with_period' is only run for servers matching {}, but no servers matched
63
+ """
@@ -0,0 +1,27 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a different directory and environment variables
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 a Rake task with its implementation
8
+ Given a full-featured Rakefile
9
+ And a Capfile with:
10
+ """
11
+ set :release_path, '/release/path'
12
+ set :rails_env, 'rails-env'
13
+
14
+ Cape do
15
+ mirror_rake_tasks do |recipes|
16
+ recipes.cd { release_path }
17
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
18
+ end
19
+ end
20
+ """
21
+ When I run `cap with_period`
22
+ Then the output should contain:
23
+ """
24
+ * executing `with_period'
25
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period RAILS_ENV=\"rails-env\""
26
+ `with_period' is only run for servers matching {}, but no servers matched
27
+ """
@@ -1,4 +1,4 @@
1
- Feature: The #mirror_rake_tasks DSL method with an argument of a defined namespace
1
+ Feature: The #mirror_rake_tasks DSL method with a defined namespace
2
2
 
3
3
  In order to include Rake tasks with descriptions in my Capistrano recipes,
4
4
  As a developer using Cape,
@@ -25,14 +25,13 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined namespa
25
25
  """
26
26
  cap my_namespace:my_nested_namespace:in_a_nested_namespace # My task in a nested namespace.
27
27
  """
28
- And the output should not contain "cap with_period"
28
+ And the output should not contain "period"
29
29
 
30
30
  Scenario: mirror a Rake task that shadows the matching namespace with its implementation
31
31
  Given a full-featured Rakefile
32
32
  And a Capfile with:
33
33
  """
34
- set :current_path, '/path/to/current/deployed/application'
35
- set :rails_env, 'production'
34
+ set :current_path, '/current/path'
36
35
 
37
36
  Cape do
38
37
  mirror_rake_tasks 'my_namespace'
@@ -42,7 +41,7 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined namespa
42
41
  Then the output should contain:
43
42
  """
44
43
  * executing `my_namespace'
45
- * executing "cd /path/to/current/deployed/application && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake my_namespace"
44
+ * 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"
46
45
  `my_namespace' is only run for servers matching {}, but no servers matched
47
46
  """
48
47
 
@@ -50,8 +49,7 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined namespa
50
49
  Given a full-featured Rakefile
51
50
  And a Capfile with:
52
51
  """
53
- set :current_path, '/path/to/current/deployed/application'
54
- set :rails_env, 'production'
52
+ set :current_path, '/current/path'
55
53
 
56
54
  Cape do
57
55
  mirror_rake_tasks :my_namespace
@@ -61,6 +59,6 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined namespa
61
59
  Then the output should contain:
62
60
  """
63
61
  * executing `my_namespace:my_nested_namespace:in_a_nested_namespace'
64
- * executing "cd /path/to/current/deployed/application && /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"
62
+ * 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"
65
63
  `my_namespace:my_nested_namespace:in_a_nested_namespace' is only run for servers matching {}, but no servers matched
66
64
  """
@@ -1,4 +1,4 @@
1
- Feature: The #mirror_rake_tasks DSL method with an argument of a defined task
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task
2
2
 
3
3
  In order to include Rake tasks with descriptions in my Capistrano recipes,
4
4
  As a developer using Cape,
@@ -18,13 +18,13 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined task
18
18
  cap with_period # Ends with period.
19
19
  """
20
20
  And the output should not contain "without_period"
21
+ And the output should not contain "my_namespace"
21
22
 
22
23
  Scenario: mirror the matching Rake task with its implementation
23
24
  Given a full-featured Rakefile
24
25
  And a Capfile with:
25
26
  """
26
- set :current_path, '/path/to/current/deployed/application'
27
- set :rails_env, 'production'
27
+ set :current_path, '/current/path'
28
28
 
29
29
  Cape do
30
30
  mirror_rake_tasks 'with_period'
@@ -34,6 +34,6 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined task
34
34
  Then the output should contain:
35
35
  """
36
36
  * executing `with_period'
37
- * executing "cd /path/to/current/deployed/application && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
37
+ * 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
38
  `with_period' is only run for servers matching {}, but no servers matched
39
39
  """
@@ -1,4 +1,4 @@
1
- Feature: The #mirror_rake_tasks DSL method with an argument of a defined task, and with environment variables
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task and a different directory
2
2
 
3
3
  In order to include Rake tasks with descriptions in my Capistrano recipes,
4
4
  As a developer using Cape,
@@ -9,8 +9,8 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined task, a
9
9
  And a Capfile with:
10
10
  """
11
11
  Cape do
12
- mirror_rake_tasks :with_period do |env|
13
- env['RAILS_ENV'] = rails_env
12
+ mirror_rake_tasks :with_period do |recipes|
13
+ recipes.cd { release_path }
14
14
  end
15
15
  end
16
16
  """
@@ -20,17 +20,17 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined task, a
20
20
  cap with_period # Ends with period.
21
21
  """
22
22
  And the output should not contain "without_period"
23
+ And the output should not contain "my_namespace"
23
24
 
24
25
  Scenario: mirror the matching Rake task with its implementation
25
26
  Given a full-featured Rakefile
26
27
  And a Capfile with:
27
28
  """
28
- set :current_path, '/path/to/current/deployed/application'
29
- set :rails_env, 'production'
29
+ set :release_path, '/release/path'
30
30
 
31
31
  Cape do
32
- mirror_rake_tasks 'with_period' do |env|
33
- env['RAILS_ENV'] = rails_env
32
+ mirror_rake_tasks :with_period do |recipes|
33
+ recipes.cd { release_path }
34
34
  end
35
35
  end
36
36
  """
@@ -38,6 +38,6 @@ Feature: The #mirror_rake_tasks DSL method with an argument of a defined task, a
38
38
  Then the output should contain:
39
39
  """
40
40
  * executing `with_period'
41
- * executing "cd /path/to/current/deployed/application && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period RAILS_ENV=\"production\""
41
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period"
42
42
  `with_period' is only run for servers matching {}, but no servers matched
43
43
  """
@@ -0,0 +1,46 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task, a different directory, and environment variables
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 Capfile with:
10
+ """
11
+ Cape do
12
+ mirror_rake_tasks :with_period do |recipes|
13
+ recipes.cd { release_path }
14
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
15
+ end
16
+ end
17
+ """
18
+ When I run `cap -vT`
19
+ Then the output should contain:
20
+ """
21
+ cap with_period # Ends with period.
22
+ """
23
+ And the output should not contain "without_period"
24
+ And the output should not contain "my_namespace"
25
+
26
+ Scenario: mirror the matching Rake task with its implementation
27
+ Given a full-featured Rakefile
28
+ And a Capfile with:
29
+ """
30
+ set :release_path, '/release/path'
31
+ set :rails_env, 'rails-env'
32
+
33
+ Cape do
34
+ mirror_rake_tasks :with_period do |recipes|
35
+ recipes.cd { release_path }
36
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
37
+ end
38
+ end
39
+ """
40
+ When I run `cap with_period`
41
+ Then the output should contain:
42
+ """
43
+ * executing `with_period'
44
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake with_period RAILS_ENV=\"rails-env\""
45
+ `with_period' is only run for servers matching {}, but no servers matched
46
+ """
@@ -0,0 +1,92 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task and environment variables
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
+ @deprecated
8
+ Scenario: mirror only the matching Rake task (deprecated)
9
+ Given a full-featured Rakefile
10
+ And a Capfile with:
11
+ """
12
+ Cape do
13
+ mirror_rake_tasks :with_period do |env|
14
+ env['RAILS_ENV'] = rails_env
15
+ end
16
+ end
17
+ """
18
+ When I run `cap -vT`
19
+ Then the output should contain:
20
+ """
21
+ cap with_period # Ends with period.
22
+ """
23
+ And the output should not contain "without_period"
24
+ And the output should not contain "my_namespace"
25
+ And the output should contain:
26
+ """
27
+ *** DEPRECATED: Referencing Capistrano variables from Cape without wrapping them in a block, a lambda, or another callable object
28
+ """
29
+
30
+ Scenario: mirror only the matching Rake task
31
+ Given a full-featured Rakefile
32
+ And a Capfile with:
33
+ """
34
+ Cape do
35
+ mirror_rake_tasks :with_period do |recipes|
36
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
37
+ end
38
+ end
39
+ """
40
+ When I run `cap -vT`
41
+ Then the output should contain:
42
+ """
43
+ cap with_period # Ends with period.
44
+ """
45
+ And the output should not contain "without_period"
46
+ And the output should not contain "my_namespace"
47
+ And the output should not contain "DEPRECATED"
48
+
49
+ @deprecated
50
+ Scenario: mirror the matching Rake task with its implementation (deprecated)
51
+ Given a full-featured Rakefile
52
+ And a Capfile with:
53
+ """
54
+ set :current_path, '/current/path'
55
+ set :rails_env, 'rails-env'
56
+
57
+ Cape do
58
+ mirror_rake_tasks 'with_period' do |env|
59
+ env['RAILS_ENV'] = rails_env
60
+ end
61
+ end
62
+ """
63
+ When I run `cap with_period`
64
+ Then the output should contain:
65
+ """
66
+ *** DEPRECATED: `mirror_rake_tasks("with_period") { |env| env["RAILS_ENV"] = "rails-env" }`. Use this instead: `mirror_rake_tasks("with_period") { |recipes| recipes.env["RAILS_ENV"] = "rails-env" }`
67
+ * executing `with_period'
68
+ * 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 RAILS_ENV=\"rails-env\""
69
+ `with_period' is only run for servers matching {}, but no servers matched
70
+ """
71
+
72
+ Scenario: mirror the matching Rake task with its implementation
73
+ Given a full-featured Rakefile
74
+ And a Capfile with:
75
+ """
76
+ set :current_path, '/current/path'
77
+ set :rails_env, 'rails-env'
78
+
79
+ Cape do
80
+ mirror_rake_tasks 'with_period' do |recipes|
81
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
82
+ end
83
+ end
84
+ """
85
+ When I run `cap with_period`
86
+ Then the output should contain:
87
+ """
88
+ * executing `with_period'
89
+ * 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 RAILS_ENV=\"rails-env\""
90
+ `with_period' is only run for servers matching {}, but no servers matched
91
+ """
92
+ And the output should not contain "DEPRECATED"
@@ -0,0 +1,47 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task and renaming logic
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 defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ Cape do
12
+ mirror_rake_tasks :load do |recipes|
13
+ recipes.rename do |task_name|
14
+ "do_#{task_name}"
15
+ end
16
+ end
17
+ end
18
+ """
19
+ When I run `cap -vT`
20
+ Then the output should contain:
21
+ """
22
+ cap do_load # A task that shadows a Ruby method.
23
+ """
24
+ And the output should not contain "period"
25
+ And the output should not contain "my_namespace"
26
+
27
+ Scenario: mirror the matching Rake task with its implementation
28
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
29
+ And a Capfile with:
30
+ """
31
+ set :current_path, '/current/path'
32
+
33
+ Cape do
34
+ mirror_rake_tasks :load do |recipes|
35
+ recipes.rename do |task_name|
36
+ "do_#{task_name}"
37
+ end
38
+ end
39
+ end
40
+ """
41
+ When I run `cap do_load`
42
+ Then the output should contain:
43
+ """
44
+ * executing `do_load'
45
+ * 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 load"
46
+ `do_load' is only run for servers matching {}, but no servers matched
47
+ """
@@ -0,0 +1,49 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task, renaming logic, and a different directory
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 defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ Cape do
12
+ mirror_rake_tasks :load do |recipes|
13
+ recipes.rename do |task_name|
14
+ "do_#{task_name}"
15
+ end
16
+ recipes.cd { release_path }
17
+ end
18
+ end
19
+ """
20
+ When I run `cap -vT`
21
+ Then the output should contain:
22
+ """
23
+ cap do_load # A task that shadows a Ruby method.
24
+ """
25
+ And the output should not contain "period"
26
+ And the output should not contain "my_namespace"
27
+
28
+ Scenario: mirror the matching Rake task with its implementation
29
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
30
+ And a Capfile with:
31
+ """
32
+ set :release_path, '/release/path'
33
+
34
+ Cape do
35
+ mirror_rake_tasks :load do |recipes|
36
+ recipes.rename do |task_name|
37
+ "do_#{task_name}"
38
+ end
39
+ recipes.cd { release_path }
40
+ end
41
+ end
42
+ """
43
+ When I run `cap do_load`
44
+ Then the output should contain:
45
+ """
46
+ * executing `do_load'
47
+ * executing "cd /release/path && /usr/bin/env `/usr/bin/env bundle check >/dev/null 2>&1; case $? in 0|1 ) echo bundle exec ;; esac` rake load"
48
+ `do_load' is only run for servers matching {}, but no servers matched
49
+ """