capistrano 3.4.0 → 3.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +129 -0
  3. data/.github/issue_template.md +19 -0
  4. data/.github/pull_request_template.md +22 -0
  5. data/.github/release-drafter.yml +17 -0
  6. data/.github/workflows/push.yml +12 -0
  7. data/.gitignore +8 -5
  8. data/.rubocop.yml +62 -0
  9. data/CHANGELOG.md +1 -307
  10. data/CONTRIBUTING.md +63 -93
  11. data/DEVELOPMENT.md +127 -0
  12. data/Dangerfile +1 -0
  13. data/Gemfile +40 -3
  14. data/LICENSE.txt +1 -1
  15. data/README.md +127 -44
  16. data/RELEASING.md +17 -0
  17. data/Rakefile +13 -2
  18. data/UPGRADING-3.7.md +86 -0
  19. data/bin/cap +1 -1
  20. data/capistrano.gemspec +21 -24
  21. data/features/deploy.feature +35 -1
  22. data/features/doctor.feature +11 -0
  23. data/features/installation.feature +8 -3
  24. data/features/stage_failure.feature +9 -0
  25. data/features/step_definitions/assertions.rb +51 -18
  26. data/features/step_definitions/cap_commands.rb +9 -0
  27. data/features/step_definitions/setup.rb +53 -9
  28. data/features/subdirectory.feature +9 -0
  29. data/features/support/env.rb +5 -5
  30. data/features/support/remote_command_helpers.rb +12 -6
  31. data/features/support/vagrant_helpers.rb +17 -11
  32. data/lib/Capfile +1 -1
  33. data/lib/capistrano/all.rb +10 -10
  34. data/lib/capistrano/application.rb +47 -34
  35. data/lib/capistrano/configuration/empty_filter.rb +9 -0
  36. data/lib/capistrano/configuration/filter.rb +17 -47
  37. data/lib/capistrano/configuration/host_filter.rb +29 -0
  38. data/lib/capistrano/configuration/null_filter.rb +9 -0
  39. data/lib/capistrano/configuration/plugin_installer.rb +51 -0
  40. data/lib/capistrano/configuration/question.rb +31 -9
  41. data/lib/capistrano/configuration/role_filter.rb +29 -0
  42. data/lib/capistrano/configuration/scm_resolver.rb +149 -0
  43. data/lib/capistrano/configuration/server.rb +29 -23
  44. data/lib/capistrano/configuration/servers.rb +21 -14
  45. data/lib/capistrano/configuration/validated_variables.rb +110 -0
  46. data/lib/capistrano/configuration/variables.rb +112 -0
  47. data/lib/capistrano/configuration.rb +91 -44
  48. data/lib/capistrano/defaults.rb +26 -4
  49. data/lib/capistrano/deploy.rb +1 -1
  50. data/lib/capistrano/doctor/environment_doctor.rb +19 -0
  51. data/lib/capistrano/doctor/gems_doctor.rb +45 -0
  52. data/lib/capistrano/doctor/output_helpers.rb +79 -0
  53. data/lib/capistrano/doctor/servers_doctor.rb +105 -0
  54. data/lib/capistrano/doctor/variables_doctor.rb +74 -0
  55. data/lib/capistrano/doctor.rb +6 -0
  56. data/lib/capistrano/dotfile.rb +1 -2
  57. data/lib/capistrano/dsl/env.rb +9 -47
  58. data/lib/capistrano/dsl/paths.rb +11 -25
  59. data/lib/capistrano/dsl/stages.rb +14 -2
  60. data/lib/capistrano/dsl/task_enhancements.rb +7 -12
  61. data/lib/capistrano/dsl.rb +47 -16
  62. data/lib/capistrano/framework.rb +1 -1
  63. data/lib/capistrano/i18n.rb +32 -24
  64. data/lib/capistrano/immutable_task.rb +30 -0
  65. data/lib/capistrano/install.rb +1 -1
  66. data/lib/capistrano/plugin.rb +95 -0
  67. data/lib/capistrano/proc_helpers.rb +13 -0
  68. data/lib/capistrano/scm/git.rb +100 -0
  69. data/lib/capistrano/scm/hg.rb +55 -0
  70. data/lib/capistrano/scm/plugin.rb +13 -0
  71. data/lib/capistrano/scm/svn.rb +56 -0
  72. data/lib/capistrano/scm/tasks/git.rake +73 -0
  73. data/lib/capistrano/scm/tasks/hg.rake +53 -0
  74. data/lib/capistrano/scm/tasks/svn.rake +53 -0
  75. data/lib/capistrano/scm.rb +7 -20
  76. data/lib/capistrano/setup.rb +20 -6
  77. data/lib/capistrano/tasks/console.rake +4 -8
  78. data/lib/capistrano/tasks/deploy.rake +105 -73
  79. data/lib/capistrano/tasks/doctor.rake +24 -0
  80. data/lib/capistrano/tasks/framework.rake +13 -14
  81. data/lib/capistrano/tasks/install.rake +14 -15
  82. data/lib/capistrano/templates/Capfile +21 -10
  83. data/lib/capistrano/templates/deploy.rb.erb +17 -26
  84. data/lib/capistrano/templates/stage.rb.erb +9 -9
  85. data/lib/capistrano/upload_task.rb +1 -1
  86. data/lib/capistrano/version.rb +1 -1
  87. data/lib/capistrano/version_validator.rb +5 -10
  88. data/spec/integration/dsl_spec.rb +289 -240
  89. data/spec/integration_spec_helper.rb +3 -5
  90. data/spec/lib/capistrano/application_spec.rb +23 -39
  91. data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
  92. data/spec/lib/capistrano/configuration/filter_spec.rb +83 -85
  93. data/spec/lib/capistrano/configuration/host_filter_spec.rb +71 -0
  94. data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
  95. data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
  96. data/spec/lib/capistrano/configuration/question_spec.rb +58 -26
  97. data/spec/lib/capistrano/configuration/role_filter_spec.rb +80 -0
  98. data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +55 -0
  99. data/spec/lib/capistrano/configuration/server_spec.rb +106 -113
  100. data/spec/lib/capistrano/configuration/servers_spec.rb +129 -145
  101. data/spec/lib/capistrano/configuration_spec.rb +224 -63
  102. data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
  103. data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +67 -0
  104. data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
  105. data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
  106. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +89 -0
  107. data/spec/lib/capistrano/dsl/paths_spec.rb +97 -59
  108. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +57 -37
  109. data/spec/lib/capistrano/dsl_spec.rb +84 -11
  110. data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
  111. data/spec/lib/capistrano/plugin_spec.rb +84 -0
  112. data/spec/lib/capistrano/scm/git_spec.rb +184 -0
  113. data/spec/lib/capistrano/scm/hg_spec.rb +109 -0
  114. data/spec/lib/capistrano/scm/svn_spec.rb +137 -0
  115. data/spec/lib/capistrano/scm_spec.rb +7 -8
  116. data/spec/lib/capistrano/upload_task_spec.rb +7 -7
  117. data/spec/lib/capistrano/version_validator_spec.rb +61 -46
  118. data/spec/lib/capistrano_spec.rb +2 -3
  119. data/spec/spec_helper.rb +21 -8
  120. data/spec/support/Vagrantfile +9 -10
  121. data/spec/support/tasks/database.rake +3 -3
  122. data/spec/support/tasks/fail.rake +4 -3
  123. data/spec/support/tasks/failed.rake +2 -2
  124. data/spec/support/tasks/plugin.rake +6 -0
  125. data/spec/support/tasks/root.rake +4 -4
  126. data/spec/support/test_app.rb +64 -39
  127. metadata +100 -55
  128. data/.travis.yml +0 -13
  129. data/features/remote_file_task.feature +0 -14
  130. data/lib/capistrano/git.rb +0 -46
  131. data/lib/capistrano/hg.rb +0 -43
  132. data/lib/capistrano/svn.rb +0 -38
  133. data/lib/capistrano/tasks/git.rake +0 -81
  134. data/lib/capistrano/tasks/hg.rake +0 -52
  135. data/lib/capistrano/tasks/svn.rake +0 -52
  136. data/spec/lib/capistrano/git_spec.rb +0 -81
  137. data/spec/lib/capistrano/hg_spec.rb +0 -81
  138. data/spec/lib/capistrano/svn_spec.rb +0 -79
data/CONTRIBUTING.md CHANGED
@@ -1,93 +1,63 @@
1
- ## CONTRIBUTING
2
-
3
- **The issue tracker is intended exclusively for things that are genuine bugs,
4
- or improvements to the code.**
5
-
6
- If you have a user support query, or you suspect that you might just be holding
7
- it wrong, drop us a line at [the mailing list](https://groups.google.com/forum/#!forum/capistrano), [StackOverflow](http://stackoverflow.com/questions/tagged/capistrano) or at [CodersClan](http://codersclan.net/?repo_id=325&source=contributing). The
8
- mailing list is moderated to cut down on spam, so please be patient, if you use
9
- StackOverflow, make sure to tag your post with "Capistrano". (Not forgetting
10
- any other tags which might relate, rvm, rbenv, Ubuntu, etc.)
11
-
12
- If you have an urgent problem you can use [CodersClan](http://codersclan.net/?repo_id=325&source=contributing) to solve your problem quickly. CodersClan has a community of Capistrano experts dedicated to solve code problems for bounties.
13
-
14
- Wherever you post please be sure to include the version of Capistrano you are
15
- using, which versions of any plugins (*capistrano-rvm*, *capistrano-bundler*,
16
- etc.). Proper logs are vital, if you need to redact them, go ahead, but be
17
- careful not to remove anything important. Please take care to format logs and
18
- code correctly, ideally wrapped to a sane line length, and in a mono spaced
19
- font. This all helps us to gather a clear understanding of what is going wrong.
20
-
21
- **If you really think that you found a bug, or want to enquire about a feature,
22
- or send us a patch to add a feature, or fix a bug, please keep a few things in
23
- mind:**
24
-
25
- ## When Submitting An Issue:
26
-
27
- If you think there's a bug, please make sure it's really a bug in Capistrano.
28
- As Capistrano sits on the (sometimes rough) edges between SSH, Git, the
29
- network, Ruby, RVM, rbenv, chruby, Bundler, your Linux distribution, countless
30
- shell configuration files on your end, and the server… there's a good chance
31
- the problem lies somewhere else.
32
-
33
- Please make sure you have reviewed the FAQs at http://www.capistranorb.com/.
34
-
35
- It's really important to include as much information as possible, versions of
36
- everything involved, anything weird you might be doing that might be having
37
- side effects, include as much as you can in a [GitHub
38
- Gist](https://gist.github.com/) and link that from the issue, with tools such
39
- as Gist, we can link to individual lines and help work out what is going wrong.
40
-
41
- If you are an experienced Ruby programmer, take a few minutes to get our test
42
- suite running, and do what you can to get a test case written that fails, from
43
- there we can understand exactly what it takes to reproduce the issue (as it's
44
- documented with code)
45
-
46
- ## When Requesting a Feature:
47
-
48
- We can't make everyone happy all of the time, and we've been around the block
49
- well enough to know when something doesn't work well, or when your proposed fix
50
- might impact other things.
51
-
52
- We prefer to [start with
53
- "no"](https://gettingreal.37signals.com/ch05_Start_With_No.php), and help you
54
- find a better way to solve your problem, sometimes the solution is to [build
55
- faster
56
- horses](http://blog.cauvin.org/2010/07/henry-fords-faster-horse-quote.html),
57
- sometimes the solution is to work around it in a neat way that you didn't know
58
- existed.
59
-
60
- Please don't be offended if we say no, and don't be afraid to fight your
61
- corner, try and avoid being one of the [poisonous
62
- people](https://www.youtube.com/watch?v=Q52kFL8zVoM)
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 'https://rubygems.org'
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
- gem 'cucumber'
8
- gem 'rspec', '~> 3.0.0'
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-2013 Tom Clements, Lee Hambley
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
- ## Documentation
2
+ # Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.
4
3
 
5
- Check out the [online documentation](http://capistranorb.com) of Capistrano 3 hosted via this [repository](https://github.com/capistrano/capistrano.github.io).
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
- ## Support
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
- Need help with getting Capistrano up and running? Got a code problem you want to get solved quickly?
8
+ Once installed, Capistrano gives you a `cap` tool to perform your deployments from the comfort of your command line.
10
9
 
11
- Get <a href="http://codersclan.net/?repo_id=325&source=link">Capistrano support on CodersClan.</a> <a href="http://codersclan.net/?repo_id=325&source=big"><img src="http://www.codersclan.net/gs_button/?repo_id=325" width="150"></a>
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
- ## Requirements
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
- * Ruby >= 1.9.3 (JRuby and C-Ruby/YARV are supported)
67
+ #### It's just SSH
16
68
 
17
- Capistrano support these source code version control systems out of the box:
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
- * Git 1.8 or higher
20
- * Mercurial
21
- * SVN
71
+ ## Gotchas
22
72
 
23
- Binaries for these VCS might be required on the local and/or the remote systems.
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
- ## Installation
75
+ #### Project specifics
26
76
 
27
- Add this line to your application's Gemfile:
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
- gem 'capistrano', '~> 3.3.0'
109
+ group :development do
110
+ gem "capistrano", "~> 3.17", require: false
111
+ end
31
112
  ```
32
113
 
33
- And then execute:
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
- *make sure there's no "Capfile" or "capfile" present*
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 following files:
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 create different stages:
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
- ## Usage
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
- ## Testing
176
+ ## Finding help and documentation
89
177
 
90
- Capistrano has two test suites: an RSpec suite and a Cucumber suite. The
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
- # To run the RSpec suite
100
- $ rake spec
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
- # To run the Cucumber suite
103
- $ rake features
185
+ Related GitHub repositories:
104
186
 
105
- # To run the Cucumber suite and leave the VM running (faster for subsequent runs)
106
- $ rake features KEEP_RUNNING=1
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
- ## SSHKit
195
+ ## How to contribute
110
196
 
111
- [SSHKit](https://github.com/leehambley/sshkit) is the driver for SSH
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-2015 Tom Clements, Lee Hambley
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
- task :default => :spec
6
- RSpec::Core::RakeTask.new
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