Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Created July 24, 2009 19:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/154482 to your computer and use it in GitHub Desktop.
Save mbbx6spp/154482 to your computer and use it in GitHub Desktop.
Git (submodule) Capistrano tasks
# 2009 Copyright Susan Potter <me at susanpotter dot net>
# You can read her software development rants at: http://geek.susanpotter.net
# Released under CreativeCommons-attribution-noncommercial-sharealike license:
# http://creativecommons.org/licenses/by-nc-sa/1.0/
namespace :git do
namespace :submodule do
desc "Initializes submodules"
task :init, :roles => :app do
invoke_command "cd #{current_path} && git submodule init", :via => run_method
end
desc "Updates submodules"
task :update, :roles => :app do
invoke_command "cd #{current_path} && git submodule update", :via => run_method
end
desc "Initializes and updates submodules"
task :pull, :roles => :app do
git.submodule.init
git.submodule.update
end
end
desc "Pull latest code"
task :pull, :roles => :app do
invoke_command "cd #{current_path} && git checkout #{env} && git pull origin #{env}", :via => run_method
end
desc "Refresh repository to origin/#{env} branch"
task :refresh, :roles => :app do
git.pull
git.submodule.pull
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment