jettywrapper 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b12e576520a009e9adb542062694b56d04b43c90
4
- data.tar.gz: c8457e8e27503f15772bf164cd30dc066c1a06ec
3
+ metadata.gz: 01602817841a3f916ff81e9320bebab07cedcd10
4
+ data.tar.gz: cce2362589cd1daca45205ac8acbc111018a199d
5
5
  SHA512:
6
- metadata.gz: b3c49d92028f96b1d15db964f83f6cf87bfe06c397262dcad6a1a2441644801eae350b28b92770f162492f57697a39253c7f67becb234e0517603ec70bea6193
7
- data.tar.gz: 5c8bd9fda2a2017a27e3d82409d93051278034dd9290497e90b4c473bac2ba9db857a047e414ad97628c8cd591b4b2d88c3b5a0afab2ccd31019b0457e49bfb8
6
+ metadata.gz: 149fef090d853b74b5d3baa6ae1b633ffcc79b53b7315d1ba4d36970cae281da50500acd91a168a6bd1626b8287abedb9057a728c26c03cba53c0795444ca649
7
+ data.tar.gz: d2fe99a58105b4f832520579d706ecb3e5970adf0fddac6c7566970b5097763c7504a9a497ae7c912c41666a9b7436ffaacbe7ff67745527923a0cc2f782d9aa
data/jettywrapper.gemspec CHANGED
@@ -32,8 +32,5 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency 'yard'#, '0.6.5' # Yard > 0.6.5 won't generate docs.
33
33
  # I don't know why & don't have time to
34
34
  # debug it right now
35
-
36
- s.add_development_dependency 'RedCloth'
37
-
38
35
  end
39
36
 
data/lib/jettywrapper.rb CHANGED
@@ -108,14 +108,12 @@ class Jettywrapper
108
108
  @app_root ||= APP_ROOT if defined?(APP_ROOT)
109
109
  @app_root ||= '.'
110
110
  end
111
-
112
- def load_config
113
- if defined? Rails
114
- config_name = Rails.env
115
- else
116
- config_name = ENV['environment']
117
- end
118
111
 
112
+ def env
113
+ defined?(Rails) ? Rails.env : ENV['environment']
114
+ end
115
+
116
+ def load_config(config_name = env)
119
117
  jetty_file = "#{app_root}/config/jetty.yml"
120
118
 
121
119
  unless File.exists?(jetty_file)
@@ -124,23 +122,23 @@ class Jettywrapper
124
122
  end
125
123
 
126
124
  begin
127
- @jetty_erb = ERB.new(IO.read(jetty_file)).result(binding)
128
- rescue Exception => e
125
+ jetty_erb = ERB.new(IO.read(jetty_file)).result(binding)
126
+ rescue
129
127
  raise("jetty.yml was found, but could not be parsed with ERB. \n#{$!.inspect}")
130
128
  end
131
129
 
132
130
  begin
133
- @jetty_yml = YAML::load(@jetty_erb)
134
- rescue StandardError => e
131
+ jetty_yml = YAML::load(jetty_erb)
132
+ rescue
135
133
  raise("jetty.yml was found, but could not be parsed.\n")
136
134
  end
137
135
 
138
- if @jetty_yml.nil? || !@jetty_yml.is_a?(Hash)
136
+ if jetty_yml.nil? || !jetty_yml.is_a?(Hash)
139
137
  raise("jetty.yml was found, but was blank or malformed.\n")
140
138
  end
141
139
 
142
- config = @jetty_yml.with_indifferent_access
143
- config[config_name] || config[:default]
140
+ config = jetty_yml.with_indifferent_access
141
+ config[config_name] || config['default'.freeze]
144
142
  end
145
143
 
146
144
 
@@ -414,10 +412,9 @@ class Jettywrapper
414
412
  # /usr/local/jetty1 => _usr_local_jetty1.pid
415
413
  def jetty_home_to_pid_file(jetty_home)
416
414
  begin
417
- jetty_home.gsub(/\//,'_') << ".pid"
418
- rescue
419
- raise "Couldn't make a pid file for jetty_home value #{jetty_home}"
420
- raise $!
415
+ jetty_home.gsub(/\//,'_') << "_#{self.class.env}" << ".pid"
416
+ rescue Exception => e
417
+ raise "Couldn't make a pid file for jetty_home value #{jetty_home}\n Caused by: #{e}"
421
418
  end
422
419
  end
423
420
 
@@ -1,3 +1,3 @@
1
1
  class Jettywrapper
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -175,6 +175,12 @@ require 'rubygems'
175
175
  config[:a].should == 2
176
176
  end
177
177
 
178
+ it "should take the env as an argument to load_config" do
179
+ IO.should_receive(:read).with('./config/jetty.yml').and_return("default:\n a: 1\nfoo:\n a: 2")
180
+ config = Jettywrapper.load_config('foo')
181
+ config[:a].should == 2
182
+ end
183
+
178
184
  it "falls back on a 'default' environment configuration" do
179
185
  ENV['environment'] = 'test'
180
186
  IO.should_receive(:read).with('./config/jetty.yml').and_return("default:\n a: 1")
@@ -255,7 +261,7 @@ require 'rubygems'
255
261
  Jettywrapper.any_instance.stub(:process).and_return(double('proc', :start => nil, :pid=>2323))
256
262
  swp = Jettywrapper.start(jetty_params)
257
263
  swp.pid.should eql(2323)
258
- swp.pid_file.should eql("_tmp.pid")
264
+ swp.pid_file.should eql("_tmp_test.pid")
259
265
  swp.stop
260
266
  end
261
267
 
@@ -303,7 +309,7 @@ require 'rubygems'
303
309
 
304
310
  it "knows what its pid file should be called" do
305
311
  ts = Jettywrapper.configure(@jetty_params)
306
- ts.pid_file.should eql("_path_to_jetty.pid")
312
+ ts.pid_file.should eql("_path_to_jetty_test.pid")
307
313
  end
308
314
 
309
315
  it "knows where its pid file should be written" do
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -10,132 +10,118 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-29 00:00:00.000000000 Z
13
+ date: 2014-01-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: mediashelf-loggable
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: childprocess
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: i18n
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '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
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: activesupport
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: 3.0.0
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: 3.0.0
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rake
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: yard
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- - !ruby/object:Gem::Dependency
128
- name: RedCloth
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - '>='
124
+ - - ">="
139
125
  - !ruby/object:Gem::Version
140
126
  version: '0'
141
127
  description: Spin up a jetty instance (e.g., the one at https://github.com/projecthydra/hydra-jetty)
@@ -146,10 +132,10 @@ executables: []
146
132
  extensions: []
147
133
  extra_rdoc_files: []
148
134
  files:
149
- - .gitignore
150
- - .gitmodules
151
- - .rspec
152
- - .travis.yml
135
+ - ".gitignore"
136
+ - ".gitmodules"
137
+ - ".rspec"
138
+ - ".travis.yml"
153
139
  - CONTRIBUTING.md
154
140
  - Gemfile
155
141
  - History.txt
@@ -174,17 +160,17 @@ require_paths:
174
160
  - lib
175
161
  required_ruby_version: !ruby/object:Gem::Requirement
176
162
  requirements:
177
- - - '>='
163
+ - - ">="
178
164
  - !ruby/object:Gem::Version
179
165
  version: '0'
180
166
  required_rubygems_version: !ruby/object:Gem::Requirement
181
167
  requirements:
182
- - - '>='
168
+ - - ">="
183
169
  - !ruby/object:Gem::Version
184
170
  version: 1.3.6
185
171
  requirements: []
186
172
  rubyforge_project:
187
- rubygems_version: 2.0.3
173
+ rubygems_version: 2.2.0
188
174
  signing_key:
189
175
  specification_version: 4
190
176
  summary: Convenience tasks for working with jetty from within a ruby project.