capistrano 3.11.0 → 3.11.1

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: f1881e1201f433bc48dbc66746fc18c7a2935a8f9fb6ebd1a1738d2ef0b76ead
4
- data.tar.gz: f568e1ce7457104688457d96651ae1fe6e3278eeaf5b690736ecbd8632c5c678
3
+ metadata.gz: f49655355a29df420b48044e15216c6edd72c9a11a41c502c00f2e2b34e61121
4
+ data.tar.gz: 422078d39578d7688357f247d28337f76e071cae2c8fa780615f7c650f37aac5
5
5
  SHA512:
6
- metadata.gz: 5048e39674899c372e7d591935ac6c4a399678adb42ee5b5ab593d471c6a91dc611b280267a3718c5967c1eeb31b94dcc6a3257e358de5df2a95ac72c9392132
7
- data.tar.gz: fe376f99e76a3743abc79358325afb84a33ce544c6f13b2b2491f324d67c7ad4e7c3b1c28ac421ae64ed26ffe82620837d78ce75433c16adec74fa6f8123123e
6
+ metadata.gz: c80d8785a8b09638e3cd44961469607ade3e84984e50fe79d680aa62f8ba7dfc8ce1baad91328ca6a7c29416ff46cdaa4efd933056efd9f857c344e1c2b48659
7
+ data.tar.gz: ccd85825ce1005098fc7dda72d5bde5b118f79f7f9b039fccc4cb07bbc3d2e6b51f3164faa386ed594b926277b876e750670f781bf2f5f00bb19bce06c5f77c3
@@ -1,7 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.1
4
- - 2.3.1
3
+ - 2.6.3
4
+ - 2.5.5
5
+ - 2.4.6
6
+ - 2.3.8
5
7
  - 2.2
6
8
  - 2.1
7
9
  - 2.0
@@ -14,8 +16,8 @@ matrix:
14
16
  include:
15
17
  - rvm: rbx-2
16
18
  script: bundle exec rake spec
17
- # Run Danger only once, on 2.3.1
18
- - rvm: 2.3.1
19
+ # Run Danger only once, on 2.5.3
20
+ - rvm: 2.5.5
19
21
  before_script: bundle exec danger
20
22
 
21
23
  script: bundle exec rake spec rubocop
@@ -24,4 +26,3 @@ cache: bundler
24
26
  branches:
25
27
  except:
26
28
  - legacy-v2
27
- sudo: false
@@ -20,6 +20,12 @@ gem "capistrano", github: "capistrano/capistrano", require: false
20
20
 
21
21
  * Your contribution here!
22
22
 
23
+ ## [`3.11.1`] (2019-08-29)
24
+
25
+ * [#2027](https://github.com/capistrano/capistrano/pull/2027): Batch rm -rf calls in deploy:cleanup to fix an error when there are too many old releases [@azin634](https://github.com/azin634)
26
+
27
+ [`3.11.1`]: https://github.com/capistrano/capistrano/compare/v3.11.0...v3.11.1
28
+
23
29
  ## [`3.11.0`] (2018-06-02)
24
30
 
25
31
  * [#1972](https://github.com/capistrano/capistrano/pull/1972): fallback ask to default when used in non interactive session
data/Gemfile CHANGED
@@ -4,7 +4,29 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :cucumber do
7
- gem "cucumber"
7
+ # Latest versions of cucumber don't support Ruby < 2.1
8
+ # rubocop:disable Bundler/DuplicatedGem
9
+ if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
10
+ gem "cucumber", "< 3.0.1"
11
+ else
12
+ gem "cucumber"
13
+ end
14
+ # rubocop:enable Bundler/DuplicatedGem
8
15
  gem "rspec"
9
16
  gem "rspec-core", "~> 3.4.4"
10
17
  end
18
+
19
+ # Latest versions of net-ssh don't support Ruby < 2.2.6
20
+ if Gem::Requirement.new("< 2.2.6").satisfied_by?(Gem::Version.new(RUBY_VERSION))
21
+ gem "net-ssh", "< 5.0.0"
22
+ end
23
+
24
+ # Latest versions of public_suffix don't support Ruby < 2.1
25
+ if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
26
+ gem "public_suffix", "< 3.0.0"
27
+ end
28
+
29
+ # Latest versions of i18n don't support Ruby < 2.1
30
+ if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
31
+ gem "i18n", "< 1.3.0"
32
+ end
@@ -1,6 +1,6 @@
1
1
  MIT License (MIT)
2
2
 
3
- Copyright (c) 2012-2018 Tom Clements, Lee Hambley
3
+ Copyright (c) 2012-2019 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
@@ -200,7 +200,7 @@ Contributions to Capistrano, in the form of code, documentation or idea, are gla
200
200
 
201
201
  MIT License (MIT)
202
202
 
203
- Copyright (c) 2012-2018 Tom Clements, Lee Hambley
203
+ Copyright (c) 2012-2019 Tom Clements, Lee Hambley
204
204
 
205
205
  Permission is hereby granted, free of charge, to any person obtaining a copy
206
206
  of this software and associated documentation files (the "Software"), to deal
@@ -12,7 +12,9 @@ Gem::Specification.new do |gem|
12
12
  gem.description = "Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH."
13
13
  gem.summary = "Capistrano - Welcome to easy deployment with Ruby over SSH"
14
14
  gem.homepage = "http://capistranorb.com/"
15
-
15
+ gem.metadata = {
16
+ "changelog_uri" => "https://github.com/capistrano/capistrano/blob/master/CHANGELOG.md"
17
+ }
16
18
  gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ /^docs/ }
17
19
  gem.executables = %w(cap capify)
18
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
@@ -70,6 +70,12 @@ Feature: Deploy
70
70
  Then 3 valid releases are kept
71
71
  And the current directory will be a symlink to the release
72
72
 
73
+ Scenario: Cleanup when there are more releases than arguments can handle
74
+ Given config stage file has line "set :keep_releases, 3"
75
+ And 5000 valid existing releases
76
+ When I run cap "deploy:cleanup"
77
+ Then 3 valid releases are kept
78
+
73
79
  Scenario: Rolling Back
74
80
  Given I make 2 deployments
75
81
  When I run cap "deploy:rollback"
@@ -80,10 +80,12 @@ end
80
80
 
81
81
  Given(/^(\d+) valid existing releases$/) do |num|
82
82
  a_day = 86_400 # in seconds
83
- offset = -(a_day * num.to_i)
84
- num.to_i.times do
85
- run_vagrant_command("mkdir -p #{TestApp.release_path(TestApp.timestamp(offset))}")
86
- offset += a_day
83
+ (1...num).each_slice(100) do |num_batch|
84
+ dirs = num_batch.map do |i|
85
+ offset = -(a_day * i)
86
+ TestApp.release_path(TestApp.timestamp(offset))
87
+ end
88
+ run_vagrant_command("mkdir -p #{dirs.join(' ')}")
87
89
  end
88
90
  end
89
91
 
@@ -168,8 +168,9 @@ namespace :deploy do
168
168
  debug t(:no_current_release, host: host.to_s)
169
169
  end
170
170
  if directories.any?
171
- directories_str = directories.join(" ")
172
- execute :rm, "-rf", directories_str
171
+ directories.each_slice(100) do |directories_batch|
172
+ execute :rm, "-rf", *directories_batch
173
+ end
173
174
  else
174
175
  info t(:no_old_releases, host: host.to_s, keep_releases: fetch(:keep_releases))
175
176
  end
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- VERSION = "3.11.0".freeze
2
+ VERSION = "3.11.1".freeze
3
3
  end
@@ -5,46 +5,40 @@ describe Capistrano::Application do
5
5
 
6
6
  it "provides a --format option which enables the choice of output formatting"
7
7
 
8
- let(:help_output) do
9
- out, _err = capture_io do
10
- flags "--help", "-h"
11
- end
12
- out
13
- end
14
-
15
- it "displays documentation URL as help banner" do
16
- expect(help_output.lines.first).to match(/capistranorb.com/)
8
+ it "displays documentation URL as help banner", capture_io: true do
9
+ flags "--help", "-h"
10
+ expect($stdout.string.each_line.first).to match(/capistranorb.com/)
17
11
  end
18
12
 
19
13
  %w(quiet silent verbose).each do |switch|
20
- it "doesn't include --#{switch} in help" do
21
- expect(help_output).not_to match(/--#{switch}/)
14
+ it "doesn't include --#{switch} in help", capture_io: true do
15
+ flags "--help", "-h"
16
+ expect($stdout.string).not_to match(/--#{switch}/)
22
17
  end
23
18
  end
24
19
 
25
- it "overrides the rake method, but still prints the rake version" do
26
- out, _err = capture_io do
27
- flags "--version", "-V"
28
- end
20
+ it "overrides the rake method, but still prints the rake version", capture_io: true do
21
+ flags "--version", "-V"
22
+ out = $stdout.string
29
23
  expect(out).to match(/\bCapistrano Version\b/)
30
24
  expect(out).to match(/\b#{Capistrano::VERSION}\b/)
31
25
  expect(out).to match(/\bRake Version\b/)
32
26
  expect(out).to match(/\b#{Rake::VERSION}\b/)
33
27
  end
34
28
 
35
- it "overrides the rake method, and sets the sshkit_backend to SSHKit::Backend::Printer" do
36
- capture_io do
37
- flags "--dry-run", "-n"
38
- end
29
+ it "overrides the rake method, and sets the sshkit_backend to SSHKit::Backend::Printer", capture_io: true do
30
+ flags "--dry-run", "-n"
39
31
  sshkit_backend = Capistrano::Configuration.fetch(:sshkit_backend)
40
32
  expect(sshkit_backend).to eq(SSHKit::Backend::Printer)
41
33
  end
42
34
 
43
- it "enables printing all config variables on command line parameter" do
44
- capture_io do
35
+ it "enables printing all config variables on command line parameter", capture_io: true do
36
+ begin
45
37
  flags "--print-config-variables", "-p"
38
+ expect(Capistrano::Configuration.fetch(:print_config_variables)).to be true
39
+ ensure
40
+ Capistrano::Configuration.reset!
46
41
  end
47
- expect(Capistrano::Configuration.fetch(:print_config_variables)).to be true
48
42
  end
49
43
 
50
44
  def flags(*sets)
@@ -63,22 +57,4 @@ describe Capistrano::Application do
63
57
  subject.run
64
58
  subject.options
65
59
  end
66
-
67
- def capture_io
68
- require "stringio"
69
-
70
- orig_stdout = $stdout
71
- orig_stderr = $stderr
72
- captured_stdout = StringIO.new
73
- captured_stderr = StringIO.new
74
- $stdout = captured_stdout
75
- $stderr = captured_stderr
76
-
77
- yield
78
-
79
- return captured_stdout.string, captured_stderr.string
80
- ensure
81
- $stdout = orig_stdout
82
- $stderr = orig_stderr
83
- end
84
60
  end
@@ -49,7 +49,7 @@ module Capistrano
49
49
  expect(task.prerequisites).to eq([:example_prerequisite])
50
50
  end
51
51
 
52
- it "sets defaults when load:defaults is invoked" do
52
+ it "sets defaults when load:defaults is invoked", capture_io: true do
53
53
  expect(fetch(:example_variable)).to be_nil
54
54
  invoke "load:defaults"
55
55
  expect(fetch(:example_variable)).to eq("foo")
@@ -58,7 +58,7 @@ module Capistrano
58
58
  end
59
59
  end
60
60
 
61
- context "tty unavailable" do
61
+ context "tty unavailable", capture_io: true do
62
62
  before do
63
63
  $stdin.expects(:gets).never
64
64
  $stdin.expects(:tty?).returns(false)
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require "capistrano/scm"
2
3
 
3
4
  module Capistrano
4
5
  class Configuration
@@ -24,12 +25,12 @@ module Capistrano
24
25
  expect { resolver.resolve }.to output(/will not load the git scm/i).to_stderr
25
26
  end
26
27
 
27
- it "activates the git scm" do
28
+ it "activates the git scm", capture_io: true do
28
29
  resolver.resolve
29
30
  expect(Rake::Task["git:wrapper"]).not_to be_nil
30
31
  end
31
32
 
32
- it "sets :scm to :git" do
33
+ it "sets :scm to :git", capture_io: true do
33
34
  resolver.resolve
34
35
  expect(fetch(:scm)).to eq(:git)
35
36
  end
@@ -29,7 +29,7 @@ module Capistrano
29
29
  Rake::Task.clear
30
30
  end
31
31
 
32
- it "has an doctor:environment task that calls EnvironmentDoctor" do
32
+ it "has an doctor:environment task that calls EnvironmentDoctor", capture_io: true do
33
33
  EnvironmentDoctor.any_instance.expects(:call)
34
34
  Rake::Task["doctor:environment"].invoke
35
35
  end
@@ -53,7 +53,7 @@ module Capistrano
53
53
  Rake::Task.clear
54
54
  end
55
55
 
56
- it "has an doctor:gems task that calls GemsDoctor" do
56
+ it "has an doctor:gems task that calls GemsDoctor", capture_io: true do
57
57
  GemsDoctor.any_instance.expects(:call)
58
58
  Rake::Task["doctor:gems"].invoke
59
59
  end
@@ -71,7 +71,7 @@ module Capistrano
71
71
  Rake::Task.clear
72
72
  end
73
73
 
74
- it "has an doctor:servers task that calls ServersDoctor" do
74
+ it "has an doctor:servers task that calls ServersDoctor", capture_io: true do
75
75
  ServersDoctor.any_instance.expects(:call)
76
76
  Rake::Task["doctor:servers"].invoke
77
77
  end
@@ -74,7 +74,7 @@ module Capistrano
74
74
  Rake::Task.clear
75
75
  end
76
76
 
77
- it "has an doctor:variables task that calls VariablesDoctor" do
77
+ it "has an doctor:variables task that calls VariablesDoctor", capture_io: true do
78
78
  VariablesDoctor.any_instance.expects(:call)
79
79
  Rake::Task["doctor:variables"].invoke
80
80
  end
@@ -35,7 +35,7 @@ module Capistrano
35
35
  end
36
36
  end
37
37
 
38
- it "invokes in proper order if define after than before" do
38
+ it "invokes in proper order if define after than before", capture_io: true do
39
39
  task_enhancements.after("task", "after_task")
40
40
  task_enhancements.before("task", "before_task")
41
41
 
@@ -44,7 +44,7 @@ module Capistrano
44
44
  expect(order).to eq(%w(before_task task after_task))
45
45
  end
46
46
 
47
- it "invokes in proper order if define before than after" do
47
+ it "invokes in proper order if define before than after", capture_io: true do
48
48
  task_enhancements.before("task", "before_task")
49
49
  task_enhancements.after("task", "after_task")
50
50
 
@@ -53,7 +53,7 @@ module Capistrano
53
53
  expect(order).to eq(%w(before_task task after_task))
54
54
  end
55
55
 
56
- it "invokes in proper order when referring to as-yet undefined tasks" do
56
+ it "invokes in proper order when referring to as-yet undefined tasks", capture_io: true do
57
57
  task_enhancements.after("task", "not_loaded_task")
58
58
 
59
59
  Rake::Task.define_task("not_loaded_task") do
@@ -65,7 +65,7 @@ module Capistrano
65
65
  expect(order).to eq(%w(task not_loaded_task))
66
66
  end
67
67
 
68
- it "invokes in proper order and with arguments and block" do
68
+ it "invokes in proper order and with arguments and block", capture_io: true do
69
69
  task_enhancements.after("task", "after_task_custom", :order) do |_t, _args|
70
70
  order.push "after_task"
71
71
  end
@@ -79,7 +79,7 @@ module Capistrano
79
79
  expect(order).to eq(%w(before_task task after_task))
80
80
  end
81
81
 
82
- it "invokes using the correct namespace when defined within a namespace" do
82
+ it "invokes using the correct namespace when defined within a namespace", capture_io: true do
83
83
  Rake.application.in_namespace("namespace") do
84
84
  Rake::Task.define_task("task") do |t|
85
85
  order.push(t.name)
@@ -99,7 +99,7 @@ module Capistrano
99
99
  )
100
100
  end
101
101
 
102
- it "raises a sensible error if the task isn't found" do
102
+ it "raises a sensible error if the task isn't found", capture_io: true do
103
103
  task_enhancements.after("task", "non_existent_task")
104
104
  expect { Rake::Task["task"].invoke order }.to raise_error(ArgumentError, 'Task "non_existent_task" not found')
105
105
  end
@@ -60,7 +60,7 @@ module Capistrano
60
60
  end
61
61
  end
62
62
 
63
- it "prints helpful message to stderr" do
63
+ it "prints helpful message to stderr", capture_io: true do
64
64
  expect do
65
65
  expect do
66
66
  task.invoke
@@ -72,7 +72,7 @@ module Capistrano
72
72
 
73
73
  describe "#invoke" do
74
74
  context "reinvoking" do
75
- it "will not reenable invoking task" do
75
+ it "will not reenable invoking task", capture_io: true do
76
76
  counter = 0
77
77
 
78
78
  Rake::Task.define_task("A") do
@@ -85,7 +85,7 @@ module Capistrano
85
85
  end.to change { counter }.by(1)
86
86
  end
87
87
 
88
- it "will print a message on stderr" do
88
+ it "will print a message on stderr", capture_io: true do
89
89
  Rake::Task.define_task("B")
90
90
 
91
91
  expect do
@@ -98,7 +98,7 @@ module Capistrano
98
98
 
99
99
  describe "#invoke!" do
100
100
  context "reinvoking" do
101
- it "will reenable invoking task" do
101
+ it "will reenable invoking task", capture_io: true do
102
102
  counter = 0
103
103
 
104
104
  Rake::Task.define_task("C") do
@@ -111,7 +111,7 @@ module Capistrano
111
111
  end.to change { counter }.by(2)
112
112
  end
113
113
 
114
- it "will not print a message on stderr" do
114
+ it "will not print a message on stderr", capture_io: true do
115
115
  Rake::Task.define_task("D")
116
116
 
117
117
  expect do
@@ -62,14 +62,14 @@ module Capistrano
62
62
  dummy.expects(:set_defaults).never
63
63
  end
64
64
 
65
- it "calls set_defaults during load:defaults" do
65
+ it "calls set_defaults during load:defaults", capture_io: true do
66
66
  dummy = DummyPlugin.new
67
67
  dummy.expects(:set_defaults).once
68
68
  install_plugin(dummy)
69
69
  Rake::Task["load:defaults"].invoke
70
70
  end
71
71
 
72
- it "is able to load tasks from a .rake file" do
72
+ it "is able to load tasks from a .rake file", capture_io: true do
73
73
  install_plugin(ExternalTasksPlugin)
74
74
  Rake::Task["plugin_test"].invoke
75
75
  expect(fetch(:plugin_result)).to eq("hello")
@@ -13,4 +13,17 @@ RSpec.configure do |config|
13
13
  config.raise_errors_for_deprecations!
14
14
  config.mock_framework = :mocha
15
15
  config.order = "random"
16
+
17
+ config.around(:example, capture_io: true) do |example|
18
+ begin
19
+ Rake.application.options.trace_output = StringIO.new
20
+ $stdout = StringIO.new
21
+ $stderr = StringIO.new
22
+ example.run
23
+ ensure
24
+ Rake.application.options.trace_output = STDERR
25
+ $stdout = STDOUT
26
+ $stderr = STDERR
27
+ end
28
+ end
16
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Clements
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-03 00:00:00.000000000 Z
12
+ date: 2019-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -268,7 +268,8 @@ files:
268
268
  homepage: http://capistranorb.com/
269
269
  licenses:
270
270
  - MIT
271
- metadata: {}
271
+ metadata:
272
+ changelog_uri: https://github.com/capistrano/capistrano/blob/master/CHANGELOG.md
272
273
  post_install_message:
273
274
  rdoc_options: []
274
275
  require_paths:
@@ -284,8 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
285
  - !ruby/object:Gem::Version
285
286
  version: '0'
286
287
  requirements: []
287
- rubyforge_project:
288
- rubygems_version: 2.7.7
288
+ rubygems_version: 3.0.3
289
289
  signing_key:
290
290
  specification_version: 4
291
291
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH