jettywrapper 1.4.2 → 1.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6643f2b0f438bad3aa59c4eb32e4e499dc0287cf
4
- data.tar.gz: 1edd1684c627c4631646c21709bcd2ab231fdf16
3
+ metadata.gz: b12e576520a009e9adb542062694b56d04b43c90
4
+ data.tar.gz: c8457e8e27503f15772bf164cd30dc066c1a06ec
5
5
  SHA512:
6
- metadata.gz: 2e23ce23bdd43c788090de4771a2db874233885835a6656900ebdd18e5abe9578102b39ab0519754fa1c110333cf77ef68e47987e6bb1f2ae577c6b9e3dc295b
7
- data.tar.gz: 5a91eeabf34b9fb225c4618a68717ce0534c4363b226eaa59b5a3316c97c4c6c2708dc25a7b1316da0a8dd0c98acac47f7a2566b37e0a481015abd1c8fcde16f
6
+ metadata.gz: b3c49d92028f96b1d15db964f83f6cf87bfe06c397262dcad6a1a2441644801eae350b28b92770f162492f57697a39253c7f67becb234e0517603ec70bea6193
7
+ data.tar.gz: 5c8bd9fda2a2017a27e3d82409d93051278034dd9290497e90b4c473bac2ba9db857a047e414ad97628c8cd591b4b2d88c3b5a0afab2ccd31019b0457e49bfb8
@@ -39,19 +39,16 @@ class Jettywrapper
39
39
  # Methods outside the class << self block must be called on Jettywrapper.instance, as instance methods.
40
40
  class << self
41
41
 
42
- def url=(url)
43
- @url = url
42
+ attr_writer :hydra_jetty_version, :url, :tmp_dir
43
+ def hydra_jetty_version
44
+ @hydra_jetty_version ||= 'v7.0.0'
44
45
  end
45
46
 
46
47
  def url
47
- @url ||= defined?(ZIP_URL) ? ZIP_URL : 'https://github.com/projecthydra/hydra-jetty/archive/v5.2.0.zip'
48
+ @url ||= defined?(ZIP_URL) ? ZIP_URL : "https://github.com/projecthydra/hydra-jetty/archive/#{hydra_jetty_version}.zip"
48
49
  @url
49
50
  end
50
51
 
51
- def tmp_dir=(dir)
52
- @tmp_dir = dir
53
- end
54
-
55
52
  def tmp_dir
56
53
  @tmp_dir ||= 'tmp'
57
54
  end
@@ -101,6 +98,8 @@ class Jettywrapper
101
98
 
102
99
  def reset_config
103
100
  @app_root = nil
101
+ @url = nil
102
+ @hydra_jetty_version = nil
104
103
  end
105
104
 
106
105
  def app_root
@@ -1,3 +1,3 @@
1
1
  class Jettywrapper
2
- VERSION = "1.4.2"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -15,7 +15,7 @@ module Hydra
15
15
  it "starts" do
16
16
  jetty_params = {
17
17
  :jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty"),
18
- :startup_wait => 45,
18
+ :startup_wait => 90,
19
19
  :java_opts => ["-Xmx256m", '-XX:MaxPermSize=256m'],
20
20
  :jetty_port => TEST_JETTY_PORTS.first
21
21
  }
@@ -39,7 +39,7 @@ module Hydra
39
39
  it "won't start if it's already running" do
40
40
  jetty_params = {
41
41
  :jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty"),
42
- :startup_wait => 45,
42
+ :startup_wait => 90,
43
43
  :java_opts => ["-Xmx256m", '-XX:MaxPermSize=256m'],
44
44
  :jetty_port => TEST_JETTY_PORTS.first
45
45
  }
@@ -19,9 +19,13 @@ require 'rubygems'
19
19
  end
20
20
 
21
21
  context "downloading" do
22
+ after do
23
+ Jettywrapper.reset_config
24
+ end
25
+
22
26
  context "with default file" do
23
27
  it "should download the zip file" do
24
- Jettywrapper.should_receive(:system).with('curl -L https://github.com/projecthydra/hydra-jetty/archive/v5.2.0.zip -o tmp/v5.2.0.zip').and_return(system ('true'))
28
+ Jettywrapper.should_receive(:system).with('curl -L https://github.com/projecthydra/hydra-jetty/archive/v7.0.0.zip -o tmp/v7.0.0.zip').and_return(system ('true'))
25
29
  Jettywrapper.download
26
30
  end
27
31
  end
@@ -33,6 +37,13 @@ require 'rubygems'
33
37
  Jettywrapper.url.should == 'http://example.co/file.zip'
34
38
  end
35
39
  end
40
+ context "specifying the version" do
41
+ it "should download the zip file" do
42
+ Jettywrapper.should_receive(:system).with('curl -L https://github.com/projecthydra/hydra-jetty/archive/v9.9.9.zip -o tmp/v9.9.9.zip').and_return(system ('true'))
43
+ Jettywrapper.hydra_jetty_version = 'v9.9.9'
44
+ Jettywrapper.download
45
+ end
46
+ end
36
47
  end
37
48
 
38
49
  context "unzip" do
@@ -42,10 +53,10 @@ require 'rubygems'
42
53
  context "with default file" do
43
54
  it "should download the zip file" do
44
55
  File.should_receive(:exists?).and_return(true)
45
- Jettywrapper.should_receive(:expanded_zip_dir).and_return('tmp/jetty_generator/hydra-jetty-v5.2.0')
46
- Jettywrapper.should_receive(:system).with('unzip -d tmp/jetty_generator -qo tmp/v5.2.0.zip').and_return(system ('true'))
56
+ Jettywrapper.should_receive(:expanded_zip_dir).and_return('tmp/jetty_generator/hydra-jetty-v7.0.0')
57
+ Jettywrapper.should_receive(:system).with('unzip -d tmp/jetty_generator -qo tmp/v7.0.0.zip').and_return(system ('true'))
47
58
  Jettywrapper.should_receive(:system).with('rm -r jetty').and_return(system ('true'))
48
- Jettywrapper.should_receive(:system).with('mv tmp/jetty_generator/hydra-jetty-v5.2.0 jetty').and_return(system ('true'))
59
+ Jettywrapper.should_receive(:system).with('mv tmp/jetty_generator/hydra-jetty-v7.0.0 jetty').and_return(system ('true'))
49
60
  Jettywrapper.unzip
50
61
  end
51
62
  end
@@ -86,7 +97,7 @@ require 'rubygems'
86
97
  its(:url) {should == 'http://example.com/bar.zip'}
87
98
  end
88
99
  context "when url is not set" do
89
- its(:url) {should == 'https://github.com/projecthydra/hydra-jetty/archive/v5.2.0.zip'}
100
+ its(:url) {should == 'https://github.com/projecthydra/hydra-jetty/archive/v7.0.0.zip'}
90
101
  end
91
102
  end
92
103
 
@@ -228,7 +239,7 @@ require 'rubygems'
228
239
  :jetty_home => '/tmp'
229
240
  }
230
241
  ts = Jettywrapper.configure(jetty_params)
231
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>5454))
242
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>5454))
232
243
  ts.stop
233
244
  ts.start
234
245
  ts.pid.should eql(5454)
@@ -241,7 +252,7 @@ require 'rubygems'
241
252
  }
242
253
  ts = Jettywrapper.configure(jetty_params)
243
254
  ts.stop
244
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>2323))
255
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2323))
245
256
  swp = Jettywrapper.start(jetty_params)
246
257
  swp.pid.should eql(2323)
247
258
  swp.pid_file.should eql("_tmp.pid")
@@ -253,7 +264,7 @@ require 'rubygems'
253
264
  # return true if it's running, otherwise return false
254
265
  it "can get the status for a given jetty instance" do
255
266
  # Don't actually start jetty, just fake it
256
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>12345))
267
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>12345))
257
268
 
258
269
  jetty_params = {
259
270
  :jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty")
@@ -267,7 +278,7 @@ require 'rubygems'
267
278
 
268
279
  it "can get the pid for a given jetty instance" do
269
280
  # Don't actually start jetty, just fake it
270
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>54321))
281
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>54321))
271
282
  jetty_params = {
272
283
  :jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty")
273
284
  }
@@ -282,7 +293,7 @@ require 'rubygems'
282
293
  jetty_params = {
283
294
  :jetty_home => '/tmp', :jetty_port => 8777
284
295
  }
285
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>2323))
296
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2323))
286
297
  swp = Jettywrapper.start(jetty_params)
287
298
  (File.file? swp.pid_path).should eql(true)
288
299
 
@@ -305,7 +316,7 @@ require 'rubygems'
305
316
  :jetty_home => '/tmp'
306
317
  }
307
318
  ts = Jettywrapper.configure(jetty_params)
308
- Jettywrapper.any_instance.stub(:process).and_return(stub('proc', :start => nil, :pid=>2222))
319
+ Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2222))
309
320
  ts.stop
310
321
  ts.pid_file?.should eql(false)
311
322
  ts.start
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jettywrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-09 00:00:00.000000000 Z
13
+ date: 2013-10-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger