Sha256: c8bff710346ddd00154ec9cc1a53f0a447dd0a54376d2311cc4ac1e60173b2b7

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

set :opsworks_stack_name, ENV['OPSWORKS_STACK_NAME']
set :opsworks_app_name, ENV['OPSWORKS_APP_NAME']

namespace :preflight do
  task :check_env_vars do
    [:opsworks_stack_name, :opsworks_app_name].each do |var|
      if settings[var].nil?
        print_error(unindent(%[
          Setting #{var.to_s} must be specified.
        ]))
        die(2)
      end
    end
  end

  desc 'Fetches the application environment vars'
  task :fetch_environment => :check_env_vars do
    queue %[
      echo "-----> Preflight: Fetch Environment"
      #{echo_cmd %[bundle exec preflight-server fetch_environment #{settings.rails_env!} '#{settings.opsworks_stack_name!}' '#{settings.opsworks_app_name!}']}
    ]
  end

  desc 'Prepares the bundle for deploy'
  task :bundle => :environment do
    queue %[
      echo "-----> Preflight: Uploading Bundle"
      #{echo_cmd %[tar -zcvf tmp/preflight-#{settings.app_name!}-bundle-#{settings.rails_env!}.tgz -C #{deploy_to}/#{shared_path} bundle > /dev/null]} &&
      #{echo_cmd %[bundle exec preflight-server upload -b #{settings.preflight_bucket!} -f ./tmp/preflight-#{settings.app_name!}-bundle-#{settings.rails_env!}.tgz]}
    ]
  end

  desc 'Precompiles assets for deploy'
  task :assets => :environment do
    queue %[
      echo "-----> Preflight: Uploading Assets"
      #{echo_cmd %[tar -zcvf tmp/preflight-#{settings.app_name!}-assets-#{settings.rails_env!}.tgz -C #{deploy_to}/#{shared_path}/public assets > /dev/null]} &&
      #{echo_cmd %[bundle exec preflight-server upload -b #{settings.preflight_bucket!} -f ./tmp/preflight-#{settings.app_name!}-assets-#{settings.rails_env!}.tgz]}
    ]
  end

  desc 'Triggers a deploy'
  task :deploy => [:environment, :check_env_vars] do
    queue %[
      echo "-----> Preflight: Deploy"
      #{echo_cmd %[bundle exec preflight-server deploy '#{settings.opsworks_stack_name!}' '#{settings.opsworks_app_name!}' --release="$version"]}
    ]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ops_preflight-1.1.0 lib/ops_preflight/tasks.rb
ops_preflight-1.0.0.pre2 lib/ops_preflight/tasks.rb