jettywrapper 1.7.0 → 2.0.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.
@@ -1,9 +1,10 @@
1
1
  require 'spec_helper'
2
2
  require 'rubygems'
3
+ require 'fileutils'
3
4
 
4
5
  describe Jettywrapper do
5
-
6
- # JETTY1 =
6
+
7
+ # JETTY1 =
7
8
  before(:all) do
8
9
  @jetty_params = {
9
10
  :quiet => false,
@@ -12,7 +13,7 @@ require 'rubygems'
12
13
  :solr_home => "/path/to/solr",
13
14
  :startup_wait => 0,
14
15
  :java_opts => ["-Xmx256m"],
15
- :jetty_opts => ["/path/to/jetty_xml", "/path/to/other_jetty_xml"]
16
+ :jetty_opts => ["/path/to/jetty_xml", "/path/to/other_jetty_xml"]
16
17
  }
17
18
 
18
19
  Jettywrapper.logger.level=3
@@ -25,7 +26,8 @@ require 'rubygems'
25
26
  context "downloading" do
26
27
  context "with default file" do
27
28
  it "should download the zip file" do
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'))
29
+ FileUtils.rm "tmp/v8.1.1.zip", force: true
30
+ Jettywrapper.should_receive(:system).with('curl -L https://github.com/projecthydra/hydra-jetty/archive/v8.1.1.zip -o tmp/v8.1.1.zip').and_return(system ('true'))
29
31
  Jettywrapper.download
30
32
  end
31
33
  end
@@ -53,10 +55,10 @@ require 'rubygems'
53
55
  context "with default file" do
54
56
  it "should download the zip file" do
55
57
  File.should_receive(:exists?).and_return(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'))
58
+ Jettywrapper.should_receive(:expanded_zip_dir).and_return('tmp/jetty_generator/hydra-jetty-v8.1.1')
59
+ Jettywrapper.should_receive(:system).with('unzip -d tmp/jetty_generator -qo tmp/v8.1.1.zip').and_return(system ('true'))
58
60
  Jettywrapper.should_receive(:system).with('rm -r 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'))
61
+ Jettywrapper.should_receive(:system).with('mv tmp/jetty_generator/hydra-jetty-v8.1.1 jetty').and_return(system ('true'))
60
62
  Jettywrapper.unzip
61
63
  end
62
64
  end
@@ -97,7 +99,7 @@ require 'rubygems'
97
99
  its(:url) {should == 'http://example.com/bar.zip'}
98
100
  end
99
101
  context "when url is not set" do
100
- its(:url) {should == 'https://github.com/projecthydra/hydra-jetty/archive/v7.0.0.zip'}
102
+ its(:url) {should == 'https://github.com/projecthydra/hydra-jetty/archive/v8.1.1.zip'}
101
103
  end
102
104
  end
103
105
 
@@ -162,46 +164,46 @@ require 'rubygems'
162
164
  its(:app_root) {should == '.'}
163
165
  end
164
166
  end
165
-
167
+
166
168
  describe "env" do
167
169
  before do
168
170
  ENV.delete('JETTYWRAPPER_ENV')
169
171
  ENV.delete('RAILS_ENV')
170
172
  ENV.delete('environment')
171
173
  end
172
-
174
+
173
175
  it "should have a setter" do
174
176
  Jettywrapper.env = "abc"
175
- expect(Jettywrapper.env).to eq "abc"
177
+ expect(Jettywrapper.env).to eq "abc"
176
178
  end
177
-
179
+
178
180
  it "should load the ENV['JETTYWRAPPER_ENV']" do
179
181
  ENV['JETTYWRAPPER_ENV'] = 'test'
180
182
  ENV['RAILS_ENV'] = 'test2'
181
183
  ENV['environment'] = 'test3'
182
184
  expect(Jettywrapper.env).to eq "test"
183
185
  end
184
-
186
+
185
187
  it "should be the Rails environment" do
186
188
  Rails = double(env: 'test')
187
189
  expect(Jettywrapper.env).to eq "test"
188
190
  end
189
-
191
+
190
192
  it "should use the ENV['RAILS_ENV']" do
191
193
  ENV['RAILS_ENV'] = 'test2'
192
194
  ENV['environment'] = 'test3'
193
195
  expect(Jettywrapper.env).to eq "test2"
194
196
  end
195
-
197
+
196
198
  it "should load the ENV['environment']" do
197
199
  ENV['environment'] = 'test3'
198
200
  expect(Jettywrapper.env).to eq "test3"
199
201
  end
200
-
202
+
201
203
  it "should default to 'development'" do
202
204
  expect(Jettywrapper.env).to eq "development"
203
205
  end
204
-
206
+
205
207
  end
206
208
 
207
209
  context "config" do
@@ -245,7 +247,7 @@ require 'rubygems'
245
247
  config[:a].should == 1
246
248
  end
247
249
  end
248
-
250
+
249
251
  context "instantiation" do
250
252
  it "can be instantiated" do
251
253
  ts = Jettywrapper.instance
@@ -253,7 +255,7 @@ require 'rubygems'
253
255
  end
254
256
 
255
257
  it "can be configured with a params hash" do
256
- ts = Jettywrapper.configure(@jetty_params)
258
+ ts = Jettywrapper.configure(@jetty_params)
257
259
  ts.quiet.should == false
258
260
  ts.jetty_home.should == "/path/to/jetty"
259
261
  ts.port.should == @jetty_params[:jetty_port]
@@ -272,7 +274,7 @@ require 'rubygems'
272
274
  :jetty_opts => nil
273
275
  }
274
276
 
275
- ts = Jettywrapper.configure(jetty_params)
277
+ ts = Jettywrapper.configure(jetty_params)
276
278
  ts.quiet.should == true
277
279
  ts.jetty_home.should == "/path/to/jetty"
278
280
  ts.port.should == 8888
@@ -280,9 +282,9 @@ require 'rubygems'
280
282
  ts.startup_wait.should == 5
281
283
  ts.jetty_opts.should == []
282
284
  end
283
-
285
+
284
286
  it "passes all the expected values to jetty during startup" do
285
- ts = Jettywrapper.configure(@jetty_params)
287
+ ts = Jettywrapper.configure(@jetty_params)
286
288
  command = ts.jetty_command
287
289
  command.should include("-Dsolr.solr.home=#{@jetty_params[:solr_home]}")
288
290
  command.should include("-Djetty.port=#{@jetty_params[:jetty_port]}")
@@ -296,24 +298,24 @@ require 'rubygems'
296
298
  command = ts.jetty_command
297
299
  command.should include("-Dsolr.solr.home=/path\\ with\\ spaces/to/solr")
298
300
  end
299
-
301
+
300
302
  it "has a pid if it has been started" do
301
303
  jetty_params = {
302
304
  :jetty_home => '/tmp'
303
305
  }
304
- ts = Jettywrapper.configure(jetty_params)
306
+ ts = Jettywrapper.configure(jetty_params)
305
307
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>5454))
306
308
  ts.stop
307
309
  ts.start
308
310
  ts.pid.should eql(5454)
309
311
  ts.stop
310
312
  end
311
-
313
+
312
314
  it "can pass params to a start method" do
313
315
  jetty_params = {
314
316
  :jetty_home => '/tmp', :jetty_port => 8777
315
317
  }
316
- ts = Jettywrapper.configure(jetty_params)
318
+ ts = Jettywrapper.configure(jetty_params)
317
319
  ts.stop
318
320
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2323))
319
321
  swp = Jettywrapper.start(jetty_params)
@@ -321,11 +323,11 @@ require 'rubygems'
321
323
  swp.pid_file.should eql("_tmp_test.pid")
322
324
  swp.stop
323
325
  end
324
-
326
+
325
327
  it "can get the status for a given jetty instance" do
326
328
  # Don't actually start jetty, just fake it
327
329
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>12345))
328
-
330
+
329
331
  jetty_params = {
330
332
  :jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty")
331
333
  }
@@ -335,7 +337,7 @@ require 'rubygems'
335
337
  Jettywrapper.is_jetty_running?(jetty_params).should eql(true)
336
338
  Jettywrapper.stop(jetty_params)
337
339
  end
338
-
340
+
339
341
  it "can get the pid for a given jetty instance" do
340
342
  # Don't actually start jetty, just fake it
341
343
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>54321))
@@ -348,7 +350,7 @@ require 'rubygems'
348
350
  Jettywrapper.pid(jetty_params).should eql(54321)
349
351
  Jettywrapper.stop(jetty_params)
350
352
  end
351
-
353
+
352
354
  it "can pass params to a stop method" do
353
355
  jetty_params = {
354
356
  :jetty_home => '/tmp', :jetty_port => 8777
@@ -356,11 +358,11 @@ require 'rubygems'
356
358
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2323))
357
359
  swp = Jettywrapper.start(jetty_params)
358
360
  (File.file? swp.pid_path).should eql(true)
359
-
361
+
360
362
  swp = Jettywrapper.stop(jetty_params)
361
363
  (File.file? swp.pid_path).should eql(false)
362
364
  end
363
-
365
+
364
366
  describe "creates a pid file" do
365
367
  let(:ts) { Jettywrapper.configure(@jetty_params) }
366
368
  describe "when the environment isn't set" do
@@ -376,17 +378,17 @@ require 'rubygems'
376
378
  end
377
379
  end
378
380
  end
379
-
381
+
380
382
  it "knows where its pid file should be written" do
381
- ts = Jettywrapper.configure(@jetty_params)
383
+ ts = Jettywrapper.configure(@jetty_params)
382
384
  ts.pid_dir.should eql(File.expand_path("#{ts.base_path}/tmp/pids"))
383
385
  end
384
-
386
+
385
387
  it "writes a pid to a file when it is started" do
386
388
  jetty_params = {
387
389
  :jetty_home => '/tmp'
388
390
  }
389
- ts = Jettywrapper.configure(jetty_params)
391
+ ts = Jettywrapper.configure(jetty_params)
390
392
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2222))
391
393
  ts.stop
392
394
  ts.pid_file?.should eql(false)
@@ -396,49 +398,49 @@ require 'rubygems'
396
398
  pid_from_file = File.open( ts.pid_path ) { |f| f.gets.to_i }
397
399
  pid_from_file.should eql(2222)
398
400
  end
399
-
401
+
400
402
  end # end of instantiation context
401
-
403
+
402
404
  context "logging" do
403
405
  it "has a logger" do
404
- ts = Jettywrapper.configure(@jetty_params)
406
+ ts = Jettywrapper.configure(@jetty_params)
405
407
  ts.logger.should be_kind_of(Logger)
406
408
  end
407
-
408
- end # end of logging context
409
-
409
+
410
+ end # end of logging context
411
+
410
412
  context "wrapping a task" do
411
413
  it "wraps another method" do
412
414
  Jettywrapper.any_instance.stub(:start).and_return(true)
413
415
  Jettywrapper.any_instance.stub(:stop).and_return(true)
414
- error = Jettywrapper.wrap(@jetty_params) do
416
+ error = Jettywrapper.wrap(@jetty_params) do
415
417
  end
416
418
  error.should eql(false)
417
419
  end
418
-
420
+
419
421
  it "configures itself correctly when invoked via the wrap method" do
420
422
  Jettywrapper.any_instance.stub(:start).and_return(true)
421
423
  Jettywrapper.any_instance.stub(:stop).and_return(true)
422
- error = Jettywrapper.wrap(@jetty_params) do
423
- ts = Jettywrapper.instance
424
+ error = Jettywrapper.wrap(@jetty_params) do
425
+ ts = Jettywrapper.instance
424
426
  ts.quiet.should == @jetty_params[:quiet]
425
427
  ts.jetty_home.should == "/path/to/jetty"
426
428
  ts.port.should == @jetty_params[:jetty_port]
427
429
  ts.solr_home.should == "/path/to/solr"
428
- ts.startup_wait.should == 0
430
+ ts.startup_wait.should == 0
429
431
  end
430
432
  error.should eql(false)
431
433
  end
432
-
434
+
433
435
  it "captures any errors produced" do
434
436
  Jettywrapper.any_instance.stub(:start).and_return(true)
435
437
  Jettywrapper.any_instance.stub(:stop).and_return(true)
436
438
  Jettywrapper.instance.logger.should_receive(:error).with("*** Error starting jetty: this is an expected error message")
437
- expect { error = Jettywrapper.wrap(@jetty_params) do
439
+ expect { error = Jettywrapper.wrap(@jetty_params) do
438
440
  raise "this is an expected error message"
439
441
  end }.to raise_error "this is an expected error message"
440
442
  end
441
-
443
+
442
444
  end # end of wrapping context
443
445
 
444
446
  context "quiet mode", :quiet => true do
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,7 @@ if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
8
8
  SimpleCov.start
9
9
  end
10
10
 
11
- require 'rspec/autorun'
11
+ require 'rspec/its'
12
12
  require 'jettywrapper'
13
13
 
14
14
  RSpec.configure do |config|
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.7.0
4
+ version: 2.0.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: 2014-03-10 00:00:00.000000000 Z
13
+ date: 2015-01-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger
@@ -27,7 +27,7 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
- name: mediashelf-loggable
30
+ name: childprocess
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
@@ -41,7 +41,7 @@ dependencies:
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
- name: childprocess
44
+ name: i18n
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
@@ -55,35 +55,35 @@ dependencies:
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
- name: i18n
58
+ name: activesupport
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: '0'
63
+ version: 3.0.0
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: 3.0.0
71
71
  - !ruby/object:Gem::Dependency
72
- name: activesupport
72
+ name: rspec
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ">="
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 3.0.0
78
- type: :runtime
77
+ version: '2.99'
78
+ type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ">="
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: 3.0.0
84
+ version: '2.99'
85
85
  - !ruby/object:Gem::Dependency
86
- name: rspec
86
+ name: rspec-its
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
@@ -139,10 +139,13 @@ files:
139
139
  - CONTRIBUTING.md
140
140
  - Gemfile
141
141
  - History.txt
142
+ - LICENSE
142
143
  - README.textile
143
144
  - Rakefile
144
145
  - TODO.txt
145
146
  - config/jetty.yml
147
+ - gemfiles/rails4.1.gemfile
148
+ - gemfiles/rails4.2.beta.gemfile
146
149
  - jettywrapper.gemspec
147
150
  - lib/jettywrapper.rb
148
151
  - lib/jettywrapper/version.rb
@@ -152,7 +155,8 @@ files:
152
155
  - spec/spec_helper.rb
153
156
  - tasks/jettywrapper.rake
154
157
  homepage: https://github.com/projecthydra/jettywrapper
155
- licenses: []
158
+ licenses:
159
+ - APACHE2
156
160
  metadata: {}
157
161
  post_install_message:
158
162
  rdoc_options: []
@@ -170,9 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
174
  version: 1.3.6
171
175
  requirements: []
172
176
  rubyforge_project:
173
- rubygems_version: 2.2.2
177
+ rubygems_version: 2.4.3
174
178
  signing_key:
175
179
  specification_version: 4
176
180
  summary: Convenience tasks for working with jetty from within a ruby project.
177
181
  test_files: []
178
- has_rdoc: