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.
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,48 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task, valid options, 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.options[:roles] = :app
14
+ recipes.cd { release_path }
15
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
16
+ end
17
+ end
18
+ """
19
+ When I run `cap -vT`
20
+ Then the output should contain:
21
+ """
22
+ cap with_period # Ends with period.
23
+ """
24
+ And the output should not contain "without_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
29
+ And a Capfile with:
30
+ """
31
+ set :release_path, '/release/path'
32
+ set :rails_env, 'rails-env'
33
+
34
+ Cape do
35
+ mirror_rake_tasks :with_period do |recipes|
36
+ recipes.options[:roles] = :app
37
+ recipes.cd { release_path }
38
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
39
+ end
40
+ end
41
+ """
42
+ When I run `cap with_period`
43
+ Then the output should contain:
44
+ """
45
+ * executing `with_period'
46
+ * 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\""
47
+ `with_period' is only run for servers matching {:roles=>:app}, but no servers matched
48
+ """
@@ -0,0 +1,98 @@
1
+ Feature: The #mirror_rake_tasks DSL method with a defined task, valid options, 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, :roles => :app 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: `mirror_rake_tasks :with_period, :roles => :app`. Use this instead: `mirror_rake_tasks(:with_period) { |recipes| recipes.options[:roles] = :app }`
28
+ """
29
+ And the output should contain:
30
+ """
31
+ *** DEPRECATED: Referencing Capistrano variables from Cape without wrapping them in a block, a lambda, or another callable object
32
+ """
33
+
34
+ Scenario: mirror only the matching Rake task
35
+ Given a full-featured Rakefile
36
+ And a Capfile with:
37
+ """
38
+ Cape do
39
+ mirror_rake_tasks :with_period do |recipes|
40
+ recipes.options[:roles] = :app
41
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
42
+ end
43
+ end
44
+ """
45
+ When I run `cap -vT`
46
+ Then the output should contain:
47
+ """
48
+ cap with_period # Ends with period.
49
+ """
50
+ And the output should not contain "without_period"
51
+ And the output should not contain "my_namespace"
52
+ And the output should not contain "DEPRECATED"
53
+
54
+ @deprecated
55
+ Scenario: mirror the matching Rake task with its implementation (deprecated)
56
+ Given a full-featured Rakefile
57
+ And a Capfile with:
58
+ """
59
+ set :current_path, '/current/path'
60
+ set :rails_env, 'rails-env'
61
+
62
+ Cape do
63
+ mirror_rake_tasks 'with_period', :roles => :app do |env|
64
+ env['RAILS_ENV'] = rails_env
65
+ end
66
+ end
67
+ """
68
+ When I run `cap with_period`
69
+ Then the output should contain:
70
+ """
71
+ *** DEPRECATED: `mirror_rake_tasks("with_period", :roles => :app) { |env| env["RAILS_ENV"] = "rails-env" }`. Use this instead: `mirror_rake_tasks("with_period") { |recipes| recipes.options[:roles] = :app; recipes.env["RAILS_ENV"] = "rails-env" }`
72
+ * executing `with_period'
73
+ * 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\""
74
+ `with_period' is only run for servers matching {:roles=>:app}, but no servers matched
75
+ """
76
+
77
+ Scenario: mirror the matching Rake task with its implementation
78
+ Given a full-featured Rakefile
79
+ And a Capfile with:
80
+ """
81
+ set :current_path, '/current/path'
82
+ set :rails_env, 'rails-env'
83
+
84
+ Cape do
85
+ mirror_rake_tasks 'with_period' do |recipes|
86
+ recipes.options[:roles] = :app
87
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
88
+ end
89
+ end
90
+ """
91
+ When I run `cap with_period`
92
+ Then the output should contain:
93
+ """
94
+ * executing `with_period'
95
+ * 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\""
96
+ `with_period' is only run for servers matching {:roles=>:app}, but no servers matched
97
+ """
98
+ And the output should not contain "DEPRECATED"
@@ -4,12 +4,43 @@ Feature: The #mirror_rake_tasks DSL method with environment variables
4
4
  As a developer using Cape,
5
5
  I want to use the Cape DSL.
6
6
 
7
- Scenario: mirror a Rake task with its implementation
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 do |env|
14
+ env['RAILS_ENV'] = rails_env
15
+ end
16
+ end
17
+ """
18
+ When I run `cap -vT`
19
+ And the output should contain:
20
+ """
21
+ *** DEPRECATED: Referencing Capistrano variables from Cape without wrapping them in a block, a lambda, or another callable object
22
+ """
23
+
24
+ Scenario: mirror only the matching Rake task
25
+ Given a full-featured Rakefile
26
+ And a Capfile with:
27
+ """
28
+ Cape do
29
+ mirror_rake_tasks do |recipes|
30
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
31
+ end
32
+ end
33
+ """
34
+ When I run `cap -vT`
35
+ And the output should not contain "DEPRECATED"
36
+
37
+ @deprecated
38
+ Scenario: mirror a Rake task with its implementation (deprecated)
8
39
  Given a full-featured Rakefile
9
40
  And a Capfile with:
10
41
  """
11
- set :current_path, '/path/to/current/deployed/application'
12
- set :rails_env, 'production'
42
+ set :current_path, '/current/path'
43
+ set :rails_env, 'rails-env'
13
44
 
14
45
  Cape do
15
46
  mirror_rake_tasks do |env|
@@ -21,9 +52,35 @@ Feature: The #mirror_rake_tasks DSL method with environment variables
21
52
  end
22
53
  """
23
54
  When I run `cap with_period`
55
+ Then the output should contain:
56
+ """
57
+ *** DEPRECATED: `mirror_rake_tasks { |env| env["RAILS_ENV"] = "rails-env"; env[nil] = "foo"; env["FOO"] = nil; env["SOME_OTHER"] = "var" }`. Use this instead: `mirror_rake_tasks { |recipes| recipes.env["RAILS_ENV"] = "rails-env"; recipes.env[nil] = "foo"; recipes.env["FOO"] = nil; recipes.env["SOME_OTHER"] = "var" }`
58
+ * executing `with_period'
59
+ * 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\" SOME_OTHER=\"var\""
60
+ `with_period' is only run for servers matching {}, but no servers matched
61
+ """
62
+
63
+ Scenario: mirror a Rake task with its implementation
64
+ Given a full-featured Rakefile
65
+ And a Capfile with:
66
+ """
67
+ set :current_path, '/current/path'
68
+ set :rails_env, 'rails-env'
69
+
70
+ Cape do
71
+ mirror_rake_tasks do |recipes|
72
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
73
+ recipes.env[nil] = 'foo'
74
+ recipes.env['FOO'] = nil
75
+ recipes.env['SOME_OTHER'] = 'var'
76
+ end
77
+ end
78
+ """
79
+ When I run `cap with_period`
24
80
  Then the output should contain:
25
81
  """
26
82
  * executing `with_period'
27
- * 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\" SOME_OTHER=\"var\""
83
+ * 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\" SOME_OTHER=\"var\""
28
84
  `with_period' is only run for servers matching {}, but no servers matched
29
85
  """
86
+ And the output should not contain "DEPRECATED"
@@ -0,0 +1,27 @@
1
+ Feature: The #mirror_rake_tasks DSL method with 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 a Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :current_path, '/current/path'
12
+
13
+ Cape do
14
+ mirror_rake_tasks do |recipes|
15
+ recipes.rename do |task_name|
16
+ "do_#{task_name}"
17
+ end
18
+ end
19
+ end
20
+ """
21
+ When I run `cap do_load`
22
+ Then the output should contain:
23
+ """
24
+ * executing `do_load'
25
+ * 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"
26
+ `do_load' is only run for servers matching {}, but no servers matched
27
+ """
@@ -0,0 +1,28 @@
1
+ Feature: The #mirror_rake_tasks DSL method with 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 a Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :release_path, '/release/path'
12
+
13
+ Cape do
14
+ mirror_rake_tasks do |recipes|
15
+ recipes.rename do |task_name|
16
+ "do_#{task_name}"
17
+ end
18
+ recipes.cd { release_path }
19
+ end
20
+ end
21
+ """
22
+ When I run `cap do_load`
23
+ Then the output should contain:
24
+ """
25
+ * executing `do_load'
26
+ * 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"
27
+ `do_load' is only run for servers matching {}, but no servers matched
28
+ """
@@ -0,0 +1,30 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic, 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 Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
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.rename do |task_name|
17
+ "do_#{task_name}"
18
+ end
19
+ recipes.cd { release_path }
20
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
21
+ end
22
+ end
23
+ """
24
+ When I run `cap do_load`
25
+ Then the output should contain:
26
+ """
27
+ * executing `do_load'
28
+ * 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 RAILS_ENV=\"rails-env\""
29
+ `do_load' is only run for servers matching {}, but no servers matched
30
+ """
@@ -0,0 +1,29 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic 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 Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :current_path, '/current/path'
12
+ set :rails_env, 'rails-env'
13
+
14
+ Cape do
15
+ mirror_rake_tasks do |recipes|
16
+ recipes.rename do |task_name|
17
+ "do_#{task_name}"
18
+ end
19
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
20
+ end
21
+ end
22
+ """
23
+ When I run `cap do_load`
24
+ Then the output should contain:
25
+ """
26
+ * executing `do_load'
27
+ * 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 RAILS_ENV=\"rails-env\""
28
+ `do_load' is only run for servers matching {}, but no servers matched
29
+ """
@@ -0,0 +1,28 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic and valid options
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 Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :current_path, '/current/path'
12
+
13
+ Cape do
14
+ mirror_rake_tasks do |recipes|
15
+ recipes.rename do |task_name|
16
+ "do_#{task_name}"
17
+ end
18
+ recipes.options[:roles] = :app
19
+ end
20
+ end
21
+ """
22
+ When I run `cap do_load`
23
+ Then the output should contain:
24
+ """
25
+ * executing `do_load'
26
+ * 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"
27
+ `do_load' is only run for servers matching {:roles=>:app}, but no servers matched
28
+ """
@@ -0,0 +1,29 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic, valid options, 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 a Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :release_path, '/release/path'
12
+
13
+ Cape do
14
+ mirror_rake_tasks do |recipes|
15
+ recipes.rename do |task_name|
16
+ "do_#{task_name}"
17
+ end
18
+ recipes.options[:roles] = :app
19
+ recipes.cd { release_path }
20
+ end
21
+ end
22
+ """
23
+ When I run `cap do_load`
24
+ Then the output should contain:
25
+ """
26
+ * executing `do_load'
27
+ * 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"
28
+ `do_load' is only run for servers matching {:roles=>:app}, but no servers matched
29
+ """
@@ -0,0 +1,31 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic, valid options, a different directory, and enviroment 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 Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
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.rename do |task_name|
17
+ "do_#{task_name}"
18
+ end
19
+ recipes.options[:roles] = :app
20
+ recipes.cd { release_path }
21
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
22
+ end
23
+ end
24
+ """
25
+ When I run `cap do_load`
26
+ Then the output should contain:
27
+ """
28
+ * executing `do_load'
29
+ * 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 RAILS_ENV=\"rails-env\""
30
+ `do_load' is only run for servers matching {:roles=>:app}, but no servers matched
31
+ """
@@ -0,0 +1,30 @@
1
+ Feature: The #mirror_rake_tasks DSL method with renaming logic, valid options, and enviroment 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 Ruby-method-shadowing Rake task with its implementation
8
+ Given a full-featured Rakefile defining a Ruby-method-shadowing task
9
+ And a Capfile with:
10
+ """
11
+ set :current_path, '/current/path'
12
+ set :rails_env, 'rails-env'
13
+
14
+ Cape do
15
+ mirror_rake_tasks do |recipes|
16
+ recipes.rename do |task_name|
17
+ "do_#{task_name}"
18
+ end
19
+ recipes.options[:roles] = :app
20
+ recipes.env['RAILS_ENV'] = lambda { rails_env }
21
+ end
22
+ end
23
+ """
24
+ When I run `cap do_load`
25
+ Then the output should contain:
26
+ """
27
+ * executing `do_load'
28
+ * 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 RAILS_ENV=\"rails-env\""
29
+ `do_load' is only run for servers matching {:roles=>:app}, but no servers matched
30
+ """