Sha256: f307f42c2d63ba44143756e9414c4fc8448fe5768ff6380282b108b3627ab82e

Contents?: true

Size: 1.05 KB

Versions: 3

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 => :app 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

3 entries across 3 versions & 1 rubygems

Version Path
marcosgz-cap-recipe-0.0.8 lib/capistrano/recipes/gateways.rb
marcosgz-cap-recipe-0.0.7 lib/capistrano/recipes/gateways.rb
marcosgz-cap-recipe-0.0.6 lib/capistrano/recipes/gateways.rb