diff options
| author | mo k <mo@mokhan.ca> | 2012-09-22 15:24:14 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-09-22 15:24:14 -0600 |
| commit | ac5dd436edea8a2ac833251e3e5b23ee202f8725 (patch) | |
| tree | 863d96c83149dfa277d3552ad627419a116b91e4 /lib | |
| parent | 38a7309d59474a780f6953cb7ae4b00e9af86c66 (diff) | |
move stuff from rakefile into separate rake files in lib/tasks
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tasks/database.rake | 8 | ||||
| -rw-r--r-- | lib/tasks/deployment.rake | 21 | ||||
| -rw-r--r-- | lib/tasks/ssh.rake | 11 | ||||
| -rw-r--r-- | lib/tasks/test.rake | 20 |
4 files changed, 60 insertions, 0 deletions
diff --git a/lib/tasks/database.rake b/lib/tasks/database.rake new file mode 100644 index 00000000..5e6a161c --- /dev/null +++ b/lib/tasks/database.rake @@ -0,0 +1,8 @@ +task :restore do + # 1. backup prod database + sh "cap production backup_db" + # 2. copy backup to staging + sh "rm -f latest && ln -s db/backups/`ls -rt db/backups/ | tail -n1` latest" + # 3. restore backup on staging + sh "cap staging restore_db" +end diff --git a/lib/tasks/deployment.rake b/lib/tasks/deployment.rake new file mode 100644 index 00000000..3edd22eb --- /dev/null +++ b/lib/tasks/deployment.rake @@ -0,0 +1,21 @@ +namespace :deploy do + desc "deploy to staging server" + task :staging => :spec do + #sh "cap staging deploy" + sh "cap staging deploy:migrations" + sh "curl http://staging.cakeside.com/ > /dev/null" + end + desc "deploy to production server" + task :production, :tag do |t, args| + tag_to_deploy = args.tag + if tag_to_deploy.blank? + puts "please specify the name of the tag to deploy" + puts "E.g. rake deploy:production['staging-2012-06-02-1-mo-user-settings']" + else + puts "deploying to production from tag #{tag_to_deploy}" + sh "cap production deploy -s tag=#{tag_to_deploy}" + sh "cap production deploy:migrations" + sh "curl http://cakeside.com/ > /dev/null" + end + end +end diff --git a/lib/tasks/ssh.rake b/lib/tasks/ssh.rake new file mode 100644 index 00000000..8ef426dd --- /dev/null +++ b/lib/tasks/ssh.rake @@ -0,0 +1,11 @@ +desc "install ssh keys" +task :install_keys do + sh "cp doc/keys/*.pem ~/.ssh/amazon-cakeside/" +end + +namespace :ssh do + desc "deploy to staging server" + task :staging do + sh "ssh ubuntu@ec2-23-22-119-121.compute-1.amazonaws.com -i ~/.ssh/amazon-cakeside/stagingcakesidecom.pem" + end +end diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake new file mode 100644 index 00000000..7c0ecd3a --- /dev/null +++ b/lib/tasks/test.rake @@ -0,0 +1,20 @@ +namespace :test do + task :specs, [ :display ] => :environment do |t, args| + ENV['DISPLAY'] = args[:display] if args[:display] + Rake::Task['spec:suite:all'].invoke + end + + task :jasmine, [ :display ] => :environment do |t, args| + ENV['DISPLAY'] = args[:display] if args[:display] + sh("bundle exec rake jasmine:ci") + end + + task :all, [ :display ] => :environment do |t, args| + Rake::Task['test:jasmine'].invoke(args[:display]) + Rake::Task['test:specs'].invoke(args[:display]) + end + + task :ci do + Rake::Task['test:all'].invoke(":99") + end +end |
