super_mega_ultra_capistrano_extensions 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
1
  require "super_mega_ultra_capistrano_extensions/version"
2
2
 
3
- require "super_mega_ultra_capistrano_extensions/recipes/config"
4
3
  require "super_mega_ultra_capistrano_extensions/recipes/app_server"
4
+ require "super_mega_ultra_capistrano_extensions/recipes/config"
5
5
  require "super_mega_ultra_capistrano_extensions/recipes/deploy"
6
+ require "super_mega_ultra_capistrano_extensions/recipes/job_runner"
6
7
 
7
8
  module Capistrano
8
9
  class Command
@@ -7,7 +7,7 @@ Capistrano::Configuration.instance(:must_exist).load do
7
7
  app server is currently running. It will fail gracefully.
8
8
  DESC
9
9
  task :start, :roles => :web do
10
- run "#{app_server_init_script} start"
10
+ sudo "#{app_server_init_script} start"
11
11
  end
12
12
 
13
13
  desc <<-DESC
@@ -15,7 +15,7 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  app server is stopped. It will fail gracefully.
16
16
  DESC
17
17
  task :stop, :roles => :web do
18
- run "#{app_server_init_script} stop"
18
+ sudo "#{app_server_init_script} stop"
19
19
  end
20
20
 
21
21
  desc <<-DESC
@@ -23,7 +23,7 @@ Capistrano::Configuration.instance(:must_exist).load do
23
23
  if the app server is currently up or down.
24
24
  DESC
25
25
  task :restart, :roles => :web do
26
- run "#{app_server_init_script} restart"
26
+ sudo "#{app_server_init_script} restart"
27
27
  end
28
28
  end
29
29
  end
@@ -10,30 +10,37 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
  set :use_sudo, false
11
11
  set :rake, "bundle exec rake"
12
12
  set :config_files, fetch(:config_files) { [] }
13
+ set :job_runner?, fetch(:job_runner, false)
13
14
 
14
15
  namespace :deploy do
15
16
  desc <<-DESC
16
17
  Start the web application. This task currently:
17
18
  * starts app server
19
+ * starts job runner (if set)
18
20
  DESC
19
21
  task :start do
20
22
  app_server.start
23
+ job_runner.start if job_runner?
21
24
  end
22
25
 
23
26
  desc <<-DESC
24
27
  Stop the web application. This task currently:
25
28
  * stops app server
29
+ * stops job runner (if set)
26
30
  DESC
27
31
  task :stop do
28
32
  app_server.stop
33
+ job_runner.stop if job_runner?
29
34
  end
30
35
 
31
36
  desc <<-DESC
32
37
  Restart the web application. This task currently:
33
38
  * restarts app server
39
+ * restarts job runner (if set)
34
40
  DESC
35
41
  task :restart do
36
42
  app_server.restart
43
+ job_runner.restart if job_runner?
37
44
  end
38
45
  end
39
46
  end
@@ -0,0 +1,37 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ set :job_runner_init_script, fetch(:job_runner_init_script) { "/etc/init.d/#{application}_job_runner" }
3
+
4
+ namespace :job_runner do
5
+ desc <<-DESC
6
+ Start the job runner. This operation can be called even if the \
7
+ job runner is currently running. It will fail gracefully.
8
+ DESC
9
+ task :start, :roles => :web do
10
+ sudo "#{job_runner_init_script} start"
11
+ end
12
+
13
+ desc <<-DESC
14
+ Stop the job runner. This operation can be called even if the \
15
+ job runner is currently running. It will fail gracefully.
16
+ DESC
17
+ task :stop, :roles => :web do
18
+ sudo "#{job_runner_init_script} stop"
19
+ end
20
+
21
+ desc <<-DESC
22
+ Restart the job runner. This operation can be called regardless \
23
+ if the job runner is currently running or not.
24
+ DESC
25
+ task :restart, :roles => :web do
26
+ sudo "#{job_runner_init_script} restart"
27
+ end
28
+
29
+ desc <<-DESC
30
+ Check the status of the job runner. This operation will report \
31
+ on all the workers.
32
+ DESC
33
+ task :status, :roles => :web do
34
+ sudo "#{job_runner_init_script} status"
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module SuperMegaUltraCapistranoExtensions
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_mega_ultra_capistrano_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-31 00:00:00.000000000 Z
12
+ date: 2012-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -43,6 +43,7 @@ files:
43
43
  - lib/super_mega_ultra_capistrano_extensions/recipes/app_server.rb
44
44
  - lib/super_mega_ultra_capistrano_extensions/recipes/config.rb
45
45
  - lib/super_mega_ultra_capistrano_extensions/recipes/deploy.rb
46
+ - lib/super_mega_ultra_capistrano_extensions/recipes/job_runner.rb
46
47
  - lib/super_mega_ultra_capistrano_extensions/version.rb
47
48
  - super_mega_ultra_capistrano_extensions.gemspec
48
49
  homepage: http://github.com/everydayhero/super_mega_ultra_capistrano_extensions