Sha256: ffc4e4b172c1310280ad575173d445b8d6c2dadbe9ec34d89ea546bd5b9a97bf

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# Example
# =======
#
# uploader_setup_settings:
#   fog_credentials:
#     provider: Rackspace
#     rackspace_username: username
#     rackspace_api_key: secret
#   fog_directory: frontend
#   fog_host: http://123.rackcdn.com

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

  namespace :uploader do
    namespace :setup do
      desc "Upload configs"
      task :default, :roles => :app do
        if exists?(:uploader_setup_settings)
          set :recipe_settings, fetch(:uploader_setup_settings, {})
          put template.render(fetch(:uploader_template)), fetch(:uploader_remote_file)
        else
          puts "[FATAL] - Uploader template settings were not found"
          abort
        end
      end

      desc "Download configs"
      task :get, :roles => :db do
        download fetch(:uploader_remote_file), File.join(local_rails_root, "config/uploader.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/uploader.rb
marcosgz-cap-recipe-0.0.7 lib/capistrano/recipes/uploader.rb
marcosgz-cap-recipe-0.0.6 lib/capistrano/recipes/uploader.rb