Sha256: 89549a4290441904c4d82e5d6edf428c2f2c8a9455750eddb7ca723b02490351

Contents?: true

Size: 1.16 KB

Versions: 59

Compression:

Stored size: 1.16 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  namespace :ndr_dev_support do
    desc "Refresh the start/stop scripts in the app user's $HOME directory"
    task :refresh_sysadmin_scripts, except: { no_release: true } do
      # This is desirable, but opt-in, behaviour:
      if fetch(:synchronise_sysadmin_scripts, false)
        type    = fetch(:daemon_deployment) ? 'god' : 'server'
        scripts = %W(start_#{type}.sh stop_#{type}_gracefully.sh)

        scripts.each do |script|
          source  = File.join(release_path, 'script', "#{script}.sample")
          dest    = File.join(fetch(:application_home), script)

          # Ensure the script is pre-existing, with the correct permissions (should be writeable
          # by deployers, but only runnable by the application user, to prevent the wrong user
          # attempting to start the processes.)
          run "test -w #{dest}"                              # Should exist and be writeable
          run "test -e #{source} && cat #{source} > #{dest}" # Replace without changing permissions
        end
      end
    end
  end

  after 'deploy:update_code', 'ndr_dev_support:refresh_sysadmin_scripts'
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
ndr_dev_support-5.4.5 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.4.4 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.4.3 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.4.2 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.4.1 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.4.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.3.1 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.3.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.2.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.1.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.0.1 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-5.0.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.2.1 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.2.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.1.3 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.1.2 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.1.1 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.1.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb
ndr_dev_support-4.0.0 lib/ndr_dev_support/capistrano/sysadmin_scripts.rb