capistrano 3.7.0.beta1 → 3.7.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
  SHA1:
3
- metadata.gz: e931dfadef610b41da34b4f62e12a7a27c811cd0
4
- data.tar.gz: f50c1a957e6a56af182eefe19025021ec94b8e62
3
+ metadata.gz: ce22b5f5826e88b5fd92b3369c02344f20e2191e
4
+ data.tar.gz: 491397aab719879777bec4153c3125575f86e62a
5
5
  SHA512:
6
- metadata.gz: f5d746ae4fb0ef00e20856e805587be8d1215f692cbb23d10a24a5df90e078a7f1d901909085824d27e9eafb03b5ce85ccf6099ff540d001dc2aac958761fe79
7
- data.tar.gz: 491a552e20243bb82c77274d95d726cb0be2e37e6cccb866473b7621cc5549087b3a45cec370957f237c259d6439df77fc0834d71dc7e3fd586639b080dc9fd4
6
+ metadata.gz: 37864d78dd2d14478f0e9edcb316ac5e68fe5dc83b02bfd4017b1790350b26d1c929f6b94890fe351101fd05257f4bf8ce427fb8f5be0d1758e36e48fcc70fd5
7
+ data.tar.gz: 6eec3f49c1e4867137d3d266d533c44bcba2bc076d1e8d003e51bcc8735a14f613ef8c49a86f69417cd40deca95b2827115885289113e490ea8bf0940639c50b
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.0
3
+ - 2.3.1
4
4
  - 2.2
5
5
  - 2.1
6
6
  - 2.0
@@ -13,6 +13,10 @@ matrix:
13
13
  include:
14
14
  - rvm: rbx-2
15
15
  script: bundle exec rake spec
16
+ # Run Danger only once, on 2.3.1
17
+ - rvm: 2.3.1
18
+ before_script: bundle exec danger
19
+
16
20
  script: bundle exec rake spec rubocop
17
21
  install: bundle install --jobs=1
18
22
  cache: bundler
@@ -4,10 +4,36 @@ Reverse Chronological Order:
4
4
 
5
5
  ## master
6
6
 
7
- https://github.com/capistrano/capistrano/compare/v3.7.0.beta1...HEAD
7
+ https://github.com/capistrano/capistrano/compare/v3.7.0...HEAD
8
8
 
9
9
  * Your contribution here!
10
10
 
11
+ ## `3.7.0` (2016-12-10)
12
+
13
+ https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0
14
+
15
+ *Note: These release notes include all changes since 3.6.1, including the changes that were first published in 3.7.0.beta1.*
16
+
17
+ ### Deprecations:
18
+
19
+ * The `set :scm, ...` mechanism is now deprecated in favor of a new SCM plugin system. See the [UPGRADING-3.7](UPGRADING-3.7.md) document for details
20
+
21
+ ### Potentially breaking changes:
22
+
23
+ * The `:git_strategy`, `:hg_strategy`, and `:svn_strategy` settings have been removed with no replacement. If you have been using these to customize Capistrano's SCM behavior, you will need to rewrite your customization using the [new plugin system](http://capistranorb.com/documentation/advanced-features/custom-scm/)
24
+ * `remote_file` feature has been removed and is no longer available to use @SaiVardhan
25
+
26
+ ### New features:
27
+
28
+ * The `tar` used by the Git SCM now honors the SSHKit command map, allowing an alternative tar binary to be used (e.g. gtar) #1787 (@caius)
29
+ * Add support for custom on-filters [#1776](https://github.com/capistrano/capistrano/issues/1776)
30
+
31
+ ### Fixes:
32
+
33
+ * Fix test suite to work with Mocha 1.2.0 (@caius)
34
+ * Fix bug where host_filter and role_filter were overly greedy [#1766](https://github.com/capistrano/capistrano/issues/1766) (@cseeger-epages)
35
+ * Fix the removal of old releases `deploy:cleanup`. Logic is changed because of unreliable modification times on folders. Removal of directories is now decided by sorting on folder names (name is generated from current datetime format YmdHis). Cleanup is skipped, and a warning is given when a folder name is in a different format
36
+
11
37
  ## `3.7.0.beta1` (2016-11-02)
12
38
 
13
39
  https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0.beta1
@@ -0,0 +1,54 @@
1
+ # Adapted from https://github.com/ruby-grape/danger/blob/master/Dangerfile
2
+ # Q: What is a Dangerfile, anyway? A: See http://danger.systems/
3
+
4
+ # ------------------------------------------------------------------------------
5
+ # Additional pull request data
6
+ # ------------------------------------------------------------------------------
7
+ project_name = github.pr_json["base"]["repo"]["name"]
8
+ pr_number = github.pr_json["number"]
9
+ pr_url = github.pr_json["_links"]["html"]["href"]
10
+
11
+ # ------------------------------------------------------------------------------
12
+ # What changed?
13
+ # ------------------------------------------------------------------------------
14
+ has_lib_changes = !git.modified_files.grep(/^lib/).empty?
15
+ has_test_changes = !git.modified_files.grep(/^(features|spec)/).empty?
16
+ has_changelog_changes = git.modified_files.include?("CHANGELOG.md")
17
+
18
+ # ------------------------------------------------------------------------------
19
+ # You've made changes to lib, but didn't write any tests?
20
+ # ------------------------------------------------------------------------------
21
+ if has_lib_changes && !has_test_changes
22
+ warn("There are code changes, but no corresponding tests. "\
23
+ "Please include tests if this PR introduces any modifications in "\
24
+ "#{project_name}'s behavior.",
25
+ :sticky => false)
26
+ end
27
+
28
+ # ------------------------------------------------------------------------------
29
+ # Have you updated CHANGELOG.md?
30
+ # ------------------------------------------------------------------------------
31
+ if !has_changelog_changes && has_lib_changes
32
+ markdown <<-MARKDOWN
33
+ Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
34
+
35
+ ```markdown
36
+ * [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
37
+ ```
38
+ MARKDOWN
39
+ warn("Please update CHANGELOG.md with a description of your changes. "\
40
+ "If this PR is not a user-facing change (e.g. just refactoring), "\
41
+ "you can disregard this.", :sticky => false)
42
+ end
43
+
44
+ # ------------------------------------------------------------------------------
45
+ # Did you remove the CHANGELOG's "Your contribution here!" line?
46
+ # ------------------------------------------------------------------------------
47
+ if has_changelog_changes
48
+ unless IO.read("CHANGELOG.md") =~ /^\* Your contribution here/i
49
+ fail(
50
+ "Please put the `* Your contribution here!` line back into CHANGELOG.md.",
51
+ :sticky => false
52
+ )
53
+ end
54
+ end
data/README.md CHANGED
@@ -103,7 +103,7 @@ Add Capistrano to your project's Gemfile:
103
103
 
104
104
  ``` ruby
105
105
  group :development do
106
- gem "capistrano", "~> 3.6"
106
+ gem "capistrano", "~> 3.7"
107
107
  end
108
108
  ```
109
109
 
@@ -26,7 +26,8 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency "sshkit", ">= 1.9.0"
27
27
  gem.add_dependency "capistrano-harrow"
28
28
 
29
- gem.add_development_dependency "rspec"
29
+ gem.add_development_dependency "danger"
30
30
  gem.add_development_dependency "mocha"
31
+ gem.add_development_dependency "rspec"
31
32
  gem.add_development_dependency "rubocop"
32
33
  end
@@ -110,8 +110,25 @@ module Capistrano
110
110
  @timestamp ||= Time.now.utc
111
111
  end
112
112
 
113
+ def add_filter(filter=nil, &block)
114
+ if block
115
+ raise ArgumentError, "Both a block and an object were given" if filter
116
+
117
+ filter = Object.new
118
+ def filter.filter(servers)
119
+ block.call(servers)
120
+ end
121
+ elsif !filter.respond_to? :filter
122
+ raise TypeError, "Provided custom filter <#{filter.inspect}> does " \
123
+ "not have a public 'filter' method"
124
+ end
125
+ @custom_filters ||= []
126
+ @custom_filters << filter
127
+ end
128
+
113
129
  def setup_filters
114
- @filters = cmdline_filters.clone
130
+ @filters = cmdline_filters
131
+ @filters += @custom_filters if @custom_filters
115
132
  @filters << Filter.new(:role, ENV["ROLES"]) if ENV["ROLES"]
116
133
  @filters << Filter.new(:host, ENV["HOSTS"]) if ENV["HOSTS"]
117
134
  fh = fetch_for(:filter, {}) || {}
@@ -12,6 +12,7 @@ en = {
12
12
  written_file: "create %{file}",
13
13
  question: "Please enter %{key} (%{default_value}): ",
14
14
  keeping_releases: "Keeping %{keep_releases} of %{releases} deployed releases on %{host}",
15
+ skip_cleanup: "Skipping cleanup of old releases on %{host}; unexpected foldername found (should be timestamp)",
15
16
  no_old_releases: "No old releases (keeping newest %{keep_releases}) on %{host}",
16
17
  linked_file_does_not_exist: "linked file %{file} does not exist on %{host}",
17
18
  cannot_rollback: "There are no older releases to rollback to",
@@ -148,8 +148,10 @@ namespace :deploy do
148
148
  desc "Clean up old releases"
149
149
  task :cleanup do
150
150
  on release_roles :all do |host|
151
- releases = capture(:ls, "-xtr", releases_path).split
152
- if releases.count >= fetch(:keep_releases)
151
+ releases = capture(:ls, "-x", releases_path).split
152
+ if !(releases.all? { |e| /^\d{14}$/ =~ e })
153
+ warn t(:skip_cleanup, host: host.to_s)
154
+ elsif releases.count >= fetch(:keep_releases)
153
155
  info t(:keeping_releases, host: host.to_s, keep_releases: fetch(:keep_releases), releases: releases.count)
154
156
  directories = (releases - releases.last(fetch(:keep_releases)))
155
157
  if directories.any?
@@ -13,7 +13,7 @@
13
13
  # ==================
14
14
 
15
15
  # Defines a role with one or multiple servers. The primary server in each
16
- # group is considered to be the first unless any hosts have the primary
16
+ # group is considered to be the first unless any hosts have the primary
17
17
  # property set. Specify the username and a domain or IP for the server.
18
18
  # Don't use `:all`, it's a meta role.
19
19
 
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- VERSION = "3.7.0.beta1".freeze
2
+ VERSION = "3.7.0".freeze
3
3
  end
@@ -304,5 +304,54 @@ module Capistrano
304
304
  expect(config.dry_run?).to eq(true)
305
305
  end
306
306
  end
307
+
308
+ describe "custom filtering" do
309
+ it "accepts a custom filter object" do
310
+ filter = Object.new
311
+ def filter.filter(servers)
312
+ servers
313
+ end
314
+ config.add_filter(filter)
315
+ end
316
+
317
+ it "accepts a custom filter as a block" do
318
+ config.add_filter { |servers| servers }
319
+ end
320
+
321
+ it "raises an error if passed a block and an object" do
322
+ filter = Object.new
323
+ def filter.filter(servers)
324
+ servers
325
+ end
326
+
327
+ expect { config.add_filter(filter) { |servers| servers } }.to raise_error(ArgumentError)
328
+ end
329
+
330
+ it "raises an error if the filter lacks a filter method" do
331
+ filter = Object.new
332
+ expect { config.add_filter(filter) }.to raise_error(TypeError)
333
+ end
334
+
335
+ it "calls the filter method of a custom filter" do
336
+ ENV.delete "ROLES"
337
+ ENV.delete "HOSTS"
338
+
339
+ servers = Configuration::Servers.new
340
+
341
+ servers.add_host("test1")
342
+ servers.add_host("test2")
343
+ servers.add_host("test3")
344
+
345
+ filtered_servers = servers.take(2)
346
+
347
+ filter = mock("custom filter")
348
+ filter.expects(:filter)
349
+ .with { |subset| subset.is_a? Configuration::Servers }
350
+ .returns(filtered_servers)
351
+
352
+ config.add_filter(filter)
353
+ expect(config.filter(servers)).to eq(filtered_servers)
354
+ end
355
+ end
307
356
  end
308
357
  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.7.0.beta1
4
+ version: 3.7.0
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: 2016-11-03 00:00:00.000000000 Z
12
+ date: 2016-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrussh
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: rspec
85
+ name: danger
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rubocop
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +156,7 @@ files:
142
156
  - CHANGELOG.md
143
157
  - CONTRIBUTING.md
144
158
  - DEVELOPMENT.md
159
+ - Dangerfile
145
160
  - Gemfile
146
161
  - LICENSE.txt
147
162
  - README.md
@@ -277,12 +292,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
292
  version: '2.0'
278
293
  required_rubygems_version: !ruby/object:Gem::Requirement
279
294
  requirements:
280
- - - ">"
295
+ - - ">="
281
296
  - !ruby/object:Gem::Version
282
- version: 1.3.1
297
+ version: '0'
283
298
  requirements: []
284
299
  rubyforge_project:
285
- rubygems_version: 2.6.7
300
+ rubygems_version: 2.6.8
286
301
  signing_key:
287
302
  specification_version: 4
288
303
  summary: Capistrano - Welcome to easy deployment with Ruby over SSH