procman 1.5.1 → 1.6.0

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/proc_man.rb CHANGED
@@ -4,7 +4,7 @@ require 'proc_man/constraint'
4
4
 
5
5
  module ProcMan
6
6
 
7
- VERSION = '1.5.1'
7
+ VERSION = '1.6.0'
8
8
 
9
9
  class Error < StandardError; end
10
10
 
@@ -3,15 +3,15 @@
3
3
 
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  namespace :procman do
6
- task :start, :roles => :app do
6
+ task :start, :roles => fetch(:procman_roles, [:app]) do
7
7
  run procman_command(:start)
8
8
  end
9
9
 
10
- task :stop, :roles => :app do
10
+ task :stop, :roles => fetch(:procman_roles, [:app]) do
11
11
  run procman_command(:stop)
12
12
  end
13
13
 
14
- task :restart, :roles => :app do
14
+ task :restart, :roles => fetch(:procman_roles, [:app]) do
15
15
  run procman_command(:restart)
16
16
  end
17
17
 
@@ -71,5 +71,23 @@ module ProcMan
71
71
  end
72
72
  end
73
73
 
74
+ # A shortcut method for defining a set of RBG processes
75
+ def rbg(options = {})
76
+ options[:config_file] ||= "ProcessFile"
77
+ options[:environment] ||= "production"
78
+ start { system("bundle exec rbg start -c #{options[:config_file]} -E #{options[:environment]}") }
79
+ stop { system("bundle exec rbg stop -c #{options[:config_file]} -E #{options[:environment]}") }
80
+ restart { system("bundle exec rbg restart -c #{options[:config_file]} -E #{options[:environment]}") }
81
+ end
82
+
83
+ # A shortcut method for defining a unicorn
84
+ def unicorn(options = {})
85
+ options[:config_file] ||= "config/unicorn.rb"
86
+ options[:pid_path] ||= "log/unicorn.pid"
87
+ start { system("bundle exec unicorn -D -c #{options[:config_file]}") }
88
+ stop { system("kill `cat #{options[:pid_path]}`") if File.exist?(options[:pid_path]) }
89
+ restart { system("kill -USR2 `cat #{options[:pid_path]}`") if File.exist?(options[:pid_path]) }
90
+ end
91
+
74
92
  end
75
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
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: 2013-05-09 00:00:00.000000000 Z
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A very very simple library for starting/stopping/restarting processes
15
15
  for a Ruby application
@@ -55,3 +55,4 @@ specification_version: 3
55
55
  summary: A very very simple library for starting/stopping/restarting processes for
56
56
  a Ruby application
57
57
  test_files: []
58
+ has_rdoc: false