handy 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,24 @@
1
- namespace :delayed_job do
2
- desc "Start delayed_job process"
3
- task :start, :roles => :app do
4
- run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job start"
5
- end
1
+ Capistrano::Configuration.instance(:must_exist).load do
6
2
 
7
- desc "Stop delayed_job process"
8
- task :stop, :roles => :app do
9
- run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job stop"
10
- end
3
+ namespace :delayed_job do
4
+ desc "Start delayed_job process"
5
+ task :start, :roles => :app do
6
+ run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job start"
7
+ end
8
+
9
+ desc "Stop delayed_job process"
10
+ task :stop, :roles => :app do
11
+ run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job stop"
12
+ end
11
13
 
12
- desc "Restart delayed_job process"
13
- task :restart, :roles => :app do
14
- run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job restart"
14
+ desc "Restart delayed_job process"
15
+ task :restart, :roles => :app do
16
+ run "cd #{current_path}; RAILS_ENV=#{stage} script/delayed_job restart"
17
+ end
15
18
  end
16
- end
17
19
 
18
- after "deploy:start", "delayed_job:start"
19
- after "deploy:stop", "delayed_job:stop"
20
- after "deploy:restart", "delayed_job:restart"
20
+ after "deploy:start", "delayed_job:start"
21
+ after "deploy:stop", "delayed_job:stop"
22
+ after "deploy:restart", "delayed_job:restart"
21
23
 
24
+ end
@@ -1,33 +1,37 @@
1
- # Usage:
2
- #
3
- # cap production remote 'tail -f log/production.log'
4
- # cap production rake 'db:prod2staging'
1
+ Capistrano::Configuration.instance(:must_exist).load do
5
2
 
6
- set :sudo_call, ''
3
+ # Usage:
4
+ #
5
+ # cap production remote 'tail -f log/production.log'
6
+ # cap production rake 'db:prod2staging'
7
7
 
8
- desc 'makes remote/rake calls to be executed with sudo'
9
- task :use_sudo do
10
- set :sudo_call, 'sudo'
11
- end
8
+ set :sudo_call, ''
12
9
 
13
- desc 'run rake task'
14
- task :rake do
15
- ARGV.values_at(Range.new(ARGV.index('rake')+1,-1)).each do |task|
16
- run "cd #{current_path}; #{sudo_call} RAILS_ENV=#{stage} rake #{task}"
10
+ desc 'makes remote/rake calls to be executed with sudo'
11
+ task :use_sudo do
12
+ set :sudo_call, 'sudo'
17
13
  end
18
- exit(0)
19
- end
20
14
 
21
- desc 'run remote command'
22
- task :remote do
23
- command=ARGV.values_at(Range.new(ARGV.index('remote')+1, -1))
24
- run "cd #{current_path}; #{sudo_call} RAILS_ENV=#{stage} #{command*' '}"
25
- exit(0)
26
- end
15
+ desc 'run rake task'
16
+ task :rake do
17
+ ARGV.values_at(Range.new(ARGV.index('rake')+1,-1)).each do |task|
18
+ run "cd #{current_path}; #{sudo_call} RAILS_ENV=#{stage} rake #{task}"
19
+ end
20
+ exit(0)
21
+ end
22
+
23
+ desc 'run remote command'
24
+ task :remote do
25
+ command=ARGV.values_at(Range.new(ARGV.index('remote')+1, -1))
26
+ run "cd #{current_path}; #{sudo_call} RAILS_ENV=#{stage} #{command*' '}"
27
+ exit(0)
28
+ end
29
+
30
+ desc 'run specified rails code on server'
31
+ task :runner do
32
+ command=ARGV.values_at(Range.new(ARGV.index('runner')+1, -1))
33
+ run "cd #{current_path}; RAILS_ENV=#{stage} rails runner '#{command*' '}'"
34
+ exit(0)
35
+ end
27
36
 
28
- desc 'run specified rails code on server'
29
- task :runner do
30
- command=ARGV.values_at(Range.new(ARGV.index('runner')+1, -1))
31
- run "cd #{current_path}; RAILS_ENV=#{stage} rails runner '#{command*' '}'"
32
- exit(0)
33
37
  end
@@ -1,17 +1,21 @@
1
- # source: http://tomcopeland.blogs.com/juniordeveloper/2008/05/mod_rails-and-c.html
2
- namespace :deploy do
3
- desc "Restarting mod_rails with restart.txt"
4
- task :restart, :roles => :app, :except => { :no_release => true } do
5
- run "touch #{current_path}/tmp/restart.txt"
6
- end
1
+ Capistrano::Configuration.instance(:must_exist).load do
7
2
 
8
- [:start, :stop].each do |t|
9
- desc "#{t} task is a no-op with mod_rails"
10
- task t, :roles => :app do ; end
11
- end
3
+ # source: http://tomcopeland.blogs.com/juniordeveloper/2008/05/mod_rails-and-c.html
4
+ namespace :deploy do
5
+ desc "Restarting mod_rails with restart.txt"
6
+ task :restart, :roles => :app, :except => { :no_release => true } do
7
+ run "touch #{current_path}/tmp/restart.txt"
8
+ end
12
9
 
13
- desc "invoke the db migration"
14
- task:migrate, :roles => :app do
15
- send(run_method, "cd #{current_path} && rake db:migrate RAILS_ENV=#{stage} ")
10
+ [:start, :stop].each do |t|
11
+ desc "#{t} task is a no-op with mod_rails"
12
+ task t, :roles => :app do ; end
13
+ end
14
+
15
+ desc "invoke the db migration"
16
+ task:migrate, :roles => :app do
17
+ send(run_method, "cd #{current_path} && rake db:migrate RAILS_ENV=#{stage} ")
18
+ end
16
19
  end
20
+
17
21
  end
@@ -1,14 +1,17 @@
1
- # Usage:
2
- #
3
- # Following capistrano task will restore your local database with database from remote database
4
- # cap production db:restore_local
5
- namespace :db do
6
- desc 'restore local file with data from remote machine'
7
- task :restore_local do
8
- timestamp = Time.now.strftime("%Y-%m-%d-%H-%M-%S")
9
- send(run_method, "cd #{current_path} && rake handy:db:backup timestamp=#{timestamp} RAILS_ENV=#{stage} ")
10
- get "#{deploy_to}/current/tmp/#{timestamp}.sql.gz","tmp/#{timestamp}.sql.gz"
11
- system("rake handy:db:restore file='#{timestamp}.sql.gz'")
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ # Usage:
4
+ #
5
+ # Following capistrano task will restore your local database with database from remote database
6
+ # cap production db:restore_local
7
+ namespace :db do
8
+ desc 'restore local file with data from remote machine'
9
+ task :restore_local do
10
+ timestamp = Time.now.strftime("%Y-%m-%d-%H-%M-%S")
11
+ send(run_method, "cd #{current_path} && rake handy:db:backup timestamp=#{timestamp} RAILS_ENV=#{stage} ")
12
+ get "#{deploy_to}/current/tmp/#{timestamp}.sql.gz","tmp/#{timestamp}.sql.gz"
13
+ system("rake handy:db:restore file='#{timestamp}.sql.gz'")
14
+ end
12
15
  end
13
- end
14
16
 
17
+ end
data/lib/handy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Handy
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Neeraj Singh