handy 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/handy/capistrano/delayed_job.rb +19 -16
- data/lib/handy/capistrano/remote_tasks.rb +30 -26
- data/lib/handy/capistrano/restart.rb +17 -13
- data/lib/handy/capistrano/restore_local.rb +15 -12
- data/lib/handy/version.rb +1 -1
- metadata +3 -3
@@ -1,21 +1,24 @@
|
|
1
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
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
|
-
|
3
|
+
# Usage:
|
4
|
+
#
|
5
|
+
# cap production remote 'tail -f log/production.log'
|
6
|
+
# cap production rake 'db:prod2staging'
|
7
7
|
|
8
|
-
|
9
|
-
task :use_sudo do
|
10
|
-
set :sudo_call, 'sudo'
|
11
|
-
end
|
8
|
+
set :sudo_call, ''
|
12
9
|
|
13
|
-
desc '
|
14
|
-
task :
|
15
|
-
|
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
|
22
|
-
task :
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 13
|
10
|
+
version: 0.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Neeraj Singh
|