Sha256: 33bcfca721a5bd7f03bebc0b6b6393424775f6c13770c66d96eaa6f2e4455314

Contents?: true

Size: 951 Bytes

Versions: 2

Compression:

Stored size: 951 Bytes

Contents

Capistrano::Configuration.instance(:must_exist).load do
  rails_root =
    case
      when defined?(RAILS_ROOT)
        RAILS_ROOT
      when defined?(Rails.root)
        Rails.root
      else
        nil
    end

  if rails_root.nil?
    Capistrano::Configuration.instance.load_paths.each do |load_path| 
      if test(?e, File.join(load_path, 'Capfile'))
        rails_root = File.expand_path(load_path)
        break
      end
    end
  end

  abort 'could not determine rails_root!' unless rails_root

  unless test(?s, File.join(rails_root, '.sekrets.key'))
    abort "d'oh - you need a .sekrets.key to deploy ;-("
  end
        
  namespace :sekrets do
    task :upload_key do
    
      src = File.join(rails_root, '.sekrets.key')
      dst = File.join(latest_release, '.sekrets.key')
      
      if test(?s, src)
        upload(src, dst, :recursive => true)
      end
    end
  end
  after('deploy:finalize_update', 'sekrets:upload_key')
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sekrets-1.9.0 lib/sekrets/capistrano.rb
sekrets-1.8.1 lib/sekrets/capistrano.rb