quick_utils 0.0.3 → 0.0.4
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/quick_utils/rails_daemon.rb +4 -1
- data/lib/quick_utils/version.rb +1 -1
- data/lib/quick_utils/watcher.rb +2 -2
- metadata +51 -29
@@ -20,7 +20,7 @@ module QuickUtils
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize(args)
|
23
|
-
@options = {:worker_count => 1, :environment => :development, :delay => 5}
|
23
|
+
@options = {:worker_count => 1, :environment => :development, :delay => 5, :stage => :development}
|
24
24
|
|
25
25
|
optparse = OptionParser.new do |opts|
|
26
26
|
opts.banner = "Usage: #{File.basename($0)} [options] start|stop|restart|run"
|
@@ -41,6 +41,9 @@ module QuickUtils
|
|
41
41
|
opts.on('-d', '--delay=D', "Delay between rounds of work (seconds)") do |d|
|
42
42
|
@options[:delay] = d
|
43
43
|
end
|
44
|
+
opts.on('-s', '--stage=NAME', "Stage ([development]/staging/production)") do |s|
|
45
|
+
@options[:stage] = s
|
46
|
+
end
|
44
47
|
end
|
45
48
|
|
46
49
|
# If no arguments, give help screen
|
data/lib/quick_utils/version.rb
CHANGED
data/lib/quick_utils/watcher.rb
CHANGED
@@ -14,7 +14,7 @@ module QuickUtils
|
|
14
14
|
|
15
15
|
while true
|
16
16
|
# get num thins running
|
17
|
-
thin_num = `ps -ef | grep "thin" | grep "#{@@main_proc}" | grep -v "grep" | wc | awk '{print $1}'`.to_i
|
17
|
+
thin_num = `ps -ef | grep "thin" | grep "#{@@main_proc}-#{@options[:stage].to_s}" | grep -v "grep" | wc | awk '{print $1}'`.to_i
|
18
18
|
needs_restart = false
|
19
19
|
@@processes.each do |proc|
|
20
20
|
pnum = `ps -ef | grep "#{proc}" | grep -v "grep" | wc | awk '{print $1}'`.to_i
|
@@ -22,7 +22,7 @@ module QuickUtils
|
|
22
22
|
end
|
23
23
|
if thin_num == 0 || needs_restart
|
24
24
|
logger.info("Restarting #{main_proc} now...");
|
25
|
-
system "cd #{@@rails_root}; bundle exec script/restart;"
|
25
|
+
system "cd #{@@rails_root}; bundle exec script/restart #{@options[:stage].to_s};"
|
26
26
|
end
|
27
27
|
sleep @options[:delay]
|
28
28
|
end
|
metadata
CHANGED
@@ -1,34 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: quick_utils
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Alan Graham
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-06-22 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: daemons
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
22
32
|
type: :runtime
|
23
|
-
|
24
|
-
version_requirements: *70287846060700
|
33
|
+
version_requirements: *id001
|
25
34
|
description: Utility classes for a rails-deployed application
|
26
|
-
email:
|
35
|
+
email:
|
27
36
|
- alangraham5@gmail.com
|
28
37
|
executables: []
|
38
|
+
|
29
39
|
extensions: []
|
40
|
+
|
30
41
|
extra_rdoc_files: []
|
31
|
-
|
42
|
+
|
43
|
+
files:
|
32
44
|
- .gitignore
|
33
45
|
- Gemfile
|
34
46
|
- Rakefile
|
@@ -39,28 +51,38 @@ files:
|
|
39
51
|
- lib/quick_utils/version.rb
|
40
52
|
- lib/quick_utils/watcher.rb
|
41
53
|
- quick_utils.gemspec
|
42
|
-
homepage:
|
54
|
+
homepage: ""
|
43
55
|
licenses: []
|
56
|
+
|
44
57
|
post_install_message:
|
45
58
|
rdoc_options: []
|
46
|
-
|
59
|
+
|
60
|
+
require_paths:
|
47
61
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
63
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
72
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
60
80
|
requirements: []
|
81
|
+
|
61
82
|
rubyforge_project: quick_utils
|
62
|
-
rubygems_version: 1.8.
|
83
|
+
rubygems_version: 1.8.17
|
63
84
|
signing_key:
|
64
85
|
specification_version: 3
|
65
86
|
summary: Utility classes for a rails-deployed application
|
66
87
|
test_files: []
|
88
|
+
|