jettywrapper 1.1.0 → 1.2.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/History.txt +4 -0
- data/config/jetty.yml +5 -5
- data/lib/jettywrapper.rb +10 -9
- data/lib/jettywrapper/version.rb +1 -1
- data/spec/lib/jettywrapper_spec.rb +28 -2
- metadata +4 -4
data/History.txt
CHANGED
data/config/jetty.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
default:
|
2
|
+
jetty_port: 8983
|
3
|
+
java_opts:
|
4
|
+
- "-XX:MaxPermSize=128m"
|
5
|
+
- "-Xmx256m"
|
data/lib/jettywrapper.rb
CHANGED
@@ -56,7 +56,8 @@ class Jettywrapper
|
|
56
56
|
file ||= YAML.load_file(File.join(File.dirname(__FILE__),"../config/jetty.yml"))
|
57
57
|
#raise "Unable to load: #{file}" unless file
|
58
58
|
end
|
59
|
-
file.with_indifferent_access
|
59
|
+
config = file.with_indifferent_access
|
60
|
+
config[config_name] || config[:default]
|
60
61
|
end
|
61
62
|
|
62
63
|
|
@@ -210,8 +211,7 @@ class Jettywrapper
|
|
210
211
|
|
211
212
|
# What command is being run to invoke jetty?
|
212
213
|
def jetty_command
|
213
|
-
|
214
|
-
"java #{opts} -jar start.jar"
|
214
|
+
["java", java_variables, java_opts, "-jar", "start.jar"].flatten
|
215
215
|
end
|
216
216
|
|
217
217
|
def java_variables
|
@@ -231,7 +231,7 @@ class Jettywrapper
|
|
231
231
|
logger.debug "Starting jetty with these values: "
|
232
232
|
logger.debug "jetty_home: #{@jetty_home}"
|
233
233
|
logger.debug "solr_home: #{@solr_home}"
|
234
|
-
logger.debug "jetty_command: #{jetty_command}"
|
234
|
+
logger.debug "jetty_command: #{jetty_command.join(' ')}"
|
235
235
|
|
236
236
|
# Check to see if we can start.
|
237
237
|
# 1. If there is a pid, check to see if it is really running
|
@@ -263,7 +263,7 @@ class Jettywrapper
|
|
263
263
|
|
264
264
|
def process
|
265
265
|
@process ||= begin
|
266
|
-
process = ChildProcess.build(jetty_command)
|
266
|
+
process = ChildProcess.build(*jetty_command)
|
267
267
|
if self.quiet
|
268
268
|
process.io.stderr = File.open("jettywrapper.log", "w+")
|
269
269
|
process.io.stdout = process.io.stderr
|
@@ -289,11 +289,12 @@ class Jettywrapper
|
|
289
289
|
def stop
|
290
290
|
logger.debug "Instance stop method called for pid '#{pid}'"
|
291
291
|
if pid
|
292
|
-
process
|
293
|
-
|
294
|
-
|
292
|
+
if @process
|
293
|
+
@process.stop
|
294
|
+
else
|
295
|
+
Process.kill("KILL", pid) rescue nil
|
296
|
+
end
|
295
297
|
|
296
|
-
process.stop
|
297
298
|
begin
|
298
299
|
File.delete(pid_path)
|
299
300
|
rescue
|
data/lib/jettywrapper/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GEMVERSION = "1.
|
1
|
+
GEMVERSION = "1.2.0"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'rubygems'
|
3
3
|
|
4
|
-
module Hydra
|
5
4
|
describe Jettywrapper do
|
6
5
|
|
7
6
|
# JETTY1 =
|
@@ -16,6 +15,34 @@ module Hydra
|
|
16
15
|
:java_opts => ["-Xmx256mb"]
|
17
16
|
}
|
18
17
|
end
|
18
|
+
|
19
|
+
context "config" do
|
20
|
+
it "loads the application jetty.yml first" do
|
21
|
+
YAML.expects(:load_file).with('./config/jetty.yml').once.returns({})
|
22
|
+
config = Jettywrapper.load_config
|
23
|
+
end
|
24
|
+
|
25
|
+
it "falls back on the distributed jetty.yml" do
|
26
|
+
fallback_seq = sequence('fallback sequence')
|
27
|
+
YAML.expects(:load_file).in_sequence(fallback_seq).with('./config/jetty.yml').raises(Exception)
|
28
|
+
YAML.expects(:load_file).in_sequence(fallback_seq).with { |value| value =~ /jetty.yml/ }.returns({})
|
29
|
+
config = Jettywrapper.load_config
|
30
|
+
end
|
31
|
+
|
32
|
+
it "supports per-environment configuration" do
|
33
|
+
ENV['environment'] = 'test'
|
34
|
+
YAML.expects(:load_file).with('./config/jetty.yml').once.returns({:test => {:a => 2 }, :default => { :a => 1 }})
|
35
|
+
config = Jettywrapper.load_config
|
36
|
+
config[:a].should == 2
|
37
|
+
end
|
38
|
+
|
39
|
+
it "falls back on a 'default' environment configuration" do
|
40
|
+
ENV['environment'] = 'test'
|
41
|
+
YAML.expects(:load_file).with('./config/jetty.yml').once.returns({:default => { :a => 1 }})
|
42
|
+
config = Jettywrapper.load_config
|
43
|
+
config[:a].should == 1
|
44
|
+
end
|
45
|
+
end
|
19
46
|
|
20
47
|
context "instantiation" do
|
21
48
|
it "can be instantiated" do
|
@@ -223,4 +250,3 @@ module Hydra
|
|
223
250
|
end
|
224
251
|
end
|
225
252
|
end
|
226
|
-
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jettywrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bess Sadler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-29 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|