Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created July 10, 2012 15:47
Show Gist options
  • Save mrchrisadams/3084229 to your computer and use it in GitHub Desktop.
Save mrchrisadams/3084229 to your computer and use it in GitHub Desktop.
Capistrano::Configuration.instance.load do
namespace :deploy do
namespace :amee do
namespace :ss3 do
desc "[internal] Copies ss3.yml file to app servers"
task :upload, :except => { :no_release => true } do
ss3_path = Rails.root.join("config", "ss3.yml")
# this errors out like so:
# gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task': wrong number of arguments (2 for 0) (ArgumentError)
upload (ss3_path), "#{shared_path}/config/ss3.yml"
# this works
put (File.read(ss3_path)), "#{shared_path}/config/ss3.yml"
end
desc "[internal] Updates the symlink for ss3.yml to the just deployed release."
task :symlink, :except => { :no_release => true } do
run "ln -nfs #{shared_path}/config/ss3.yml #{release_path}/config/ss3.yml"
end
end
end
end
end
@lwe
Copy link

lwe commented Dec 13, 2012

Bit late to the party, but changing upload to top.upload works perfectly here... i.e. to ensure it references the upload method from the correct namespace.

@DiveInto
Copy link

A life save, thanks ;-)

@AndreyKozlov1984
Copy link

Thanks a lot. Made me mad for 15 minutes but after reading this gist it is a relief.

@FineLineAutomation
Copy link

This helped me too. It was working perfectly until I refactored my local asset precompile task out to a Capistrano recipes gem. Using top.upload fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment