Sha256: 4a4c0d9446e825dc8b08a79ca1197f01d118e1cfb385b2131813fa87eded9de8

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

namespace :config do

  task settings: 'settings:show'

  namespace :settings do
    desc 'Update the remote config/settings/<stage>.yml file with local'
    task upload: :delete do
      invoke "config/settings/#{fetch(:stage)}.yml"
    end

    desc 'Delete remote config/settings/<stage>.yml file'
    task :delete do
      on roles(:all) do |host|
        within shared_path do
          execute :rm, '-f', "config/settings/#{fetch(:stage)}.yml"
        end
      end
    end

    desc 'Show current settings'
    task :show do
      on roles(:all) do |host|
        within current_path.join('config') do
          execute :cat, 'settings.yml'
          execute :cat, "settings/#{fetch(:stage)}.yml"
        end
      end
    end

    desc 'Show current settings'
    task :get do
      on roles(:all) do |host|
        local_dir = File.join(Dir.pwd, 'config', 'settings')
        FileUtils.mkdir_p local_dir
        download! current_path.join('config', 'settings', "#{fetch(:stage)}.yml"), local_dir
      end
    end

    desc 'Edit remote settings'
    task :edit do
      on roles(:app), backend: :ssh_command do |*args|
        execute('\"\${EDITOR:-vi}\"', current_path.join('config', 'settings', "#{fetch(:stage)}.yml"))
      end
    end
  end

end

stages.each do |stage|
  remote_file "config/settings/#{stage}.yml" => File.join(Dir.pwd, 'config', 'settings', "#{stage}.yml")
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
j-cap-recipes-0.0.18 lib/j-cap-recipes/tasks/settings.rake
j-cap-recipes-0.0.17 lib/j-cap-recipes/tasks/settings.rake
j-cap-recipes-0.0.16 lib/j-cap-recipes/tasks/settings.rake