mongrel_config 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +3 -3
  2. metadata +3 -4
  3. data/lib/mongrel_config/app.rb~ +0 -156
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ setup_rdoc ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
15
15
  desc "Does a full compile, test run"
16
16
  task :default => [:test, :package]
17
17
 
18
- version="0.2"
18
+ version="0.2.1"
19
19
  name="mongrel_config"
20
20
 
21
21
  setup_gem(name, version) do |spec|
@@ -23,8 +23,8 @@ setup_gem(name, version) do |spec|
23
23
  spec.description = spec.summary
24
24
  spec.test_file = "test/test_config.rb"
25
25
  spec.author="Zed A. Shaw"
26
- spec.add_dependency('mongrel', '>= 0.3.10')
27
- spec.add_dependency('gem_plugin', '>= 0.1')
26
+ spec.add_dependency('mongrel', '>= 0.3.10.1')
27
+ spec.add_dependency('gem_plugin', '>= 0.2')
28
28
  spec.add_dependency('camping', '>= 1.3')
29
29
  spec.files += Dir.glob("resources/**/*")
30
30
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: mongrel_config
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.2"
6
+ version: 0.2.1
7
7
  date: 2006-03-12 00:00:00 -05:00
8
8
  summary: Mongrel plugin that gives you web based config tool using Camping
9
9
  require_paths:
@@ -35,7 +35,6 @@ files:
35
35
  - test/test_config.rb
36
36
  - lib/mongrel_config
37
37
  - lib/mongrel_config/app.rb
38
- - lib/mongrel_config/app.rb~
39
38
  - lib/mongrel_config/init.rb
40
39
  - tools/rakehelp.rb
41
40
  - resources/defaults.yaml
@@ -69,7 +68,7 @@ dependencies:
69
68
  requirements:
70
69
  - - ">="
71
70
  - !ruby/object:Gem::Version
72
- version: 0.3.10
71
+ version: 0.3.10.1
73
72
  version:
74
73
  - !ruby/object:Gem::Dependency
75
74
  name: gem_plugin
@@ -78,7 +77,7 @@ dependencies:
78
77
  requirements:
79
78
  - - ">="
80
79
  - !ruby/object:Gem::Version
81
- version: "0.1"
80
+ version: "0.2"
82
81
  version:
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: camping
@@ -1,156 +0,0 @@
1
- require 'erb'
2
-
3
- Camping.goes :Configure
4
-
5
- module Configure::Controllers
6
- class Index < R '/'
7
- def get
8
- render :show
9
- end
10
- end
11
-
12
- class Start < R '/start'
13
- def get
14
- render :start
15
- end
16
-
17
- def post
18
- @results = `mongrel_rails start -d -p #{input.port} -e #{input.env} -n #{input.num_procs} -a #{input.address}`
19
- render :start_done
20
- end
21
- end
22
-
23
- class Kill < R '/kill/(\w+)'
24
-
25
- def get(signal)
26
- if _running?
27
- @signal = signal.upcase
28
- pid = open($PID_FILE) {|f| f.read }
29
- begin
30
- Process.kill(@signal, pid.to_i)
31
- @results = "Mongrel sent PID #{pid} signal #{@signal}."
32
- rescue
33
- puts "ERROR: #$!"
34
- @results = "Failed to signal the Mongrel process. Maybe it is not running?<p>#$!</p>"
35
- end
36
- else
37
- @results = "Mongrel does not seem to be running. Maybe delete the pid file #{$PID_FILE} or start again."
38
- end
39
-
40
- render :kill
41
- end
42
- end
43
-
44
-
45
- class Stop < R '/stop'
46
- def get
47
- render :stop
48
- end
49
- end
50
-
51
- class Logs < R '/logs'
52
- def get
53
- @log_files = Dir.glob("log/**/*")
54
- render :logs
55
- end
56
- end
57
-
58
- end
59
-
60
-
61
- module Configure::Views
62
- def layout
63
- body_content = yield
64
- currently_running = _running?
65
- pid = _pid
66
- open(GemPlugin::Manager.instance.resource("mongrel_config", "/index.html")) do |f|
67
- template = ERB.new(f.read)
68
- self << template.result(binding)
69
- end
70
- end
71
-
72
- def show
73
- div do
74
- h2 { "Status" }
75
- if _running?
76
- p { "Currently running with PID #{_pid}." }
77
- else
78
- p { "Mongrel is not running." }
79
- end
80
- end
81
- end
82
-
83
- def start
84
- div do
85
- form :action => "/start", :method => "POST" do
86
- p { span { "Port:" }; input :name => "port", :value => "4000" }
87
- p { span { "Environment:" }; input :name => "env", :value => "development" }
88
- p { span { "Address:" }; input :name => "address", :value => "0.0.0.0" }
89
- p { span { "Number Processors:" }; input :name => "num_procs", :value => "20" }
90
- input :type => "submit", :value => "START"
91
- end
92
- end
93
- end
94
-
95
- def start_done
96
- div do
97
- p { @results }
98
- end
99
- end
100
-
101
- def kill
102
- div do
103
- p { @results }
104
-
105
- case @signal
106
- when "HUP":
107
- p { "A reload (HUP) does not stop the process, but may not be complete." }
108
- when "TERM":
109
- p { "Stopped with TERM signal. The process should exit shortly, but only after processing pending requests." }
110
- when "USR2":
111
- p { "Complete restart (USR2) may take a little while. Check status in a few seconds or read logs." }
112
- when "KILL":
113
- p { "Process was violently stopped (KILL) so pending requests will be lost." }
114
- end
115
- end
116
- end
117
-
118
- def stop
119
- if _running?
120
- ul do
121
- li { a "Stop (TERM)", :href => "/kill/term" }
122
- li { a "Reload (HUP)", :href => "/kill/hup" }
123
- li { a "Restart (USR2)", :href => "/kill/usr2" }
124
- li { a "Kill (KILL)", :href => "/kill/kill" }
125
- end
126
- else
127
- p { "Mongrel does not appear to be running (no PID file at #$PID_FILE)." }
128
- end
129
- end
130
-
131
- def logs
132
- div do
133
- h2 { "Logs" }
134
- table do
135
- tr do
136
- th { "File"}; th { "Bytes" }; th { "Last Modified" }
137
- end
138
- @log_files.each do |file|
139
- tr do
140
- td { a file, :href => "../#{file}" }
141
- td { File.size file }
142
- td { File.mtime file }
143
- end
144
- end
145
- end
146
- end
147
- end
148
-
149
- def _running?
150
- File.exist? $PID_FILE
151
- end
152
-
153
- def _pid
154
- open($PID_FILE) {|f| f.read } if _running?
155
- end
156
- end