Sha256: 25549deb3a2ab2daf3554abccf185318e36969fd5f85ff962a0f74a251ec5d83

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# Example
# =======
#
# gateways_setup_settings:
#   example1:
#     login: 'username'
#     password: 'secret'

Capistrano::Configuration.instance(:must_exist).load do
  set(:gateways_remote_file) { File.join(shared_path, 'config/gateways.yml') } unless exists?(:gateways_remote_file)
  set(:gateways_template, 'gateways.yml.erb') unless exists?(:gateways_template)


  # Required attributes
  # ===================
  # *gateways_name* prod_db
  namespace :gateways do
    namespace :setup do
      desc "Upload configs"
      task :default, :roles => :db do
        if exists?(:gateways_setup_settings)
          set(:recipe_settings) { fetch(:gateways_setup_settings, {}) }
          put template.render(fetch(:gateways_template)), fetch(:gateways_remote_file)
        else
          puts "[FATAL] - Gateway template settings were not found"
          abort
        end
      end

      desc "Download configs"
      task :get, :roles => :db do
        download fetch(:gateways_remote_file), File.join(local_rails_root, 'config/gateways.yml')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marcosgz-cap-recipe-0.0.5 lib/capistrano/recipes/gateways.rb