capistrano 3.14.0 → 3.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05d4d15902188667bafc9bbaa729506f5648ffb2adcd1f5705739977dd971db1
4
- data.tar.gz: f75c361ed0aa048cce3d18870e089e7d73861b2f43caf05aa4282d009e06e199
3
+ metadata.gz: 99671d269dca096fd99e25e1990a89ebb3241875e1f5bad7c09b6d31ee89181f
4
+ data.tar.gz: ce19a13c14d57456bdcc00077a68d908e8433e7995fe24b7eeaa96f4a32463b8
5
5
  SHA512:
6
- metadata.gz: 287936297e0003a7deb6e56e822355a65d1d2b12dfa141a957de6cf4aeaf818220d7ab3f1fe55c3e9c381c58ef72f1837ba49b8f0637637af62373d0fa3f3e72
7
- data.tar.gz: '08dadc7a9ae58638b5618203a6577de5f9cdab92c8f062977ea5758a915dcbd53d050a779373fde0d66a9173be58140f05ea03bda6ff20dc9c42c49ccab9e95d'
6
+ metadata.gz: 6fa979409c1e6e5e9ff293b97a4341ded24c4ab5e1a788f0b782ce6be010572851266aabb7ada7b8c955cb5a5d044fb1a28f4e97cfc2f7acfa742ccb1141cfc5
7
+ data.tar.gz: 57b9f530d593e32f64085e4b90e17ae5d23371382c91bbaa73e96268597d9d1ddf9bbd509806e955f3771d2a4cedd2a1fde300ea33ba470c0a4b46d9a5150247
@@ -0,0 +1,113 @@
1
+ version: 2.1
2
+
3
+ executors:
4
+ ruby:
5
+ parameters:
6
+ version:
7
+ description: "Ruby version number"
8
+ default: "3.1"
9
+ type: string
10
+ docker:
11
+ - image: ruby:<< parameters.version >>
12
+
13
+ commands:
14
+ bundle_install:
15
+ description: Install Ruby dependencies with Bundler
16
+ parameters:
17
+ version:
18
+ description: "Ruby version number"
19
+ default: "3.1"
20
+ type: string
21
+ steps:
22
+ - restore_cache:
23
+ keys:
24
+ - bundle-v1-{{ arch }}-<< parameters.version >>
25
+ - run:
26
+ name: Install Ruby Dependencies
27
+ command: |
28
+ gem install bundler --conservative --no-document || gem install bundler -v '< 2' --no-document
29
+ bundle config --local path vendor/bundle
30
+ bundle check || (bundle install --jobs=4 --retry=3 && bundle clean)
31
+ - save_cache:
32
+ paths:
33
+ - ./vendor/bundle
34
+ key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }}
35
+
36
+ jobs:
37
+ danger:
38
+ executor: ruby
39
+ steps:
40
+ - checkout
41
+ - bundle_install
42
+ - run: bundle exec danger
43
+
44
+ rubocop:
45
+ executor: ruby
46
+ steps:
47
+ - checkout
48
+ - bundle_install
49
+ - run: bundle exec rubocop
50
+
51
+ spec:
52
+ parameters:
53
+ version:
54
+ description: "Ruby version number"
55
+ default: "3.1"
56
+ type: string
57
+ executor:
58
+ name: ruby
59
+ version: << parameters.version >>
60
+ steps:
61
+ - checkout
62
+ - bundle_install:
63
+ version: << parameters.version >>
64
+ - run: bundle exec rake spec
65
+
66
+ workflows:
67
+ version: 2
68
+ commit-workflow:
69
+ jobs:
70
+ - danger
71
+ - rubocop
72
+ - spec:
73
+ matrix:
74
+ parameters:
75
+ version:
76
+ [
77
+ "2.0",
78
+ "2.1",
79
+ "2.2",
80
+ "2.3",
81
+ "2.4",
82
+ "2.5",
83
+ "2.6",
84
+ "2.7",
85
+ "3.0",
86
+ "3.1",
87
+ ]
88
+ cron-workflow:
89
+ jobs:
90
+ - rubocop
91
+ - spec:
92
+ matrix:
93
+ parameters:
94
+ version:
95
+ [
96
+ "2.0",
97
+ "2.1",
98
+ "2.2",
99
+ "2.3",
100
+ "2.4",
101
+ "2.5",
102
+ "2.6",
103
+ "2.7",
104
+ "3.0",
105
+ "3.1",
106
+ ]
107
+ triggers:
108
+ - schedule:
109
+ cron: "0 13 * * 6"
110
+ filters:
111
+ branches:
112
+ only:
113
+ - master
data/DEVELOPMENT.md CHANGED
@@ -53,7 +53,7 @@ $ bundle exec rake features KEEP_RUNNING=1
53
53
 
54
54
  ### Report failing Cucumber features!
55
55
 
56
- Currently, the Capistrano Travis 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.
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
57
 
58
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
59
 
@@ -63,7 +63,7 @@ This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce stand
63
63
 
64
64
  * Test that your contributions pass with `rake rubocop`
65
65
  * Rubocop is also run as part of the full test suite with `rake`
66
- * Note the Travis build will fail and your PR cannot be merged if Rubocop finds errors
66
+ * Note the CI build will fail and your PR cannot be merged if Rubocop finds errors
67
67
 
68
68
  ## Submitting a pull request
69
69
 
data/Gemfile CHANGED
@@ -3,6 +3,10 @@ source "https://rubygems.org"
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
11
  # Latest versions of cucumber don't support Ruby < 2.1
8
12
  # rubocop:disable Bundler/DuplicatedGem
@@ -12,8 +16,6 @@ group :cucumber do
12
16
  gem "cucumber"
13
17
  end
14
18
  # rubocop:enable Bundler/DuplicatedGem
15
- gem "rspec"
16
- gem "rspec-core", "~> 3.4.4"
17
19
  end
18
20
 
19
21
  # Latest versions of net-ssh don't support Ruby < 2.2.6
@@ -36,7 +38,9 @@ if Gem::Requirement.new("< 2.2").satisfied_by?(Gem::Version.new(RUBY_VERSION))
36
38
  gem "rake", "< 13.0.0"
37
39
  end
38
40
 
39
- # We only run danger once on a new-ish ruby; no need to install it otherwise
41
+ # We only run danger and rubocop on a new-ish ruby; no need to install them otherwise
40
42
  if Gem::Requirement.new("> 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
41
43
  gem "danger"
44
+ gem "psych", "< 4" # Ensures rubocop works on Ruby 3.1
45
+ gem "rubocop", "0.48.1"
42
46
  end
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![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)
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)
5
5
 
6
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.
7
7
 
@@ -107,7 +107,7 @@ Add Capistrano to your project's Gemfile using `require: false`:
107
107
 
108
108
  ``` ruby
109
109
  group :development do
110
- gem "capistrano", "~> 3.14", require: false
110
+ gem "capistrano", "~> 3.17", require: false
111
111
  end
112
112
  ```
113
113
 
data/Rakefile CHANGED
@@ -1,16 +1,19 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "cucumber/rake/task"
3
3
  require "rspec/core/rake_task"
4
- require "rubocop/rake_task"
5
4
 
6
- task default: %i(spec rubocop)
7
- 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
8
13
 
14
+ RSpec::Core::RakeTask.new
9
15
  Cucumber::Rake::Task.new(:features)
10
16
 
11
- desc "Run RuboCop checks"
12
- RuboCop::RakeTask.new
13
-
14
17
  Rake::Task["release"].enhance do
15
18
  puts "Don't forget to publish the release on GitHub!"
16
19
  system "open https://github.com/capistrano/capistrano/releases"
data/capistrano.gemspec CHANGED
@@ -31,8 +31,4 @@ Gem::Specification.new do |gem|
31
31
  gem.add_dependency "i18n"
32
32
  gem.add_dependency "rake", ">= 10.0.0"
33
33
  gem.add_dependency "sshkit", ">= 1.9.0"
34
-
35
- gem.add_development_dependency "mocha"
36
- gem.add_development_dependency "rspec"
37
- gem.add_development_dependency "rubocop", "0.48.1"
38
34
  end
@@ -5,7 +5,7 @@ Then(/^references in the remote repo are listed$/) do
5
5
  end
6
6
 
7
7
  Then(/^git wrapper permissions are 0700$/) do
8
- permissions_test = %Q([ $(stat -c "%a" #{TestApp.git_wrapper_path.shellescape}) == "700" ])
8
+ permissions_test = %Q([ $(stat -c "%a" #{TestApp.git_wrapper_path_glob}) == "700" ])
9
9
  _stdout, _stderr, status = vagrant_cli_command("ssh -c #{permissions_test.shellescape}")
10
10
 
11
11
  expect(status).to be_success
@@ -30,6 +30,12 @@ module VagrantHelpers
30
30
  return [stdout, stderr] if status.success?
31
31
  raise VagrantSSHCommandError, status
32
32
  end
33
+
34
+ def puts(message)
35
+ # Attach log messages to the current cucumber feature (`log`),
36
+ # or simply puts to the console (`super`) if we are outside of cucumber.
37
+ respond_to?(:log) ? log(message) : super(message)
38
+ end
33
39
  end
34
40
 
35
41
  World(VagrantHelpers)
@@ -10,6 +10,8 @@ module Capistrano
10
10
  WHITELIST = %i(
11
11
  application
12
12
  current_directory
13
+ linked_dirs
14
+ linked_files
13
15
  releases_directory
14
16
  repo_url
15
17
  repo_tree
@@ -33,7 +33,7 @@ module Capistrano
33
33
  end
34
34
 
35
35
  def t(key, options={})
36
- I18n.t(key, options.merge(scope: :capistrano))
36
+ I18n.t(key, **options.merge(scope: :capistrano))
37
37
  end
38
38
 
39
39
  def scm
@@ -1,5 +1,6 @@
1
1
  require "capistrano/scm/plugin"
2
2
  require "cgi"
3
+ require "securerandom"
3
4
  require "shellwords"
4
5
  require "uri"
5
6
 
@@ -7,10 +8,9 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
7
8
  def set_defaults
8
9
  set_if_empty :git_shallow_clone, false
9
10
  set_if_empty :git_wrapper_path, lambda {
10
- # Try to avoid permissions issues when multiple users deploy the same app
11
- # by using different file names in the same dir for each deployer and stage.
12
- suffix = %i(application stage local_user).map { |key| fetch(key).to_s }.join("-")
13
- "#{fetch(:tmp_dir)}/git-ssh-#{suffix}.sh"
11
+ # Use a unique name that won't collide with other deployments, and
12
+ # that cannot be guessed by other processes that have access to /tmp.
13
+ "#{fetch(:tmp_dir)}/git-ssh-#{SecureRandom.hex(10)}.sh"
14
14
  }
15
15
  set_if_empty :git_environmental_variables, lambda {
16
16
  {
@@ -60,6 +60,10 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
60
60
  end
61
61
  end
62
62
 
63
+ def verify_commit
64
+ git :"verify-commit", fetch_revision
65
+ end
66
+
63
67
  def archive_to_release_path
64
68
  if (tree = fetch(:repo_tree))
65
69
  tree = tree.slice %r#^/?(.*?)/?$#, 1
@@ -42,6 +42,7 @@ namespace :git do
42
42
  within repo_path do
43
43
  with fetch(:git_environmental_variables) do
44
44
  git_plugin.update_mirror
45
+ git_plugin.verify_commit if fetch(:git_verify_commit)
45
46
  end
46
47
  end
47
48
  end
@@ -21,10 +21,10 @@ set :repo_url, "git@example.com:me/my_repo.git"
21
21
  # set :pty, true
22
22
 
23
23
  # Default value for :linked_files is []
24
- # append :linked_files, "config/database.yml"
24
+ # append :linked_files, "config/database.yml", 'config/master.key'
25
25
 
26
26
  # Default value for linked_dirs is []
27
- # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
27
+ # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage"
28
28
 
29
29
  # Default value for default_env is {}
30
30
  # set :default_env, { path: "/opt/ruby/bin:$PATH" }
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- VERSION = "3.14.0".freeze
2
+ VERSION = "3.17.0".freeze
3
3
  end
@@ -28,13 +28,10 @@ module Capistrano
28
28
  end
29
29
 
30
30
  describe "#set_defaults" do
31
- it "makes git_wrapper_path using application, stage, and local_user" do
31
+ it "makes git_wrapper_path using a random hex value" do
32
32
  env.set(:tmp_dir, "/tmp")
33
- env.set(:application, "my_app")
34
- env.set(:stage, "staging")
35
- env.set(:local_user, "(Git Web User) via ShipIt")
36
33
  subject.set_defaults
37
- expect(env.fetch(:git_wrapper_path)).to eq("/tmp/git-ssh-my_app-staging-(Git Web User) via ShipIt.sh")
34
+ expect(env.fetch(:git_wrapper_path)).to match(%r{/tmp/git-ssh-\h{20}\.sh})
38
35
  end
39
36
 
40
37
  it "makes git_max_concurrent_connections" do
@@ -172,5 +169,16 @@ module Capistrano
172
169
  expect(revision).to eq("81cec13b777ff46348693d327fc8e7832f79bf43")
173
170
  end
174
171
  end
172
+
173
+ describe "#verify_commit" do
174
+ it "should run git verify-commit" do
175
+ env.set(:branch, "branch")
176
+
177
+ backend.expects(:capture).with(:git, "rev-list --max-count=1 branch").returns("81cec13b777ff46348693d327fc8e7832f79bf43")
178
+ backend.expects(:execute).with(:git, :"verify-commit", "81cec13b777ff46348693d327fc8e7832f79bf43")
179
+
180
+ subject.verify_commit
181
+ end
182
+ end
175
183
  end
176
184
  end
@@ -6,7 +6,7 @@ Vagrant.configure("2") do |config|
6
6
  [:app].each_with_index do |role, i|
7
7
  config.vm.define(role, primary: true) do |primary|
8
8
  primary.vm.define role
9
- primary.vm.box = "hashicorp/precise64"
9
+ primary.vm.box = "hashicorp/bionic64"
10
10
  primary.vm.network "forwarded_port", guest: 22, host: "222#{i}".to_i
11
11
  primary.vm.provision :shell, inline: "sudo apt-get -y install git-core"
12
12
 
@@ -40,6 +40,7 @@ module TestApp
40
40
  FileUtils.mkdir(test_app_path)
41
41
 
42
42
  File.open(gemfile, "w+") do |file|
43
+ file.write "source 'https://rubygems.org'\n"
43
44
  file.write "gem 'capistrano', path: '#{path_to_cap}'"
44
45
  end
45
46
 
@@ -185,12 +186,17 @@ module TestApp
185
186
  FileUtils.mv(config_path, location)
186
187
  end
187
188
 
188
- def git_wrapper_path
189
- "/tmp/git-ssh-my_app_name-#{stage}-#{current_user}.sh"
189
+ def git_wrapper_path_glob
190
+ "/tmp/git-ssh-*.sh"
190
191
  end
191
192
 
192
193
  def with_clean_bundler_env(&block)
193
194
  return yield unless defined?(Bundler)
194
- Bundler.with_clean_env(&block)
195
+
196
+ if Bundler.respond_to?(:with_unbundled_env)
197
+ Bundler.with_unbundled_env(&block)
198
+ else
199
+ Bundler.with_clean_env(&block)
200
+ end
195
201
  end
196
202
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.0
4
+ version: 3.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Clements
8
8
  - Lee Hambley
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-06 00:00:00.000000000 Z
12
+ date: 2022-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -67,48 +67,6 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: 1.9.0
70
- - !ruby/object:Gem::Dependency
71
- name: mocha
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: rspec
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: rubocop
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - '='
103
- - !ruby/object:Gem::Version
104
- version: 0.48.1
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - '='
110
- - !ruby/object:Gem::Version
111
- version: 0.48.1
112
70
  description: Capistrano is a utility and framework for executing commands in parallel
113
71
  on multiple remote machines, via SSH.
114
72
  email:
@@ -120,13 +78,13 @@ executables:
120
78
  extensions: []
121
79
  extra_rdoc_files: []
122
80
  files:
81
+ - ".circleci/config.yml"
123
82
  - ".github/issue_template.md"
124
83
  - ".github/pull_request_template.md"
125
84
  - ".github/release-drafter.yml"
126
85
  - ".github/workflows/push.yml"
127
86
  - ".gitignore"
128
87
  - ".rubocop.yml"
129
- - ".travis.yml"
130
88
  - CHANGELOG.md
131
89
  - CONTRIBUTING.md
132
90
  - DEVELOPMENT.md
@@ -262,7 +220,7 @@ metadata:
262
220
  source_code_uri: https://github.com/capistrano/capistrano
263
221
  homepage_uri: https://capistranorb.com/
264
222
  documentation_uri: https://capistranorb.com/
265
- post_install_message:
223
+ post_install_message:
266
224
  rdoc_options: []
267
225
  require_paths:
268
226
  - lib
@@ -277,8 +235,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
235
  - !ruby/object:Gem::Version
278
236
  version: '0'
279
237
  requirements: []
280
- rubygems_version: 3.1.2
281
- signing_key:
238
+ rubygems_version: 3.3.8
239
+ signing_key:
282
240
  specification_version: 4
283
241
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH
284
242
  test_files:
data/.travis.yml DELETED
@@ -1,28 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6.3
4
- - 2.5.5
5
- - 2.4.6
6
- - 2.3.8
7
- - 2.2
8
- - 2.1
9
- - 2.0
10
- matrix:
11
- # Rubinius periodically fails in general, and it always segfaults for RuboCop
12
- # in particular. Until we figure out how to make it work consistently, allow
13
- # it to fail without breaking the build.
14
- allow_failures:
15
- - rvm: rbx-2
16
- include:
17
- - rvm: rbx-2
18
- script: bundle exec rake spec
19
- # Run Danger only once, on 2.5.3
20
- - rvm: 2.5.5
21
- before_script: bundle exec danger
22
-
23
- script: bundle exec rake spec rubocop
24
- install: bundle install --jobs=1
25
- cache: bundler
26
- branches:
27
- only:
28
- - master