Sha256: 68a3713dc268374a51c86d4d6026438aa985f54aca8fc1fb13decf3c9a48ea73

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  set :normalize_asset_timestamps, false

  set :bundle_cmd,              "bundle"
  set :bundle_flags,            "--deployment --quiet --binstubs"

  # Remove tmp/pids from list of shared dirs that get symlinked into the release
  set :shared_children,   %w(public/system log)

  set :media_dir,   lambda { "#{deploy_to}/media" }
  set :revision_dir, lambda { "#{deploy_to}/revisions" }
  set :upload_dir, lambda { "#{deploy_to}/uploadcache" }

  namespace :spot do
    task :symlink_cache do
      cache_dir = File.join(latest_release, 'cache')
      run "mkdir #{cache_dir}; ln -s #{deploy_to}/media #{cache_dir}; ln -s #{deploy_to}/revisions #{cache_dir}; ln -s #{deploy_to}/uploadcache #{cache_dir}/tmp"
    end

    task :symlink_application do
      run "cd #{release_path} && ln -s `#{fetch(:bundle_cmd, 'bundle')} show spontaneous`/application public/.spontaneous"
    end

    # Capistrano automatically creates a tmp directory - I don't like that
    # and would prefer to share tmp between instances
    task :symlink_tmpdir do
      run "cd #{release_path} && rmdir tmp ; ln -nfs #{deploy_to}/shared/tmp ."
    end

    task :bundle_assets do
      run "cd #{release_path} && ./bin/spot assets compile --destination=#{release_path}"
    end
  end

  namespace :deploy do
    task :migrate, :roles => :db do
      spot_env = fetch(:spot_env, "production")
      run "cd #{latest_release} && SPOT_ENV=#{spot_env} ./bin/spot migrate"
    end
  end

  after 'deploy:finalize_update', 'spot:symlink_cache'
  after 'deploy:finalize_update', 'spot:symlink_tmpdir'
  after 'bundle:install', 'spot:symlink_application'
  after 'bundle:install', 'spot:bundle_assets'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta4 lib/spontaneous/capistrano/deploy.rb
spontaneous-0.2.0.beta3 lib/spontaneous/capistrano/deploy.rb
spontaneous-0.2.0.beta2 lib/spontaneous/capistrano/deploy.rb