capistrano-bundler 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 780794935cf4421e6c6ca628207e7fa7fca0f42c8f856727b4ca26acc410246a
4
+ data.tar.gz: d7bf7372a9def4a6d90525f2e09292908b0a1390303e1688ec69024e02ad832c
5
+ SHA512:
6
+ metadata.gz: 03262ebc4a0d68aa83cc12cc42a620ac76c0872753d5625b37e854551b7776f4d1da575f9bec8407b7496c37b43ac73128fb4ed4ecf2220a4714ebfefe5dc09b
7
+ data.tar.gz: 675812f770b249ce6e3c010796713b422d6f9bf9866dd2b1c7bb7af7fb9931cdde5720aa98cedd40b5efceccb2e06d8c68c0278797f61ad7ddfc42caeef0a88a
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ Gemfile.lock
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v '~> 1.14' --conservative
6
+ before_script: bundle exec danger
@@ -0,0 +1,89 @@
1
+ # [Unreleased][] (master)
2
+
3
+ * Your contribution here!
4
+
5
+ # [1.6.0][] (2 Jul 2019)
6
+
7
+ * Added `bundle_check_before_install` option to allow bypassing the `bundle install test` in the `bundler:install` task.
8
+
9
+ # [1.5.0][] (23 Dec 2018)
10
+
11
+ Changes to default behavior
12
+
13
+ * Set `bundle_jobs` default to `4` @Tensho
14
+
15
+ Breaking changes
16
+
17
+ * None
18
+
19
+ # [1.4.0][] (21 Oct 2018)
20
+
21
+ Breaking changes
22
+
23
+ * None
24
+
25
+ Added
26
+
27
+ * When "bundle install" is skipped due to a Gemfile's dependencies are being satisfied, print a message to the log instead of silently skipping
28
+
29
+ # [1.3.0][] (22 Sep 2017)
30
+
31
+ Breaking changes
32
+
33
+ * None
34
+
35
+ Added
36
+
37
+ * Set all variables in `load:defaults` task so they are recognised as valid Capistrano settings when using `doctor:variables` and ensure defaults for `bundle_env_variables` and `bundle_clean_options` are set once in the same place as the other defaults.
38
+
39
+ # [1.2.0][] (1 Oct 2016)
40
+
41
+ Breaking changes
42
+
43
+ * None
44
+
45
+ Added
46
+
47
+ * A `bundle clean` task. There are no default hooks for it.
48
+ * Use `bundle check` to check if we can skip `bundle install`
49
+ * Run `bundle:install` on rollback (`deploy:reverted`)
50
+ * You can now `require "capistrano/bundler/tasks"` to load the tasks only without the hooks
51
+
52
+ # 1.1.4 (22 Jan 2015)
53
+
54
+ * Don’t generate binstubs by default (#61)
55
+
56
+ # 1.1.3 (4 Aug 2014)
57
+
58
+ * Honor `:no_release` flag by using `release_roles` in Capistrano 3.1
59
+ * capistrano-bundler now requires Capistrano 3.1 or higher (~> 3.1)
60
+ * Added `:bundle_jobs` option for specifying number of parallel jobs
61
+
62
+ # 1.1.2 (8 Feb 2014)
63
+
64
+ * Added `bundle_env_variables` option for specifying environment variables that should be set when running `bundle`.
65
+ * The `bundle_dir` option is now named `bundle_path`
66
+ * Use `bundle install` instead of `bundle`
67
+ * All options are now optional and can be excluded from the final bundle command by setting them to `nil`
68
+ * Bundler looks for a `Gemfile` by default, so there is no need to specify it.
69
+
70
+ # 1.1.1
71
+
72
+ * ruby is not prefixed with `bundle exec` anymore by default
73
+ * prefix rails with `bundle exec` by default
74
+
75
+ # 1.1.0
76
+
77
+ * Switching to new command map (https://github.com/capistrano/sshkit/pull/45)
78
+ Thanks to new command map, now this integration adds `bundle exec` to global executables (gem, ruby, rake). The list of executable can be tweaked by `bundle_bins`.
79
+
80
+ # 1.0.0
81
+
82
+ Initial release
83
+
84
+ [Unreleased]: https://github.com/capistrano/bundler/compare/v1.6.0...HEAD
85
+ [1.6.0]: https://github.com/capistrano/bundler/compare/v1.5.0...v1.6.0
86
+ [1.5.0]: https://github.com/capistrano/bundler/compare/v1.4.0...v1.5.0
87
+ [1.4.0]: https://github.com/capistrano/bundler/compare/v1.3.0...v1.4.0
88
+ [1.3.0]: https://github.com/capistrano/bundler/compare/v1.2.0...v1.3.0
89
+ [1.2.0]: https://github.com/capistrano/bundler/compare/v1.1.4...v1.2.0
@@ -0,0 +1 @@
1
+ danger.import_dangerfile(github: "capistrano/danger")
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-bundler.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Capistrano, your one stop deployment shop.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,135 @@
1
+ # Capistrano::Bundler
2
+
3
+ Bundler specific tasks for Capistrano v3:
4
+
5
+ ```sh
6
+ $ cap production bundler:install
7
+ ```
8
+
9
+ It also prefixes certain binaries to use `bundle exec`.
10
+
11
+ ## Installation
12
+
13
+ Add these lines to your application's Gemfile **[Recommended]**:
14
+
15
+ ```ruby
16
+ gem 'capistrano', '~> 3.6'
17
+ gem 'capistrano-bundler', '~> 1.6'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ ```sh
23
+ $ bundle
24
+ ```
25
+
26
+ Or install it yourself as:
27
+
28
+ ```sh
29
+ $ gem install capistrano-bundler
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Require in `Capfile` to use the default task:
35
+
36
+ ```ruby
37
+ require 'capistrano/bundler'
38
+ ```
39
+
40
+ The task will run before `deploy:updated` as part of Capistrano's default deploy, or can be run in isolation with `cap production bundler:install`.
41
+
42
+ In order for Bundler to work efficiently on the server, its project configuration directory (`<release_path>/.bundle/`) should be persistent across releases.
43
+ You need to add it to the `linked_dirs` Capistrano variable:
44
+
45
+ Capistrano **3.5**+:
46
+
47
+ ```ruby
48
+ # config/deploy.rb
49
+
50
+ append :linked_dirs, '.bundle'
51
+ ```
52
+
53
+ Capistrano < 3.5:
54
+
55
+ ```ruby
56
+ # config/deploy.rb
57
+
58
+ set :linked_dirs, fetch(:linked_dirs, []) << '.bundle'
59
+ ```
60
+
61
+ It will still work fine with non-persistent configuration directory, but then it will have to re-resolve all gems on each deploy.
62
+
63
+ By default, the plugin adds `bundle exec` prefix to common executables listed in `bundle_bins` option. This currently applies for `gem`, `rake` and `rails`.
64
+
65
+ You can add any custom executable to this list:
66
+
67
+ ```ruby
68
+ set :bundle_bins, fetch(:bundle_bins, []).push('my_new_binary')
69
+ ```
70
+
71
+ Configurable options:
72
+
73
+ ```ruby
74
+ set :bundle_roles, :all # this is default
75
+ set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) } # this is default
76
+ set :bundle_binstubs, -> { shared_path.join('bin') } # default: nil
77
+ set :bundle_gemfile, -> { release_path.join('MyGemfile') } # default: nil
78
+ set :bundle_path, -> { shared_path.join('bundle') } # this is default. set it to nil for skipping the --path flag.
79
+ set :bundle_without, %w{development test}.join(' ') # this is default
80
+ set :bundle_flags, '--deployment --quiet' # this is default
81
+ set :bundle_env_variables, {} # this is default
82
+ set :bundle_clean_options, "" # this is default. Use "--dry-run" if you just want to know what gems would be deleted, without actually deleting them
83
+ set :bundle_check_before_install, true # default: true. Set this to false to bypass running `bundle check` before executing `bundle install`
84
+ ```
85
+
86
+ You can parallelize the installation of gems with bundler's jobs feature.
87
+ Choose a number less or equal than the number of cores your server.
88
+
89
+ ```ruby
90
+ set :bundle_jobs, 8 # default: 4, only available for Bundler >= 1.4
91
+ ```
92
+
93
+ To generate binstubs on each deploy, set `:bundle_binstubs` path:
94
+
95
+ ```ruby
96
+ set :bundle_binstubs, -> { shared_path.join('bin') }
97
+ ```
98
+
99
+ In the result this would execute the following bundle command on all servers
100
+ (actual paths depend on the real deploy directory):
101
+
102
+ ```sh
103
+ $ bundle install \
104
+ --binstubs /my_app/shared/bin \
105
+ --gemfile /my_app/releases/20130623094732/MyGemfile \
106
+ --path /my_app/shared/bundle \
107
+ --without development test \
108
+ --deployment --quiet
109
+ ```
110
+
111
+ If any option is set to `nil` it will be excluded from the final bundle command.
112
+
113
+ If you want to clean up gems after a successful deploy, add `after 'deploy:published', 'bundler:clean'` to config/deploy.rb.
114
+
115
+ Downsides to cleaning:
116
+
117
+ * If a rollback requires rebuilding a Gem with a large compiled binary component, such as Nokogiri, the rollback will take a while.
118
+ * In rare cases, if a gem that was used in the previously deployed version was yanked, rollback would entirely fail.
119
+
120
+ ### Environment Variables
121
+
122
+ The `bundle_env_variables` option can be used to specify any environment variables you want present when running the `bundle` command:
123
+
124
+ ```ruby
125
+ # This translates to NOKOGIRI_USE_SYSTEM_LIBRARIES=1 when executed
126
+ set :bundle_env_variables, { nokogiri_use_system_libraries: 1 }
127
+ ```
128
+
129
+ ## Contributing
130
+
131
+ 1. Fork it
132
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
133
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
134
+ 4. Push to the branch (`git push origin my-new-feature`)
135
+ 5. Create new Pull Request
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ # Do nothing by default
4
+ task :default
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'capistrano-bundler'
7
+ spec.version = '1.6.0'
8
+ spec.authors = ['Tom Clements', 'Lee Hambley', 'Kir Shatrov']
9
+ spec.email = ['seenmyfate@gmail.com', 'lee.hambley@gmail.com', 'shatrov@me.com']
10
+ spec.description = %q{Bundler support for Capistrano 3.x}
11
+ spec.summary = %q{Bundler support for Capistrano 3.x}
12
+ spec.homepage = 'https://github.com/capistrano/bundler'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_dependency 'capistrano', '~> 3.1'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'danger'
24
+ spec.add_development_dependency 'rake'
25
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ require_relative 'bundler/tasks'
2
+ require_relative 'bundler/hooks'
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/hooks.cap', __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/bundler.cap', __FILE__)
@@ -0,0 +1,90 @@
1
+ namespace :bundler do
2
+ desc <<-DESC
3
+ Install the current Bundler environment. By default, gems will be \
4
+ installed to the shared/bundle path. Gems in the development and \
5
+ test group will not be installed. The install command is executed \
6
+ with the --deployment and --quiet flags.
7
+
8
+ By default, bundler will not be run on servers with no_release: true.
9
+
10
+ You can override any of these defaults by setting the variables shown below.
11
+
12
+ set :bundle_roles, :all
13
+
14
+ set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) }
15
+ set :bundle_binstubs, -> { shared_path.join('bin') }
16
+ set :bundle_gemfile, -> { release_path.join('Gemfile') }
17
+ set :bundle_path, -> { shared_path.join('bundle') }
18
+ set :bundle_without, %w{development test}.join(' ')
19
+ set :bundle_flags, '--deployment --quiet'
20
+ set :bundle_jobs, nil
21
+ set :bundle_env_variables, {}
22
+ set :bundle_clean_options, ""
23
+ DESC
24
+ task :install do
25
+ on fetch(:bundle_servers) do
26
+ within release_path do
27
+ with fetch(:bundle_env_variables) do
28
+ options = []
29
+ options << "--gemfile #{fetch(:bundle_gemfile)}" if fetch(:bundle_gemfile)
30
+ options << "--path #{fetch(:bundle_path)}" if fetch(:bundle_path)
31
+
32
+ if fetch(:bundle_check_before_install) && test(:bundle, :check, *options)
33
+ info "The Gemfile's dependencies are satisfied, skipping installation"
34
+ else
35
+ options << "--binstubs #{fetch(:bundle_binstubs)}" if fetch(:bundle_binstubs)
36
+ options << "--jobs #{fetch(:bundle_jobs)}" if fetch(:bundle_jobs)
37
+ options << "--without #{fetch(:bundle_without)}" if fetch(:bundle_without)
38
+ options << "#{fetch(:bundle_flags)}" if fetch(:bundle_flags)
39
+ execute :bundle, :install, *options
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ desc <<-DESC
47
+ Maps all binaries to use `bundle exec` by default.
48
+ Add your own binaries to the array with the command shown below.
49
+
50
+ set :bundle_bins, fetch(:bundle_bins) + %w(my_new_binary)
51
+ DESC
52
+ task :map_bins do
53
+ fetch(:bundle_bins).each do |command|
54
+ SSHKit.config.command_map.prefix[command.to_sym].push("bundle exec")
55
+ end
56
+ end
57
+
58
+ desc "Remove unused gems installed by bundler"
59
+ task :clean do
60
+ on fetch(:bundle_servers) do
61
+ within release_path do
62
+ with fetch(:bundle_env_variables) do
63
+ execute :bundle, :clean, fetch(:bundle_clean_options)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ Capistrano::DSL.stages.each do |stage|
71
+ after stage, 'bundler:map_bins'
72
+ end
73
+
74
+ namespace :load do
75
+ task :defaults do
76
+ set :bundle_bins, %w{gem rake rails}
77
+
78
+ set :bundle_roles, :all
79
+ set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) }
80
+ set :bundle_binstubs, nil
81
+ set :bundle_gemfile, nil
82
+ set :bundle_path, -> { shared_path.join('bundle') }
83
+ set :bundle_without, %w{development test}.join(' ')
84
+ set :bundle_flags, '--deployment --quiet'
85
+ set :bundle_jobs, 4
86
+ set :bundle_env_variables, {}
87
+ set :bundle_clean_options, ""
88
+ set :bundle_check_before_install, true
89
+ end
90
+ end
@@ -0,0 +1,2 @@
1
+ before 'deploy:updated', 'bundler:install'
2
+ before 'deploy:reverted', 'bundler:install'
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-bundler
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Tom Clements
8
+ - Lee Hambley
9
+ - Kir Shatrov
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2019-07-02 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '3.1'
29
+ - !ruby/object:Gem::Dependency
30
+ name: bundler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '1.3'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.3'
43
+ - !ruby/object:Gem::Dependency
44
+ name: danger
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rake
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ description: Bundler support for Capistrano 3.x
72
+ email:
73
+ - seenmyfate@gmail.com
74
+ - lee.hambley@gmail.com
75
+ - shatrov@me.com
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - ".gitignore"
81
+ - ".travis.yml"
82
+ - CHANGELOG.md
83
+ - Dangerfile
84
+ - Gemfile
85
+ - LICENSE
86
+ - README.md
87
+ - Rakefile
88
+ - capistrano-bundler.gemspec
89
+ - lib/capistrano-bundler.rb
90
+ - lib/capistrano/bundler.rb
91
+ - lib/capistrano/bundler/hooks.rb
92
+ - lib/capistrano/bundler/tasks.rb
93
+ - lib/capistrano/tasks/bundler.cap
94
+ - lib/capistrano/tasks/hooks.cap
95
+ homepage: https://github.com/capistrano/bundler
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubygems_version: 3.0.4
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Bundler support for Capistrano 3.x
118
+ test_files: []