passenger_monit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/Rakefile +10 -1
- data/VERSION +1 -1
- data/lib/passenger_monit.rb +11 -0
- data/lib/passenger_monit/pidfile_manager.rb +6 -4
- data/passenger_monit.gemspec +11 -10
- data/test/passenger_monit_test.rb +13 -0
- data/test/test_helper.rb +6 -0
- metadata +22 -38
data/README.md
CHANGED
@@ -10,6 +10,12 @@ the instance number.
|
|
10
10
|
[1]: http://www.modrails.com/ "Phusion Passenger"
|
11
11
|
[2]: http://mmonit.com/monit/ "Monit"
|
12
12
|
|
13
|
+
Installation
|
14
|
+
============
|
15
|
+
|
16
|
+
Add this line to your Gemfile:
|
17
|
+
|
18
|
+
gem 'passenger_monit', :group => :production
|
13
19
|
|
14
20
|
Example Monit configuration
|
15
21
|
===========================
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
|
-
require '
|
2
|
+
require 'rdoc/task'
|
3
|
+
require 'rake/testtask'
|
3
4
|
|
4
5
|
desc 'Default: create gemspec'
|
5
6
|
task :default => :gemspec
|
@@ -13,6 +14,14 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
13
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
14
15
|
end
|
15
16
|
|
17
|
+
desc 'Run unit tests.'
|
18
|
+
Rake::TestTask.new(:test) do |t|
|
19
|
+
t.libs << 'lib'
|
20
|
+
t.libs << 'test'
|
21
|
+
t.pattern = 'test/**/*_test.rb'
|
22
|
+
t.verbose = true
|
23
|
+
end
|
24
|
+
|
16
25
|
begin
|
17
26
|
require 'jeweler'
|
18
27
|
Jeweler::Tasks.new do |gem|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/passenger_monit.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
module PassengerMonit
|
2
|
+
|
3
|
+
mattr_accessor :pid_dir
|
4
|
+
@@pid_dir = '/var/tmp'
|
5
|
+
|
6
|
+
mattr_accessor :pid_file
|
7
|
+
@@pid_file = 'rack.*.pid'
|
8
|
+
|
2
9
|
class Railtie < Rails::Railtie
|
3
10
|
config.before_initialize do
|
4
11
|
if defined?(PhusionPassenger)
|
@@ -13,4 +20,8 @@ module PassengerMonit
|
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
23
|
+
|
24
|
+
def self.setup
|
25
|
+
yield self
|
26
|
+
end
|
16
27
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module PassengerMonit::PidfileManager
|
2
2
|
extend self
|
3
3
|
|
4
|
-
BASENAME = '/var/tmp/rack.*.pid'
|
5
|
-
|
6
4
|
def write_pid_file
|
7
5
|
pid = Process.pid
|
8
6
|
count = 1
|
@@ -25,7 +23,7 @@ module PassengerMonit::PidfileManager
|
|
25
23
|
break
|
26
24
|
end
|
27
25
|
end
|
28
|
-
pidfile ||=
|
26
|
+
pidfile ||= basename.sub('*', count.to_s)
|
29
27
|
File.open(pidfile, 'w') {|f| f.write(pid.to_s)}
|
30
28
|
end
|
31
29
|
|
@@ -39,9 +37,13 @@ module PassengerMonit::PidfileManager
|
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
40
|
+
def basename
|
41
|
+
"#{PassengerMonit.pid_dir}/#{PassengerMonit.pid_file}"
|
42
|
+
end
|
43
|
+
|
42
44
|
private
|
43
45
|
def go_over_pid_files
|
44
|
-
Dir[
|
46
|
+
Dir[basename].each do |file|
|
45
47
|
saved_pid = File.read(file).to_i
|
46
48
|
yield file, saved_pid
|
47
49
|
end
|
data/passenger_monit.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.1.
|
7
|
+
s.name = "passenger_monit"
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roman Shterenzon"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2013-02-22"
|
13
|
+
s.description = "Support for monitoring Passenger with Monit"
|
14
|
+
s.email = "romanbsd@yahoo.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
@@ -23,15 +23,16 @@ Gem::Specification.new do |s|
|
|
23
23
|
"init.rb",
|
24
24
|
"lib/passenger_monit.rb",
|
25
25
|
"lib/passenger_monit/pidfile_manager.rb",
|
26
|
-
"passenger_monit.gemspec"
|
26
|
+
"passenger_monit.gemspec",
|
27
|
+
"test/passenger_monit_test.rb",
|
28
|
+
"test/test_helper.rb"
|
27
29
|
]
|
28
|
-
s.homepage =
|
30
|
+
s.homepage = "http://github.com/romanbsd/passenger_monit"
|
29
31
|
s.require_paths = ["lib"]
|
30
|
-
s.rubygems_version =
|
31
|
-
s.summary =
|
32
|
+
s.rubygems_version = "1.8.23"
|
33
|
+
s.summary = "Support for monitoring Passenger with Monit"
|
32
34
|
|
33
35
|
if s.respond_to? :specification_version then
|
34
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
35
36
|
s.specification_version = 3
|
36
37
|
|
37
38
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class PassengerMonitTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_setup_block_configures
|
6
|
+
PassengerMonit.setup do |config|
|
7
|
+
assert_equal PassengerMonit, config
|
8
|
+
config.pid_dir = 'test-dir'
|
9
|
+
end
|
10
|
+
|
11
|
+
assert_equal 'test-dir', PassengerMonit.pid_dir
|
12
|
+
end
|
13
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,32 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: passenger_monit
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Roman Shterenzon
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2011-04-29 00:00:00 +03:00
|
18
|
-
default_executable:
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: Support for monitoring Passenger with Monit
|
22
15
|
email: romanbsd@yahoo.com
|
23
16
|
executables: []
|
24
|
-
|
25
17
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
28
19
|
- README.md
|
29
|
-
files:
|
20
|
+
files:
|
30
21
|
- MIT-LICENSE
|
31
22
|
- README.md
|
32
23
|
- Rakefile
|
@@ -35,37 +26,30 @@ files:
|
|
35
26
|
- lib/passenger_monit.rb
|
36
27
|
- lib/passenger_monit/pidfile_manager.rb
|
37
28
|
- passenger_monit.gemspec
|
38
|
-
|
29
|
+
- test/passenger_monit_test.rb
|
30
|
+
- test/test_helper.rb
|
39
31
|
homepage: http://github.com/romanbsd/passenger_monit
|
40
32
|
licenses: []
|
41
|
-
|
42
33
|
post_install_message:
|
43
34
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
35
|
+
require_paths:
|
46
36
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
38
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
version: "0"
|
55
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
44
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
- 0
|
62
|
-
version: "0"
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
63
49
|
requirements: []
|
64
|
-
|
65
50
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.
|
51
|
+
rubygems_version: 1.8.23
|
67
52
|
signing_key:
|
68
53
|
specification_version: 3
|
69
54
|
summary: Support for monitoring Passenger with Monit
|
70
55
|
test_files: []
|
71
|
-
|