Sha256: db9fc0a686385adcfaf57ac05deaa58b3821b346c8bacbebe150324ce704a294

Contents?: true

Size: 1.61 KB

Versions: 52

Compression:

Stored size: 1.61 KB

Contents

require_relative 'ruby_version'

Capistrano::Configuration.instance(:must_exist).load do
  namespace :ndr_dev_support do
    desc 'Ensure gems outside the bundle are up to date'
    task :update_out_of_bundle_gems, except: { no_release: true } do
      # You can seed this list in your configuration with something like:
      #
      #   before 'ndr_dev_support:update_out_of_bundle_gems' do
      #     set :out_of_bundle_gems, webapp_deployment ? %w[puma] : %[god]
      #   end
      #
      gem_list = Array(fetch(:out_of_bundle_gems, []))

      # By default, gems are installed using passwordless sudo as the application
      # user; set to false if you want to install gems as the deploying user.
      gem_install =
        if fetch(:out_of_bundle_gems_use_sudo, true)
          "sudo -i -n -u #{fetch(:application_user)} RBENV_VERSION=$RBENV_VERSION gem install"
        else
          'gem install'
        end

      # Extract the current version requirements for each of the gems from the lockfile,
      # and then check they're installed. If not, install them from the vendored cache.
      run <<~CMD if gem_list.any?
        export RBENV_VERSION=`cat "#{latest_release}/.ruby-version"`;
        cat "#{latest_release}/Gemfile.lock" | egrep "^    (#{gem_list.join('|')}) " | tr -d '()' | \
        while read gem ver; do
          gem list -i "$gem" --version "$ver" > /dev/null || \
          #{gem_install} "#{latest_release}/vendor/cache/$gem-$ver.gem" \
            --ignore-dependencies --conservative --no-document;
        done
      CMD
    end
  end

  after 'bundle:install', 'ndr_dev_support:update_out_of_bundle_gems'
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
ndr_dev_support-7.2.4 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.2.3 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.2.2 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.2.1 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.2.0 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.1.0 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-7.0.0 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.9 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.8 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.7 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.6 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.5 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.4 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.3 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.2 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.1 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.1.0 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.0.4 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.0.3 lib/ndr_dev_support/capistrano/standalone_gems.rb
ndr_dev_support-6.0.2 lib/ndr_dev_support/capistrano/standalone_gems.rb