jettywrapper 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 1.3.1
2
+ It should use APP_ROOT constant throughout, not APP_ROOT environment variable.
3
+
1
4
  1.2.1
2
5
  Fixed :restart task
3
6
 
data/jettywrapper.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  s.name = "jettywrapper"
8
8
  s.version = GEMVERSION
9
9
  s.platform = Gem::Platform::RUBY
10
- s.authors = ["Bess Sadler"]
11
- s.email = ["bess@stanford.edu"]
10
+ s.authors = ["Chris Beer", "Justin Coyne", "Bess Sadler"]
11
+ s.email = ["hydra-tech@googlegroups.com"]
12
12
  s.homepage = "https://github.com/projecthydra/jettywrapper"
13
13
  s.summary = %q{Convenience tasks for working with jetty from within a ruby project.}
14
14
  s.description = %q{Spin up a jetty instance (e.g., the one at https://github.com/projecthydra/hydra-jetty) and wrap test in it. This lets us run tests against a real copy of solr and fedora.}
@@ -37,6 +37,6 @@ Gem::Specification.new do |s|
37
37
  # debug it right now
38
38
 
39
39
  s.add_development_dependency 'RedCloth'
40
-
40
+
41
41
  end
42
42
 
data/lib/jettywrapper.rb CHANGED
@@ -28,27 +28,36 @@ class Jettywrapper
28
28
 
29
29
  # configure the singleton with some defaults
30
30
  def initialize(params = {})
31
- if defined?(Rails.root)
32
- @base_path = Rails.root
33
- else
34
- @base_path = "."
35
- end
36
-
31
+ self.base_path = self.class.app_root
37
32
  logger.debug 'Initializing jettywrapper'
38
33
  end
34
+
39
35
 
40
36
  # Methods inside of the class << self block can be called directly on Jettywrapper, as class methods.
41
37
  # Methods outside the class << self block must be called on Jettywrapper.instance, as instance methods.
42
38
  class << self
39
+
40
+ def reset_config
41
+ @app_root = nil
42
+ end
43
+
44
+ def app_root
45
+ return @app_root if @app_root
46
+ if defined?(Rails.root)
47
+ @app_root = Rails.root
48
+ elsif defined?(APP_ROOT)
49
+ @app_root = APP_ROOT
50
+ else
51
+ @app_root = '.'
52
+ end
53
+ @app_root
54
+ end
43
55
 
44
56
  def load_config
45
57
  if defined? Rails
46
58
  config_name = Rails.env
47
- app_root = Rails.root
48
59
  else
49
60
  config_name = ENV['environment']
50
- app_root = ENV['APP_ROOT']
51
- app_root ||= '.'
52
61
  end
53
62
 
54
63
  jetty_file = "#{app_root}/config/jetty.yml"
@@ -276,7 +285,7 @@ class Jettywrapper
276
285
  begin
277
286
  f = File.new(pid_path, "w")
278
287
  rescue Errno::ENOENT, Errno::EACCES
279
- f = File.new(File.join(@base_path,'tmp',pid_file),"w")
288
+ f = File.new(File.join(base_path,'tmp',pid_file),"w")
280
289
  end
281
290
  f.puts "#{process.pid}"
282
291
  f.close
@@ -363,7 +372,7 @@ class Jettywrapper
363
372
 
364
373
  # The directory where the pid_file will be written
365
374
  def pid_dir
366
- File.expand_path(File.join(@base_path,'tmp','pids'))
375
+ File.expand_path(File.join(base_path,'tmp','pids'))
367
376
  end
368
377
 
369
378
  # Check to see if there is a pid file already
@@ -1 +1 @@
1
- GEMVERSION = "1.3.0"
1
+ GEMVERSION = "1.3.1"
@@ -4,7 +4,6 @@ require 'rubygems'
4
4
  describe Jettywrapper do
5
5
 
6
6
  # JETTY1 =
7
-
8
7
  before(:all) do
9
8
  @jetty_params = {
10
9
  :quiet => false,
@@ -17,6 +16,38 @@ require 'rubygems'
17
16
  }
18
17
  end
19
18
 
19
+ context "app_root" do
20
+ subject {Jettywrapper}
21
+ context "When rails is present" do
22
+ before do
23
+ Jettywrapper.reset_config
24
+ class Rails
25
+ def self.root
26
+ 'rails_root'
27
+ end
28
+ end
29
+ end
30
+ after do
31
+ Object.send(:remove_const, :Rails)
32
+ Jettywrapper.reset_config
33
+ end
34
+ its(:app_root) {should == 'rails_root'}
35
+ end
36
+ context "When APP_ROOT is set" do
37
+ before do
38
+ APP_ROOT = 'custom_root'
39
+ end
40
+ after do
41
+ Object.send(:remove_const, :APP_ROOT)
42
+ Jettywrapper.reset_config
43
+ end
44
+ its(:app_root) {should == 'custom_root'}
45
+ end
46
+ context "otherwise" do
47
+ its(:app_root) {should == '.'}
48
+ end
49
+ end
50
+
20
51
  context "config" do
21
52
  it "loads the application jetty.yml first" do
22
53
  IO.expects(:read).with('./config/jetty.yml').once.returns("default:\n")
metadata CHANGED
@@ -1,184 +1,180 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jettywrapper
3
- version: !ruby/object:Gem::Version
4
- version: 1.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
5
  prerelease:
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 1
10
+ version: 1.3.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
13
+ - Chris Beer
14
+ - Justin Coyne
8
15
  - Bess Sadler
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2012-07-10 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
15
24
  name: logger
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
25
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: mediashelf-loggable
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
38
35
  type: :runtime
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: mediashelf-loggable
39
39
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: childprocess
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
54
49
  type: :runtime
50
+ requirement: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: childprocess
55
53
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: i18n
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
70
63
  type: :runtime
64
+ requirement: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: i18n
71
67
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: activesupport
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: 3.0.0
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
86
77
  type: :runtime
78
+ requirement: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: activesupport
87
81
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
82
+ version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 7
88
+ segments:
89
+ - 3
90
+ - 0
91
+ - 0
93
92
  version: 3.0.0
94
- - !ruby/object:Gem::Dependency
93
+ type: :runtime
94
+ requirement: *id005
95
+ - !ruby/object:Gem::Dependency
95
96
  name: rspec
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - <
100
- - !ruby/object:Gem::Version
101
- version: '2.0'
102
- type: :development
103
97
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
98
+ version_requirements: &id006 !ruby/object:Gem::Requirement
105
99
  none: false
106
- requirements:
100
+ requirements:
107
101
  - - <
108
- - !ruby/object:Gem::Version
109
- version: '2.0'
110
- - !ruby/object:Gem::Dependency
111
- name: mocha
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 2
106
+ - 0
107
+ version: "2.0"
118
108
  type: :development
109
+ requirement: *id006
110
+ - !ruby/object:Gem::Dependency
111
+ name: mocha
119
112
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: rake
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
113
+ version_requirements: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
134
122
  type: :development
123
+ requirement: *id007
124
+ - !ruby/object:Gem::Dependency
125
+ name: rake
135
126
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: yard
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - '='
148
- - !ruby/object:Gem::Version
149
- version: 0.6.5
127
+ version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
150
136
  type: :development
137
+ requirement: *id008
138
+ - !ruby/object:Gem::Dependency
139
+ name: yard
151
140
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - '='
156
- - !ruby/object:Gem::Version
141
+ version_requirements: &id009 !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - "="
145
+ - !ruby/object:Gem::Version
146
+ hash: 13
147
+ segments:
148
+ - 0
149
+ - 6
150
+ - 5
157
151
  version: 0.6.5
158
- - !ruby/object:Gem::Dependency
159
- name: RedCloth
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
152
  type: :development
153
+ requirement: *id009
154
+ - !ruby/object:Gem::Dependency
155
+ name: RedCloth
167
156
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- description: Spin up a jetty instance (e.g., the one at https://github.com/projecthydra/hydra-jetty)
175
- and wrap test in it. This lets us run tests against a real copy of solr and fedora.
176
- email:
177
- - bess@stanford.edu
157
+ version_requirements: &id010 !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
165
+ version: "0"
166
+ type: :development
167
+ requirement: *id010
168
+ description: Spin up a jetty instance (e.g., the one at https://github.com/projecthydra/hydra-jetty) and wrap test in it. This lets us run tests against a real copy of solr and fedora.
169
+ email:
170
+ - hydra-tech@googlegroups.com
178
171
  executables: []
172
+
179
173
  extensions: []
174
+
180
175
  extra_rdoc_files: []
181
- files:
176
+
177
+ files:
182
178
  - .gitignore
183
179
  - .gitmodules
184
180
  - .rvmrc
@@ -196,31 +192,41 @@ files:
196
192
  - spec/lib/jettywrapper_spec.rb
197
193
  - spec/spec_helper.rb
198
194
  - tasks/jettywrapper.rake
195
+ has_rdoc: true
199
196
  homepage: https://github.com/projecthydra/jettywrapper
200
197
  licenses: []
198
+
201
199
  post_install_message:
202
200
  rdoc_options: []
203
- require_paths:
201
+
202
+ require_paths:
204
203
  - lib
205
- required_ruby_version: !ruby/object:Gem::Requirement
204
+ required_ruby_version: !ruby/object:Gem::Requirement
206
205
  none: false
207
- requirements:
208
- - - ! '>='
209
- - !ruby/object:Gem::Version
210
- version: '0'
211
- segments:
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ hash: 3
210
+ segments:
212
211
  - 0
213
- hash: 463771772989334870
214
- required_rubygems_version: !ruby/object:Gem::Requirement
212
+ version: "0"
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
214
  none: false
216
- requirements:
217
- - - ! '>='
218
- - !ruby/object:Gem::Version
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ hash: 23
219
+ segments:
220
+ - 1
221
+ - 3
222
+ - 6
219
223
  version: 1.3.6
220
224
  requirements: []
225
+
221
226
  rubyforge_project:
222
- rubygems_version: 1.8.24
227
+ rubygems_version: 1.6.2
223
228
  signing_key:
224
229
  specification_version: 3
225
230
  summary: Convenience tasks for working with jetty from within a ruby project.
226
231
  test_files: []
232
+