capistrano 3.4.0 → 3.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +129 -0
- data/.github/issue_template.md +19 -0
- data/.github/pull_request_template.md +22 -0
- data/.github/release-drafter.yml +17 -0
- data/.github/workflows/push.yml +12 -0
- data/.gitignore +8 -5
- data/.rubocop.yml +62 -0
- data/CHANGELOG.md +1 -307
- data/CONTRIBUTING.md +63 -93
- data/DEVELOPMENT.md +127 -0
- data/Dangerfile +1 -0
- data/Gemfile +40 -3
- data/LICENSE.txt +1 -1
- data/README.md +127 -44
- data/RELEASING.md +17 -0
- data/Rakefile +13 -2
- data/UPGRADING-3.7.md +86 -0
- data/bin/cap +1 -1
- data/capistrano.gemspec +21 -24
- data/features/deploy.feature +35 -1
- data/features/doctor.feature +11 -0
- data/features/installation.feature +8 -3
- data/features/stage_failure.feature +9 -0
- data/features/step_definitions/assertions.rb +51 -18
- data/features/step_definitions/cap_commands.rb +9 -0
- data/features/step_definitions/setup.rb +53 -9
- data/features/subdirectory.feature +9 -0
- data/features/support/env.rb +5 -5
- data/features/support/remote_command_helpers.rb +12 -6
- data/features/support/vagrant_helpers.rb +17 -11
- data/lib/Capfile +1 -1
- data/lib/capistrano/all.rb +10 -10
- data/lib/capistrano/application.rb +47 -34
- data/lib/capistrano/configuration/empty_filter.rb +9 -0
- data/lib/capistrano/configuration/filter.rb +17 -47
- data/lib/capistrano/configuration/host_filter.rb +29 -0
- data/lib/capistrano/configuration/null_filter.rb +9 -0
- data/lib/capistrano/configuration/plugin_installer.rb +51 -0
- data/lib/capistrano/configuration/question.rb +31 -9
- data/lib/capistrano/configuration/role_filter.rb +29 -0
- data/lib/capistrano/configuration/scm_resolver.rb +149 -0
- data/lib/capistrano/configuration/server.rb +29 -23
- data/lib/capistrano/configuration/servers.rb +21 -14
- data/lib/capistrano/configuration/validated_variables.rb +110 -0
- data/lib/capistrano/configuration/variables.rb +112 -0
- data/lib/capistrano/configuration.rb +91 -44
- data/lib/capistrano/defaults.rb +26 -4
- data/lib/capistrano/deploy.rb +1 -1
- data/lib/capistrano/doctor/environment_doctor.rb +19 -0
- data/lib/capistrano/doctor/gems_doctor.rb +45 -0
- data/lib/capistrano/doctor/output_helpers.rb +79 -0
- data/lib/capistrano/doctor/servers_doctor.rb +105 -0
- data/lib/capistrano/doctor/variables_doctor.rb +74 -0
- data/lib/capistrano/doctor.rb +6 -0
- data/lib/capistrano/dotfile.rb +1 -2
- data/lib/capistrano/dsl/env.rb +9 -47
- data/lib/capistrano/dsl/paths.rb +11 -25
- data/lib/capistrano/dsl/stages.rb +14 -2
- data/lib/capistrano/dsl/task_enhancements.rb +7 -12
- data/lib/capistrano/dsl.rb +47 -16
- data/lib/capistrano/framework.rb +1 -1
- data/lib/capistrano/i18n.rb +32 -24
- data/lib/capistrano/immutable_task.rb +30 -0
- data/lib/capistrano/install.rb +1 -1
- data/lib/capistrano/plugin.rb +95 -0
- data/lib/capistrano/proc_helpers.rb +13 -0
- data/lib/capistrano/scm/git.rb +100 -0
- data/lib/capistrano/scm/hg.rb +55 -0
- data/lib/capistrano/scm/plugin.rb +13 -0
- data/lib/capistrano/scm/svn.rb +56 -0
- data/lib/capistrano/scm/tasks/git.rake +73 -0
- data/lib/capistrano/scm/tasks/hg.rake +53 -0
- data/lib/capistrano/scm/tasks/svn.rake +53 -0
- data/lib/capistrano/scm.rb +7 -20
- data/lib/capistrano/setup.rb +20 -6
- data/lib/capistrano/tasks/console.rake +4 -8
- data/lib/capistrano/tasks/deploy.rake +105 -73
- data/lib/capistrano/tasks/doctor.rake +24 -0
- data/lib/capistrano/tasks/framework.rake +13 -14
- data/lib/capistrano/tasks/install.rake +14 -15
- data/lib/capistrano/templates/Capfile +21 -10
- data/lib/capistrano/templates/deploy.rb.erb +17 -26
- data/lib/capistrano/templates/stage.rb.erb +9 -9
- data/lib/capistrano/upload_task.rb +1 -1
- data/lib/capistrano/version.rb +1 -1
- data/lib/capistrano/version_validator.rb +5 -10
- data/spec/integration/dsl_spec.rb +289 -240
- data/spec/integration_spec_helper.rb +3 -5
- data/spec/lib/capistrano/application_spec.rb +23 -39
- data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/filter_spec.rb +83 -85
- data/spec/lib/capistrano/configuration/host_filter_spec.rb +71 -0
- data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
- data/spec/lib/capistrano/configuration/question_spec.rb +58 -26
- data/spec/lib/capistrano/configuration/role_filter_spec.rb +80 -0
- data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +55 -0
- data/spec/lib/capistrano/configuration/server_spec.rb +106 -113
- data/spec/lib/capistrano/configuration/servers_spec.rb +129 -145
- data/spec/lib/capistrano/configuration_spec.rb +224 -63
- data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
- data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +67 -0
- data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
- data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
- data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +89 -0
- data/spec/lib/capistrano/dsl/paths_spec.rb +97 -59
- data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +57 -37
- data/spec/lib/capistrano/dsl_spec.rb +84 -11
- data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
- data/spec/lib/capistrano/plugin_spec.rb +84 -0
- data/spec/lib/capistrano/scm/git_spec.rb +184 -0
- data/spec/lib/capistrano/scm/hg_spec.rb +109 -0
- data/spec/lib/capistrano/scm/svn_spec.rb +137 -0
- data/spec/lib/capistrano/scm_spec.rb +7 -8
- data/spec/lib/capistrano/upload_task_spec.rb +7 -7
- data/spec/lib/capistrano/version_validator_spec.rb +61 -46
- data/spec/lib/capistrano_spec.rb +2 -3
- data/spec/spec_helper.rb +21 -8
- data/spec/support/Vagrantfile +9 -10
- data/spec/support/tasks/database.rake +3 -3
- data/spec/support/tasks/fail.rake +4 -3
- data/spec/support/tasks/failed.rake +2 -2
- data/spec/support/tasks/plugin.rake +6 -0
- data/spec/support/tasks/root.rake +4 -4
- data/spec/support/test_app.rb +64 -39
- metadata +100 -55
- data/.travis.yml +0 -13
- data/features/remote_file_task.feature +0 -14
- data/lib/capistrano/git.rb +0 -46
- data/lib/capistrano/hg.rb +0 -43
- data/lib/capistrano/svn.rb +0 -38
- data/lib/capistrano/tasks/git.rake +0 -81
- data/lib/capistrano/tasks/hg.rake +0 -52
- data/lib/capistrano/tasks/svn.rake +0 -52
- data/spec/lib/capistrano/git_spec.rb +0 -81
- data/spec/lib/capistrano/hg_spec.rb +0 -81
- data/spec/lib/capistrano/svn_spec.rb +0 -79
data/CONTRIBUTING.md
CHANGED
@@ -1,93 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
any other tags which might relate
|
11
|
-
|
12
|
-
If you have an urgent problem you can
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
suite running, and do what you can to get a test case written that fails
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
##
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
## Submitting A Pull Request:
|
65
|
-
|
66
|
-
Pull requests are awesome, and if they arrive with decent tests, and conform to
|
67
|
-
the guidelines below, we'll merge them in as soon as possible, we'll let you
|
68
|
-
know which release we're planning them for (we adhere to
|
69
|
-
[semver](http://semver.org/) so please don't be upset if we plan your changes
|
70
|
-
for a later release)
|
71
|
-
|
72
|
-
* The code is MIT licenced, your code will fall under the same license if we merge it.
|
73
|
-
* We can't merge it without a [good commit
|
74
|
-
message](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message).
|
75
|
-
If you do this right, Github will use the commit message as the body of your
|
76
|
-
pull request, double win.
|
77
|
-
* If you are referencing an improvement to an existing issue (if we have not
|
78
|
-
yet merged it )
|
79
|
-
* Add an entry to the `CHANGELOG` under the `### master` section, but please
|
80
|
-
don't mess with the version.
|
81
|
-
* If you add a new feature, please make sure to document it, open a
|
82
|
-
corresponding pull request in [the
|
83
|
-
documentation](https://github.com/capistrano/documentation) and mention the
|
84
|
-
code change pull request over there, and Github will link everything up. If
|
85
|
-
it's a simple feature, or a new variable, or something changed, it may be
|
86
|
-
appropriate simply to document it in the generated `Capfile` or `deploy.rb`, or
|
87
|
-
in the `README`
|
88
|
-
* Take care to squash your commit into one single commit with a good message, it
|
89
|
-
saves us a lot of work in maintaining the CHANGELOG if we can generate it from
|
90
|
-
the commit messages between the release tags!
|
91
|
-
* Tests! It's tricky to test some parts of Capistrano, but do your best, it
|
92
|
-
might just serve as a starting point for us to build a reliable test on top of,
|
93
|
-
and help us understand where you are coming from.
|
1
|
+
**Hello and welcome!** Please look over this document before opening an issue or submitting a pull request to Capistrano.
|
2
|
+
|
3
|
+
* [If you’re looking for help or have a question](#if-youre-looking-for-help-or-have-a-question)
|
4
|
+
* [Reporting bugs](#reporting-bugs)
|
5
|
+
* [Requesting new features or improvements](#requesting-new-features-or-improvements)
|
6
|
+
* [Contributing code or documentation](#contributing-code-or-documentation)
|
7
|
+
|
8
|
+
## If you’re looking for help or have a question
|
9
|
+
|
10
|
+
**Check [Stack Overflow](http://stackoverflow.com/questions/tagged/capistrano) first if you need help using Capistrano.** You are more likely to get a quick response at Stack Overflow for common Capistrano topics. Make sure to tag your post with `capistrano` and/or `capistrano3` (not forgetting any other tags which might relate: rvm, rbenv, Ubuntu, etc.)
|
11
|
+
|
12
|
+
If you have an urgent problem you can also try [CodersClan](http://codersclan.net/?repo_id=325&source=contributing), which has a community of Capistrano experts dedicated to solve code problems for bounties.
|
13
|
+
|
14
|
+
When posting to Stack Overflow or CodersClan, be sure to include relevant information:
|
15
|
+
|
16
|
+
* Capistrano version
|
17
|
+
* Plugins and versions (capistrano-rvm, capistrano-bundler, etc.)
|
18
|
+
* Logs and backtraces
|
19
|
+
|
20
|
+
If you think you’ve found a bug in Capistrano itself, then…
|
21
|
+
|
22
|
+
## Reporting bugs
|
23
|
+
|
24
|
+
As much the Capistrano community tries to write good, well-tested code, bugs still happen. Sorry about that!
|
25
|
+
|
26
|
+
**In case you’ve run across an already-known issue, check the FAQs first on the [official Capistrano site](http://capistranorb.com).**
|
27
|
+
|
28
|
+
When opening a bug report, please include the output of the `cap <stage> doctor` task, e.g.:
|
29
|
+
|
30
|
+
```
|
31
|
+
cap production doctor
|
32
|
+
```
|
33
|
+
|
34
|
+
Also include in your report:
|
35
|
+
|
36
|
+
* Versions of Ruby, Capistrano, and any plugins you’re using (if `doctor` didn't already do this for you)
|
37
|
+
* A description of the troubleshooting steps you’ve taken
|
38
|
+
* Logs and backtraces
|
39
|
+
* Sections of your `deploy.rb` that may be relevant
|
40
|
+
* Any other unique aspects of your environment
|
41
|
+
|
42
|
+
If you are an experienced Ruby programmer, take a few minutes to get the Capistrano test suite running (see [DEVELOPMENT.md][]), and do what you can to get a test case written that fails. *This will be a huge help!*
|
43
|
+
|
44
|
+
If you think you may have discovered a security vulnerability in Capistrano, do not open a GitHub issue. Instead, please send a report to <security@capistranorb.com>.
|
45
|
+
|
46
|
+
## Requesting new features or improvements
|
47
|
+
|
48
|
+
Capistrano continues to improve thanks to people like you! Feel free to open a GitHub issue for any or all of these ideas:
|
49
|
+
|
50
|
+
* New features that would make Capistrano even better
|
51
|
+
* Areas where documentation could be improved
|
52
|
+
* Ways to improve developer happiness
|
53
|
+
|
54
|
+
Generally speaking the maintainers are very conservative about adding new features, and we can’t guarantee that the community will agree with or implement your idea. Please don’t be offended if we say no! The Capistrano team will do our best to review all suggestions and at least weigh in with a comment or suggest a workaround, if applicable.
|
55
|
+
|
56
|
+
**Your idea will have a much better chance of becoming reality if you contribute code for it (even if the code is incomplete!).**
|
57
|
+
|
58
|
+
## Contributing code or documentation
|
59
|
+
|
60
|
+
So you want to contribute to Capistrano? Awesome! We have a whole separate document just you. It explains our pull request workflow and walks you through setting up the development environment: [DEVELOPMENT.md][].
|
61
|
+
|
62
|
+
|
63
|
+
[DEVELOPMENT.md]: https://github.com/capistrano/capistrano/blob/master/DEVELOPMENT.md
|
data/DEVELOPMENT.md
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
Thanks for helping build Capistrano! Here are the development practices followed by our community.
|
2
|
+
|
3
|
+
* [Who can help](#who-can-help)
|
4
|
+
* [Contributing documentation](#contributing-documentation)
|
5
|
+
* [Setting up your development environment](#setting-up-your-development-environment)
|
6
|
+
* [Coding guidelines](#coding-guidelines)
|
7
|
+
* [Submitting a pull request](#submitting-a-pull-request)
|
8
|
+
* [Managing GitHub issues](#managing-github-issues)
|
9
|
+
* [Reviewing and merging pull requests](#reviewing-and-merging-pull-requests)
|
10
|
+
|
11
|
+
## Who can help
|
12
|
+
|
13
|
+
Everyone can help improve Capistrano. There are ways to contribute even if you aren’t a Ruby programmer. Here’s what you can do to help the project:
|
14
|
+
|
15
|
+
* adding to or fixing typos/quality in documentation
|
16
|
+
* adding failing tests for reported bugs
|
17
|
+
* writing code (no contribution is too small!)
|
18
|
+
* reviewing pull requests and suggesting improvements
|
19
|
+
* reporting bugs or suggesting new features (see [CONTRIBUTING.md][])
|
20
|
+
|
21
|
+
## Contributing documentation
|
22
|
+
|
23
|
+
Improvements and additions to Capistrano's documentation are very much appreciated. The official documention is stored in the `docs/` directory as Markdown files. These files are used to automatically generate the [capistranorb.com](http://capistranorb.com/) website, which is hosted by GitHub Pages. Feel free to make changes to this documentation as you see fit. Before opening a pull request, make sure your documentation renders correctly by previewing the website in your local environment. Refer to [docs/README.md][] for instructions.
|
24
|
+
|
25
|
+
## Setting up your development environment
|
26
|
+
|
27
|
+
Capistrano is a Ruby project, so we expect you to have a functioning Ruby environment. To hack on Capistrano you will further need some specialized tools to run its test suite.
|
28
|
+
|
29
|
+
Make sure to install:
|
30
|
+
|
31
|
+
* [Bundler](https://bundler.io/)
|
32
|
+
* [Vagrant](https://www.vagrantup.com/)
|
33
|
+
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (or another [Vagrant-supported](https://docs.vagrantup.com/v2/getting-started/providers.html) VM host)
|
34
|
+
|
35
|
+
|
36
|
+
### Running tests
|
37
|
+
|
38
|
+
Capistrano has two test suites: an RSpec suite and a Cucumber suite. The RSpec suite handles quick feedback unit specs. The Cucumber suite is an integration suite that uses Vagrant to deploy to a real virtual server.
|
39
|
+
|
40
|
+
```
|
41
|
+
# Ensure all dependencies are installed
|
42
|
+
$ bundle install
|
43
|
+
|
44
|
+
# Run the RSpec suite
|
45
|
+
$ bundle exec rake spec
|
46
|
+
|
47
|
+
# Run the Cucumber suite
|
48
|
+
$ bundle exec rake features
|
49
|
+
|
50
|
+
# Run the Cucumber suite and leave the VM running (faster for subsequent runs)
|
51
|
+
$ bundle exec rake features KEEP_RUNNING=1
|
52
|
+
```
|
53
|
+
|
54
|
+
### Report failing Cucumber features!
|
55
|
+
|
56
|
+
Currently, the Capistrano CI build does *not* run the Cucumber suite. This means it is possible for a failing Cucumber feature to sneak in without being noticed by our continuous integration checks.
|
57
|
+
|
58
|
+
**If you come across a failing Cucumber feature, this is a bug.** Please report it by opening a GitHub issue. Or even better: do your best to fix the feature and submit a pull request!
|
59
|
+
|
60
|
+
## Coding guidelines
|
61
|
+
|
62
|
+
This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding guidelines.
|
63
|
+
|
64
|
+
* Test that your contributions pass with `rake rubocop`
|
65
|
+
* Rubocop is also run as part of the full test suite with `rake`
|
66
|
+
* Note the CI build will fail and your PR cannot be merged if Rubocop finds errors
|
67
|
+
|
68
|
+
## Submitting a pull request
|
69
|
+
|
70
|
+
Pull requests are awesome, and if they arrive with decent tests, and conform to the guidelines below, we'll merge them in as soon as possible, we'll let you know which release we're planning them for (we adhere to [semver](http://semver.org/) so please don't be upset if we plan your changes for a later release).
|
71
|
+
|
72
|
+
Your code should conform to these guidelines:
|
73
|
+
|
74
|
+
* The code is MIT licensed, your code will fall under the same license if we merge it.
|
75
|
+
* We can't merge it without a [good commit message](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message). If you do this right, Github will use the commit message as the body of your pull request, double win.
|
76
|
+
* If you are making an improvement/fix for an existing issue, make sure to mention the issue number (if we have not yet merged it )
|
77
|
+
* Add an entry to the `CHANGELOG` under the `### master` section, but please don't mess with the version.
|
78
|
+
* If you add a new feature, please make sure to document it by modifying the appropriate Markdown files in `docs/` (see [contributing documentation](#contributing-documentation), above). If it's a simple feature, or a new variable, or something changed, it may be appropriate simply to document it in the generated `Capfile` or `deploy.rb`, or in the `README`.
|
79
|
+
* Take care to squash your commit into one single commit with a good message, it saves us a lot of work in maintaining the CHANGELOG if we can generate it from the commit messages between the release tags!
|
80
|
+
* Tests! It's tricky to test some parts of Capistrano, but do your best, it might just serve as a starting point for us to build a reliable test on top of, and help us understand where you are coming from.
|
81
|
+
|
82
|
+
## Managing GitHub issues
|
83
|
+
|
84
|
+
The Capistrano maintainers will do our best to review all GitHub issues. Here’s how we manage issues:
|
85
|
+
|
86
|
+
1. Issues will be acknowledged with an appropriate label (see below).
|
87
|
+
2. Issues that are duplicates, spam, or irrelevant (e.g. wrong project), or are questions better suited for Stack Overflow (see [CONTRIBUTING.md][]) will be closed.
|
88
|
+
3. Once an issue is fixed or resolved in an upcoming Capistrano release, it will be closed and assigned to a GitHub milestone for that upcoming version number.
|
89
|
+
|
90
|
+
The maintainers do not have time to fix every issue ourselves, but we will gladly accept pull requests, especially for issues labeled as "you can help" (see below).
|
91
|
+
|
92
|
+
### Issue labels
|
93
|
+
|
94
|
+
Capistrano uses these GitHub labels to categorize issues:
|
95
|
+
|
96
|
+
* **bug?** – Could be a bug (not reproducible or might be user error)
|
97
|
+
* **confirmed bug** – Definitely a bug
|
98
|
+
* **new feature** – A request for Capistrano to add a feature or work differently
|
99
|
+
* **chore** – A TODO that is neither a bug nor a feature (e.g. improve docs, CI infrastructure, etc.)
|
100
|
+
|
101
|
+
Also, the Capistrano team will sometimes add these labels to facilitate communication and encourage community feedback:
|
102
|
+
|
103
|
+
* **discuss!** – The Capistrano team wants more feedback from the community on this issue; e.g. how a new feature should work, or whether a bug is serious or not.
|
104
|
+
* **you can help!** – We want the community to help by submitting a pull request to solve a bug or add a feature. If you are looking for ways to contribute to Capistrano, start here!
|
105
|
+
* **needs more info** – We need more info from the person who opened the issue; e.g. steps to reproduce a bug, clarification on a desired feature, etc.
|
106
|
+
|
107
|
+
*These labels were inspired by Daniel Doubrovkine’s [2014 Golden Gate Ruby Conference talk](http://confreaks.tv/videos/gogaruco2014-taking-over-someone-else-s-open-source-projects).*
|
108
|
+
|
109
|
+
## Reviewing and merging pull requests
|
110
|
+
|
111
|
+
Pull requests and issues follow similar workflows. Before merging a pull request, the Capistrano maintainers will check that these requirements are met:
|
112
|
+
|
113
|
+
* All CI checks pass
|
114
|
+
* Significant changes in behavior or fixes mentioned in the CHANGELOG
|
115
|
+
* Clean commit history
|
116
|
+
* New features are documented
|
117
|
+
* Code changes/additions are tested
|
118
|
+
|
119
|
+
If any of these are missing, the **needs more info** label is assigned to the pull request to indicate the PR is incomplete.
|
120
|
+
|
121
|
+
Merging a pull request is a decision entrusted to the maintainers of the Capistrano project. Any maintainer is free to merge a pull request if they feel the PR meets the above requirements and is in the best interest of the Capistrano community.
|
122
|
+
|
123
|
+
After a pull request is merged, it is assigned to a GitHub milestone for the upcoming version number.
|
124
|
+
|
125
|
+
|
126
|
+
[CONTRIBUTING.md]: https://github.com/capistrano/capistrano/blob/master/CONTRIBUTING.md
|
127
|
+
[docs/README.md]: https://github.com/capistrano/capistrano/blob/master/docs/README.md
|
data/Dangerfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
danger.import_dangerfile(github: "capistrano/danger", branch: "no-changelog")
|
data/Gemfile
CHANGED
@@ -1,9 +1,46 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in capistrano.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
gem "mocha"
|
7
|
+
gem "rspec"
|
8
|
+
gem "rspec-core", "~> 3.4.4"
|
9
|
+
|
6
10
|
group :cucumber do
|
7
|
-
|
8
|
-
|
11
|
+
# Latest versions of cucumber don't support Ruby < 2.1
|
12
|
+
# rubocop:disable Bundler/DuplicatedGem
|
13
|
+
if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
14
|
+
gem "cucumber", "< 3.0.1"
|
15
|
+
else
|
16
|
+
gem "cucumber"
|
17
|
+
end
|
18
|
+
# rubocop:enable Bundler/DuplicatedGem
|
19
|
+
end
|
20
|
+
|
21
|
+
# Latest versions of net-ssh don't support Ruby < 2.2.6
|
22
|
+
if Gem::Requirement.new("< 2.2.6").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
23
|
+
gem "net-ssh", "< 5.0.0"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Latest versions of public_suffix don't support Ruby < 2.1
|
27
|
+
if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
28
|
+
gem "public_suffix", "< 3.0.0"
|
29
|
+
end
|
30
|
+
|
31
|
+
# Latest versions of i18n don't support Ruby < 2.4
|
32
|
+
if Gem::Requirement.new("< 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
33
|
+
gem "i18n", "< 1.3.0"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Latest versions of rake don't support Ruby < 2.2
|
37
|
+
if Gem::Requirement.new("< 2.2").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
38
|
+
gem "rake", "< 13.0.0"
|
39
|
+
end
|
40
|
+
|
41
|
+
# We only run danger and rubocop on a new-ish ruby; no need to install them otherwise
|
42
|
+
if Gem::Requirement.new("> 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
43
|
+
gem "danger"
|
44
|
+
gem "psych", "< 4" # Ensures rubocop works on Ruby 3.1
|
45
|
+
gem "rubocop", "0.48.1"
|
9
46
|
end
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2012-
|
3
|
+
Copyright (c) 2012-2020 Tom Clements, Lee Hambley
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,48 +1,131 @@
|
|
1
|
-
# Capistrano [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![Code Climate](http://img.shields.io/codeclimate/github/capistrano/capistrano.svg)](https://codeclimate.com/github/capistrano/capistrano) <a href="http://codersclan.net/?repo_id=325&source=small"><img src="http://img.shields.io/badge/get-support-blue.svg"></a>
|
2
1
|
|
3
|
-
|
2
|
+
# Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.
|
4
3
|
|
5
|
-
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://circleci.com/gh/capistrano/capistrano/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/capistrano/capistrano?branch=master) [![Code Climate](https://codeclimate.com/github/capistrano/capistrano/badges/gpa.svg)](https://codeclimate.com/github/capistrano/capistrano) [![CodersClan](https://img.shields.io/badge/get-support-blue.svg)](http://codersclan.net/?repo_id=325&source=small)
|
6
5
|
|
7
|
-
|
6
|
+
Capistrano is a framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP.
|
8
7
|
|
9
|
-
|
8
|
+
Once installed, Capistrano gives you a `cap` tool to perform your deployments from the comfort of your command line.
|
10
9
|
|
11
|
-
|
10
|
+
```
|
11
|
+
$ cd my-capistrano-enabled-project
|
12
|
+
$ cap production deploy
|
13
|
+
```
|
14
|
+
|
15
|
+
When you run `cap`, Capistrano dutifully connects to your server(s) via SSH and executes the steps necessary to deploy your project. You can define those steps yourself by writing [Rake](https://github.com/ruby/rake) tasks, or by using pre-built task libraries provided by the Capistrano community.
|
16
|
+
|
17
|
+
Tasks are simple to make. Here's an example:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
task :restart_sidekiq do
|
21
|
+
on roles(:worker) do
|
22
|
+
execute :service, "sidekiq restart"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
after "deploy:published", "restart_sidekiq"
|
26
|
+
```
|
27
|
+
|
28
|
+
*Note: This documentation is for the current version of Capistrano (3.x). If you are looking for Capistrano 2.x documentation, you can find it in [this archive](https://github.com/capistrano/capistrano-2.x-docs).*
|
29
|
+
|
30
|
+
---
|
31
|
+
|
32
|
+
## Contents
|
33
|
+
|
34
|
+
* [Features](#features)
|
35
|
+
* [Gotchas](#gotchas)
|
36
|
+
* [Quick start](#quick-start)
|
37
|
+
* [Finding help and documentation](#finding-help-and-documentation)
|
38
|
+
* [How to contribute](#how-to-contribute)
|
39
|
+
* [License](#license)
|
40
|
+
|
41
|
+
## Features
|
42
|
+
|
43
|
+
There are many ways to automate deployments, from simple rsync bash scripts to complex containerized toolchains. Capistrano sits somewhere in the middle: it automates what you already know how to do manually with SSH, but in a repeatable, scalable fashion. There is no magic here!
|
44
|
+
|
45
|
+
Here's what makes Capistrano great:
|
46
|
+
|
47
|
+
#### Strong conventions
|
48
|
+
|
49
|
+
Capistrano defines a standard deployment process that all Capistrano-enabled projects follow by default. You don't have to decide how to structure your scripts, where deployed files should be placed on the server, or how to perform common tasks: Capistrano has done this work for you.
|
50
|
+
|
51
|
+
#### Multiple stages
|
52
|
+
|
53
|
+
Define your deployment once, and then easily parameterize it for multiple *stages* (environments), e.g. `qa`, `staging`, and `production`. No copy-and-paste necessary: you only need to specify what is different for each stage, like IP addresses.
|
54
|
+
|
55
|
+
#### Parallel execution
|
56
|
+
|
57
|
+
Deploying to a fleet of app servers? Capistrano can run each deployment task concurrently across those servers and uses connection pooling for speed.
|
58
|
+
|
59
|
+
#### Server roles
|
60
|
+
|
61
|
+
Your application may need many different types of servers: a database server, an app server, two web servers, and a job queue work server, for example. Capistrano lets you tag each server with one or more roles, so you can control what tasks are executed where.
|
62
|
+
|
63
|
+
#### Community driven
|
12
64
|
|
13
|
-
|
65
|
+
Capistrano is easily extensible using the rubygems package manager. Deploying a Rails app? Wordpress? Laravel? Chances are, someone has already written Capistrano tasks for your framework of choice and has distributed it as a gem. Many Ruby projects also come with Capistrano tasks built-in.
|
14
66
|
|
15
|
-
|
67
|
+
#### It's just SSH
|
16
68
|
|
17
|
-
Capistrano
|
69
|
+
Everything in Capistrano comes down to running SSH commands on remote servers. On the one hand, that makes Capistrano simple. On the other hand, if you aren't comfortable SSH-ing into a Linux box and doing stuff on the command-line, then Capistrano is probably not for you.
|
18
70
|
|
19
|
-
|
20
|
-
* Mercurial
|
21
|
-
* SVN
|
71
|
+
## Gotchas
|
22
72
|
|
23
|
-
|
73
|
+
While Capistrano ships with a strong set of conventions that are common for all types of deployments, it needs help understanding the specifics of your project, and there are some things Capistrano is not suited to do.
|
24
74
|
|
25
|
-
|
75
|
+
#### Project specifics
|
26
76
|
|
27
|
-
|
77
|
+
Out of the box, Capistrano can deploy your code to server(s), but it does not know how to *execute* your code. Does `foreman` need to be run? Does Apache need to be restarted? You'll need to tell Capistrano how to do this part by writing these deployment steps yourself, or by finding a gem in the Capistrano community that does it for you.
|
78
|
+
|
79
|
+
#### Key-based SSH
|
80
|
+
|
81
|
+
Capistrano depends on connecting to your server(s) with SSH using key-based (i.e. password-less) authentication. You'll need this working before you can use Capistrano.
|
82
|
+
|
83
|
+
#### Provisioning
|
84
|
+
|
85
|
+
Likewise, your server(s) will likely need supporting software installed before you can perform a deployment. Capistrano itself has no requirements other than SSH, but your application probably needs database software, a web server like Apache or Nginx, and a language runtime like Java, Ruby, or PHP. These *server provisioning* steps are not done by Capistrano.
|
86
|
+
|
87
|
+
#### `sudo`, etc.
|
88
|
+
|
89
|
+
Capistrano is designed to deploy using a single, non-privileged SSH user, using a *non-interactive* SSH session. If your deployment requires `sudo`, interactive prompts, authenticating as one user but running commands as another, you can probably accomplish this with Capistrano, but it may be difficult. Your automated deployments will be much smoother if you can avoid such requirements.
|
90
|
+
|
91
|
+
#### Shells
|
92
|
+
|
93
|
+
Capistrano 3 expects a POSIX shell like Bash or Sh. Shells like tcsh, csh, and such may work, but probably will not.
|
94
|
+
|
95
|
+
## Quick start
|
96
|
+
|
97
|
+
### Requirements
|
98
|
+
|
99
|
+
* Ruby version 2.0 or higher on your local machine (MRI or Rubinius)
|
100
|
+
* A project that uses source control (Git, Mercurial, and Subversion support is built-in)
|
101
|
+
* The SCM binaries (e.g. `git`, `hg`) needed to check out your project must be installed on the server(s) you are deploying to
|
102
|
+
* [Bundler](http://bundler.io), along with a Gemfile for your project, are recommended
|
103
|
+
|
104
|
+
### Install the Capistrano gem
|
105
|
+
|
106
|
+
Add Capistrano to your project's Gemfile using `require: false`:
|
28
107
|
|
29
108
|
``` ruby
|
30
|
-
|
109
|
+
group :development do
|
110
|
+
gem "capistrano", "~> 3.17", require: false
|
111
|
+
end
|
31
112
|
```
|
32
113
|
|
33
|
-
|
114
|
+
Then run Bundler to ensure Capistrano is downloaded and installed:
|
34
115
|
|
35
116
|
``` sh
|
36
117
|
$ bundle install
|
37
118
|
```
|
38
119
|
|
39
|
-
Capify
|
40
|
-
|
120
|
+
### "Capify" your project
|
121
|
+
|
122
|
+
Make sure your project doesn't already have a "Capfile" or "capfile" present. Then run:
|
123
|
+
|
41
124
|
``` sh
|
42
125
|
$ bundle exec cap install
|
43
126
|
```
|
44
127
|
|
45
|
-
This creates the
|
128
|
+
This creates all the necessary configuration files and directory structure for a Capistrano-enabled project with two stages, `staging` and `production`:
|
46
129
|
|
47
130
|
```
|
48
131
|
├── Capfile
|
@@ -56,13 +139,15 @@ This creates the following files:
|
|
56
139
|
└── tasks
|
57
140
|
```
|
58
141
|
|
59
|
-
To
|
142
|
+
To customize the stages that are created, use:
|
60
143
|
|
61
144
|
``` sh
|
62
145
|
$ bundle exec cap install STAGES=local,sandbox,qa,production
|
63
146
|
```
|
64
147
|
|
65
|
-
|
148
|
+
Note that the files that Capistrano creates are simply templates to get you started. Make sure to edit the `deploy.rb` and stage files so that they contain values appropriate for your project and your target servers.
|
149
|
+
|
150
|
+
### Command-line usage
|
66
151
|
|
67
152
|
``` sh
|
68
153
|
# list all available tasks
|
@@ -83,41 +168,39 @@ $ bundle exec cap production deploy --prereqs
|
|
83
168
|
|
84
169
|
# trace through task invocations
|
85
170
|
$ bundle exec cap production deploy --trace
|
171
|
+
|
172
|
+
# lists all config variable before deployment tasks
|
173
|
+
$ bundle exec cap production deploy --print-config-variables
|
86
174
|
```
|
87
175
|
|
88
|
-
##
|
176
|
+
## Finding help and documentation
|
89
177
|
|
90
|
-
Capistrano
|
91
|
-
RSpec suite handles quick feedback unit specs. The Cucumber features are
|
92
|
-
an integration suite that uses Vagrant to deploy to a real virtual
|
93
|
-
server. In order to run the Cucumber suite you will need to install
|
94
|
-
[Vagrant](http://www.vagrantup.com/) and Vagrant supported
|
95
|
-
virtualization software like
|
96
|
-
[VirtualBox](https://www.virtualbox.org/wiki/Downloads).
|
178
|
+
Capistrano is a large project encompassing multiple GitHub repositories and a community of plugins, and it can be overwhelming when you are just getting started. Here are resources that can help:
|
97
179
|
|
98
|
-
|
99
|
-
|
100
|
-
|
180
|
+
* **The [docs](docs) directory contains the official documentation**, and is used to generate the [Capistrano website](http://capistranorb.com)
|
181
|
+
* [Stack Overflow](http://stackoverflow.com/questions/tagged/capistrano) has a Capistrano tag with lots of activity
|
182
|
+
* [The Capistrano mailing list](https://groups.google.com/forum/#!forum/capistrano) is low-traffic but is monitored by Capistrano contributors
|
183
|
+
* [CodersClan](http://codersclan.net/?repo_id=325&source=link) has Capistrano experts available to solve problems for bounties
|
101
184
|
|
102
|
-
|
103
|
-
$ rake features
|
185
|
+
Related GitHub repositories:
|
104
186
|
|
105
|
-
|
106
|
-
|
107
|
-
|
187
|
+
* [capistrano/sshkit](https://github.com/capistrano/sshkit) provides the SSH behavior that underlies Capistrano (when you use `execute` in a Capistrano task, you are using SSHKit)
|
188
|
+
* [capistrano/rails](https://github.com/capistrano/rails) is a very popular gem that adds Ruby on Rails deployment tasks
|
189
|
+
* [mattbrictson/airbrussh](https://github.com/mattbrictson/airbrussh) provides Capistrano's default log formatting
|
190
|
+
|
191
|
+
GitHub issues are for bug reports and feature requests. Please refer to the [CONTRIBUTING](CONTRIBUTING.md) document for guidelines on submitting GitHub issues.
|
192
|
+
|
193
|
+
If you think you may have discovered a security vulnerability in Capistrano, do not open a GitHub issue. Instead, please send a report to <security@capistranorb.com>.
|
108
194
|
|
109
|
-
##
|
195
|
+
## How to contribute
|
110
196
|
|
111
|
-
[
|
112
|
-
connections behind the scenes in Capistrano. Depending on how deep you dig, you
|
113
|
-
might run into interfaces that come directly from SSHKit (the configuration is
|
114
|
-
a good example).
|
197
|
+
Contributions to Capistrano, in the form of code, documentation or idea, are gladly accepted. Read the [DEVELOPMENT](DEVELOPMENT.md) document to learn how to hack on Capistrano's code, run the tests, and contribute your first pull request.
|
115
198
|
|
116
199
|
## License
|
117
200
|
|
118
201
|
MIT License (MIT)
|
119
202
|
|
120
|
-
Copyright (c) 2012-
|
203
|
+
Copyright (c) 2012-2020 Tom Clements, Lee Hambley
|
121
204
|
|
122
205
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
123
206
|
of this software and associated documentation files (the "Software"), to deal
|
data/RELEASING.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
## Prerequisites
|
4
|
+
|
5
|
+
* You must have commit rights to the Capistrano repository.
|
6
|
+
* You must have push rights for the capistrano gem on rubygems.org.
|
7
|
+
|
8
|
+
## How to release
|
9
|
+
|
10
|
+
1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
|
11
|
+
2. **Ensure all tests are passing by running `rake spec` and `rake features`.**
|
12
|
+
3. Determine which would be the correct next version number according to [semver](http://semver.org/).
|
13
|
+
4. Update the version in `./lib/capistrano/version.rb`.
|
14
|
+
5. Update the version in the `./README.md` Gemfile example (`gem "capistrano", "~> X.Y"`).
|
15
|
+
6. Commit the `version.rb` and `README.md` changes in a single commit, the message should be "Release vX.Y.Z"
|
16
|
+
7. Run `rake release`; this will tag, push to GitHub, and publish to rubygems.org.
|
17
|
+
8. Update the draft release on the [GitHub releases page](https://github.com/capistrano/capistrano/releases) to point to the new tag and publish the release
|
data/Rakefile
CHANGED
@@ -2,8 +2,19 @@ require "bundler/gem_tasks"
|
|
2
2
|
require "cucumber/rake/task"
|
3
3
|
require "rspec/core/rake_task"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
require "rubocop/rake_task"
|
7
|
+
desc "Run RuboCop checks"
|
8
|
+
RuboCop::RakeTask.new
|
9
|
+
task default: %i(spec rubocop)
|
10
|
+
rescue LoadError
|
11
|
+
task default: :spec
|
12
|
+
end
|
7
13
|
|
14
|
+
RSpec::Core::RakeTask.new
|
8
15
|
Cucumber::Rake::Task.new(:features)
|
9
16
|
|
17
|
+
Rake::Task["release"].enhance do
|
18
|
+
puts "Don't forget to publish the release on GitHub!"
|
19
|
+
system "open https://github.com/capistrano/capistrano/releases"
|
20
|
+
end
|