Permalink
Browse files

Added actual code. removed generator stuff. Added Readme.

  • Loading branch information...
1 parent a9f9bc2 commit ce9ff165173b2712571cb7fa1401b0b6e28cf676 @gunn committed Dec 13, 2009
Showing with 87 additions and 29 deletions.
  1. +0 −13 README
  2. +11 −0 README.rdoc
  3. +0 −8 generators/cap_gunn/USAGE
  4. +0 −8 generators/cap_gunn/cap_gunn_generator.rb
  5. +76 −0 recipes/deploy.rb
View
@@ -1,13 +0,0 @@
-CapGunn
-=======
-
-Introduction goes here.
-
-
-Example
-=======
-
-Example goes here.
-
-
-Copyright (c) 2009 [name of plugin creator], released under the MIT license
View
@@ -0,0 +1,11 @@
+== CapGunn
+
+What I use for my own bizzare style of deployment.
+A capistrano task that helps with git, nginx and passenger.
+
+Very unlikely to be useful to anyone else in it's current form. Feel free to grab bits though.
+
+Portions copied from - http://gist.github.com/180365
+
+
+Copyright (c) 2009 Arthur Gunn, released under the MIT license
@@ -1,8 +0,0 @@
-Description:
- Explain the generator
-
-Example:
- ./script/generate cap_gunn Thing
-
- This will create:
- what/will/it/create
@@ -1,8 +0,0 @@
-class CapGunnGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # m.directory "lib"
- # m.template 'README', "README"
- end
- end
-end
View
@@ -0,0 +1,76 @@
+namespace :deploy do
+ desc "Deploy app"
+ task :default do
+ git_push
+ migrations
+ end
+
+ desc "Git push to the online repo"
+ task :git_push, :except => { :no_release => true } do
+ system "cd #{local_current_path} && git push"
+ end
+
+ desc "Step one - scp the repo and shared dir online, set up structure there."
+ task :setup, :except => { :no_release => true } do
+ run "mkdir -p #{base_path}"
+ system "git clone --bare #{local_current_path} #{local_repository}"
+ system "cd #{local_repository} && git gc;"
+ system "scp -r -P #{port} #{local_repository} #{local_shared_path} #{user}@#{application}:#{base_path}/"
+ run "git clone #{repository} #{current_path}"
+
+ reload_nginx
+ restart
+ end
+
+ desc "Attempt safe reload of nginx config"
+ task :reload_nginx, :except => { :no_release => true } do
+ run "#{try_sudo} /etc/init.d/nginx reload"
+ end
+
+ desc "Update the deployed code."
+ task :update_code, :except => { :no_release => true } do
+ run "cd #{current_path}; git fetch origin; git reset --hard #{branch}; git submodule init; git submodule update"
+ end
+
+ desc "Deploy and run migrations"
+ task :migrations, :except => { :no_release => true } do
+ update_code
+ migrate
+ restart
+ end
+
+ desc "Run pending migrations on already deployed code"
+ task :migrate, :except => { :no_release => true } do
+ run "cd #{current_path}; rake RAILS_ENV=production db:migrate"
+ end
+
+ namespace :rollback do
+ desc "Rollback"
+ task :default do
+ code
+ end
+
+ desc "Rollback a single commit."
+ task :code, :except => { :no_release => true } do
+ set :branch, "HEAD^"
+ default
+ end
+ end
+
+
+ # override default tasks to make capistrano happy
+ desc "Kick Passenger"
+ task :start do
+ run "touch #{current_path}/tmp/restart.txt"
+ end
+
+ desc "Kick Passenger"
+ task :restart do
+ stop
+ start
+ end
+
+ desc "Kick Passenger"
+ task :stop do
+ end
+end

0 comments on commit ce9ff16

Please sign in to comment.