Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a new DSL and deprecate the old one
- Loading branch information
Showing
51 changed files
with
3,357 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,63 @@ | |||
Feature: The #mirror_rake_tasks DSL method with a different directory | |||
|
|||
In order to include Rake tasks with descriptions in my Capistrano recipes, | |||
As a developer using Cape, | |||
I want to use the Cape DSL. | |||
|
|||
Scenario: mirror a Rake task with its implementation, using a Capistrano variable inside a lambda | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
set :release_path, '/release/path' | |||
Cape do | |||
mirror_rake_tasks do |recipes| | |||
recipes.cd lambda { release_path } | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" | |||
|
|||
Scenario: mirror a Rake task with its implementation, using a Capistrano variable inside a block | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
set :release_path, '/release/path' | |||
Cape do | |||
mirror_rake_tasks do |recipes| | |||
recipes.cd { release_path } | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" | |||
|
|||
Scenario: mirror a Rake task with its implementation, using a string | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
Cape do | |||
mirror_rake_tasks do |recipes| | |||
recipes.cd '/release/path' | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" |
27 changes: 27 additions & 0 deletions
27
features/dsl/mirror_rake_tasks/with_cd_and_environment_variables.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
Feature: The #mirror_rake_tasks DSL method with a different directory and environment variables | |||
|
|||
In order to include Rake tasks with descriptions in my Capistrano recipes, | |||
As a developer using Cape, | |||
I want to use the Cape DSL. | |||
|
|||
Scenario: mirror a Rake task with its implementation | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
set :release_path, '/release/path' | |||
set :rails_env, 'rails-env' | |||
Cape do | |||
mirror_rake_tasks do |recipes| | |||
recipes.cd { release_path } | |||
recipes.env['RAILS_ENV'] = lambda { rails_env } | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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\"" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" |
43 changes: 43 additions & 0 deletions
43
features/dsl/mirror_rake_tasks/with_defined_task_and_cd.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
Feature: The #mirror_rake_tasks DSL method with a defined task and a different directory | |||
|
|||
In order to include Rake tasks with descriptions in my Capistrano recipes, | |||
As a developer using Cape, | |||
I want to use the Cape DSL. | |||
|
|||
Scenario: mirror only the matching Rake task | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
Cape do | |||
mirror_rake_tasks :with_period do |recipes| | |||
recipes.cd { release_path } | |||
end | |||
end | |||
""" | |||
When I run `cap -vT` | |||
Then the output should contain: | |||
""" | |||
cap with_period # Ends with period. | |||
""" | |||
And the output should not contain "without_period" | |||
And the output should not contain "my_namespace" | |||
|
|||
Scenario: mirror the matching Rake task with its implementation | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
set :release_path, '/release/path' | |||
Cape do | |||
mirror_rake_tasks :with_period do |recipes| | |||
recipes.cd { release_path } | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" |
46 changes: 46 additions & 0 deletions
46
features/dsl/mirror_rake_tasks/with_defined_task_and_cd_and_environment_variables.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,46 @@ | |||
Feature: The #mirror_rake_tasks DSL method with a defined task, a different directory, and environment variables | |||
|
|||
In order to include Rake tasks with descriptions in my Capistrano recipes, | |||
As a developer using Cape, | |||
I want to use the Cape DSL. | |||
|
|||
Scenario: mirror only the matching Rake task | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
Cape do | |||
mirror_rake_tasks :with_period do |recipes| | |||
recipes.cd { release_path } | |||
recipes.env['RAILS_ENV'] = lambda { rails_env } | |||
end | |||
end | |||
""" | |||
When I run `cap -vT` | |||
Then the output should contain: | |||
""" | |||
cap with_period # Ends with period. | |||
""" | |||
And the output should not contain "without_period" | |||
And the output should not contain "my_namespace" | |||
|
|||
Scenario: mirror the matching Rake task with its implementation | |||
Given a full-featured Rakefile | |||
And a Capfile with: | |||
""" | |||
set :release_path, '/release/path' | |||
set :rails_env, 'rails-env' | |||
Cape do | |||
mirror_rake_tasks :with_period do |recipes| | |||
recipes.cd { release_path } | |||
recipes.env['RAILS_ENV'] = lambda { rails_env } | |||
end | |||
end | |||
""" | |||
When I run `cap with_period` | |||
Then the output should contain: | |||
""" | |||
* executing `with_period' | |||
* 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\"" | |||
`with_period' is only run for servers matching {}, but no servers matched | |||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
features/dsl/mirror_rake_tasks/with_defined_task_and_rename.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
Feature: The #mirror_rake_tasks DSL method with a defined task and renaming logic | |||
|
|||
In order to include Rake tasks with descriptions in my Capistrano recipes, | |||
As a developer using Cape, | |||
I want to use the Cape DSL. | |||
|
|||
Scenario: mirror only the matching Rake task | |||
Given a full-featured Rakefile defining a Ruby-method-shadowing task | |||
And a Capfile with: | |||
""" | |||
Cape do | |||
mirror_rake_tasks :load do |recipes| | |||
recipes.rename do |task_name| | |||
"do_#{task_name}" | |||
end | |||
end | |||
end | |||
""" | |||
When I run `cap -vT` | |||
Then the output should contain: | |||
""" | |||
cap do_load # A task that shadows a Ruby method. | |||
""" | |||
And the output should not contain "period" | |||
And the output should not contain "my_namespace" | |||
|
|||
Scenario: mirror the matching Rake task with its implementation | |||
Given a full-featured Rakefile defining a Ruby-method-shadowing task | |||
And a Capfile with: | |||
""" | |||
set :current_path, '/current/path' | |||
Cape do | |||
mirror_rake_tasks :load do |recipes| | |||
recipes.rename do |task_name| | |||
"do_#{task_name}" | |||
end | |||
end | |||
end | |||
""" | |||
When I run `cap do_load` | |||
Then the output should contain: | |||
""" | |||
* executing `do_load' | |||
* 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" | |||
`do_load' is only run for servers matching {}, but no servers matched | |||
""" |
Oops, something went wrong.