Skip to content

Commit 836c59b

Browse files
committed
Version updates
This change updates the versions of Ruby and the dependencies. This time round both rubocop and rspec required extensive changes for compatibility.
1 parent 216b814 commit 836c59b

20 files changed

+143
-151
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
language: ruby
33
rvm:
4-
- 2.1.1
4+
- 2.1.2
55
- 1.9.3-p545
66
before_script: "if [[ $TRAVIS_RUBY_VERSION != '1.9.3-p545' || $TRAVIS_SECURE_ENV_VARS != 'true' ]]; then unset CODECLIMATE_REPO_TOKEN; fi"
77
install: bundle install --deployment --without debug

Gemfile.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ GEM
77
simplecov (>= 0.7.1, < 1.0.0)
88
crack (0.4.2)
99
safe_yaml (~> 1.0.0)
10-
debugger-ruby_core_source (1.3.2)
10+
debugger-ruby_core_source (1.3.5)
1111
diff-lcs (1.2.5)
1212
docile (1.1.3)
1313
json (1.8.1)
14-
multi_json (1.9.3)
14+
multi_json (1.10.1)
1515
parser (2.1.9)
1616
ast (>= 1.1, < 3.0)
1717
slop (~> 3.4, >= 3.4.5)
1818
powerpack (0.0.9)
1919
rainbow (2.0.0)
20-
rake (10.3.1)
21-
redcarpet (3.1.1)
22-
rspec (3.0.0.beta2)
23-
rspec-core (= 3.0.0.beta2)
24-
rspec-expectations (= 3.0.0.beta2)
25-
rspec-mocks (= 3.0.0.beta2)
26-
rspec-core (3.0.0.beta2)
27-
rspec-support (= 3.0.0.beta2)
28-
rspec-expectations (3.0.0.beta2)
20+
rake (10.3.2)
21+
redcarpet (3.1.2)
22+
rspec (3.0.0.rc1)
23+
rspec-core (= 3.0.0.rc1)
24+
rspec-expectations (= 3.0.0.rc1)
25+
rspec-mocks (= 3.0.0.rc1)
26+
rspec-core (3.0.0.rc1)
27+
rspec-support (= 3.0.0.rc1)
28+
rspec-expectations (3.0.0.rc1)
2929
diff-lcs (>= 1.2.0, < 2.0)
30-
rspec-support (= 3.0.0.beta2)
31-
rspec-mocks (3.0.0.beta2)
32-
rspec-support (= 3.0.0.beta2)
33-
rspec-support (3.0.0.beta2)
34-
rubocop (0.21.0)
30+
rspec-support (= 3.0.0.rc1)
31+
rspec-mocks (3.0.0.rc1)
32+
rspec-support (= 3.0.0.rc1)
33+
rspec-support (3.0.0.rc1)
34+
rubocop (0.22.0)
3535
json (>= 1.7.7, < 2)
3636
parser (~> 2.1.9)
3737
powerpack (~> 0.0.6)
@@ -42,7 +42,7 @@ GEM
4242
rake (>= 0.8.1)
4343
ruby-debug-ide (0.4.22)
4444
rake (>= 0.8.1)
45-
ruby-progressbar (1.4.2)
45+
ruby-progressbar (1.5.1)
4646
rubyzip (1.1.3)
4747
safe_yaml (1.0.3)
4848
simplecov (0.8.2)
@@ -52,8 +52,8 @@ GEM
5252
simplecov-html (0.8.0)
5353
slop (3.5.0)
5454
tee (1.0.0)
55-
webmock (1.17.4)
56-
addressable (>= 2.2.7)
55+
webmock (1.18.0)
56+
addressable (>= 2.3.6)
5757
crack (>= 0.3.2)
5858
yard (0.8.7.4)
5959

java-buildpack.iml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,32 +274,32 @@
274274
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.6.2, rbenv: 1.9.3-p545) [gem]" level="application" />
275275
<orderEntry type="library" scope="PROVIDED" name="codeclimate-test-reporter (v0.3.0, rbenv: 1.9.3-p545) [gem]" level="application" />
276276
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, rbenv: 1.9.3-p545) [gem]" level="application" />
277-
<orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.3.2, rbenv: 1.9.3-p545) [gem]" level="application" />
277+
<orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.3.5, rbenv: 1.9.3-p545) [gem]" level="application" />
278278
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, rbenv: 1.9.3-p545) [gem]" level="application" />
279279
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.3, rbenv: 1.9.3-p545) [gem]" level="application" />
280280
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, rbenv: 1.9.3-p545) [gem]" level="application" />
281-
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.9.3, rbenv: 1.9.3-p545) [gem]" level="application" />
281+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, rbenv: 1.9.3-p545) [gem]" level="application" />
282282
<orderEntry type="library" scope="PROVIDED" name="parser (v2.1.9, rbenv: 1.9.3-p545) [gem]" level="application" />
283283
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.0.9, rbenv: 1.9.3-p545) [gem]" level="application" />
284284
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.0.0, rbenv: 1.9.3-p545) [gem]" level="application" />
285-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.1, rbenv: 1.9.3-p545) [gem]" level="application" />
286-
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.1.1, rbenv: 1.9.3-p545) [gem]" level="application" />
287-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
288-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
289-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
290-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
291-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
292-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.21.0, rbenv: 1.9.3-p545) [gem]" level="application" />
285+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, rbenv: 1.9.3-p545) [gem]" level="application" />
286+
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.1.2, rbenv: 1.9.3-p545) [gem]" level="application" />
287+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.0.0.rc1, rbenv: 1.9.3-p545) [gem]" level="application" />
288+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.0.0.rc1, rbenv: 1.9.3-p545) [gem]" level="application" />
289+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.0.0.rc1, rbenv: 1.9.3-p545) [gem]" level="application" />
290+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.0.0.rc1, rbenv: 1.9.3-p545) [gem]" level="application" />
291+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.0.0.rc1, rbenv: 1.9.3-p545) [gem]" level="application" />
292+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.22.0, rbenv: 1.9.3-p545) [gem]" level="application" />
293293
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-base19x (v0.11.30.pre15, rbenv: 1.9.3-p545) [gem]" level="application" />
294294
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-ide (v0.4.22, rbenv: 1.9.3-p545) [gem]" level="application" />
295-
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.4.2, rbenv: 1.9.3-p545) [gem]" level="application" />
295+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.5.1, rbenv: 1.9.3-p545) [gem]" level="application" />
296296
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.1.3, rbenv: 1.9.3-p545) [gem]" level="application" />
297297
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.3, rbenv: 1.9.3-p545) [gem]" level="application" />
298298
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.8.2, rbenv: 1.9.3-p545) [gem]" level="application" />
299299
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, rbenv: 1.9.3-p545) [gem]" level="application" />
300300
<orderEntry type="library" scope="PROVIDED" name="slop (v3.5.0, rbenv: 1.9.3-p545) [gem]" level="application" />
301301
<orderEntry type="library" scope="PROVIDED" name="tee (v1.0.0, rbenv: 1.9.3-p545) [gem]" level="application" />
302-
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.17.4, rbenv: 1.9.3-p545) [gem]" level="application" />
302+
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.18.0, rbenv: 1.9.3-p545) [gem]" level="application" />
303303
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.4, rbenv: 1.9.3-p545) [gem]" level="application" />
304304
</component>
305305
<component name="RModuleSettingsStorage">

lib/java_buildpack/buildpack.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def detection(type, components, unique)
130130
components.each do |component|
131131
result = component.detect
132132

133-
if result
134-
detected << component
135-
tags << result
136-
end
133+
next unless result
134+
135+
detected << component
136+
tags << result
137137
end
138138

139139
fail "Application can be run by more than one #{type}: #{names detected}" if unique && detected.size > 1

lib/java_buildpack/buildpack_version.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def initialize(should_log = true)
5151
@remote = configuration['remote'] || remote
5252
@version = configuration['version'] || ENV['VERSION'] || @hash
5353

54-
if should_log
55-
logger = Logging::LoggerFactory.instance.get_logger BuildpackVersion
56-
logger.debug { to_s }
57-
end
54+
return unless should_log
55+
56+
logger = Logging::LoggerFactory.instance.get_logger BuildpackVersion
57+
logger.debug { to_s }
5858
end
5959

6060
# Returns a +Hash+ representation of the buildpack version.

lib/java_buildpack/container/tomcat/tomcat_redis_store.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class TomcatRedisStore < JavaBuildpack::Component::VersionedDependencyComponent
3030

3131
# (see JavaBuildpack::Component::BaseComponent#compile)
3232
def compile
33-
if supports?
34-
download_jar(jar_name, tomcat_lib)
35-
mutate_context
36-
end
33+
return unless supports?
34+
35+
download_jar(jar_name, tomcat_lib)
36+
mutate_context
3737
end
3838

3939
# (see JavaBuildpack::Component::BaseComponent#release)

lib/java_buildpack/framework/spring_auto_reconfiguration.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ def supports?
5959
def modify_web_xml
6060
web_xml = @droplet.root + 'WEB-INF/web.xml'
6161

62-
if web_xml.exist?
63-
puts ' Modifying /WEB-INF/web.xml for Auto Reconfiguration'
64-
@logger.debug { " Original web.xml: #{web_xml.read}" }
62+
return unless web_xml.exist?
6563

66-
modifier = web_xml.open { |file| WebXmlModifier.new(file) }
67-
modifier.augment_root_context
68-
modifier.augment_servlet_contexts
64+
puts ' Modifying /WEB-INF/web.xml for Auto Reconfiguration'
65+
@logger.debug { " Original web.xml: #{web_xml.read}" }
6966

70-
web_xml.open('w') do |file|
71-
file.write(modifier.to_s)
72-
file.fsync
73-
end
67+
modifier = web_xml.open { |file| WebXmlModifier.new(file) }
68+
modifier.augment_root_context
69+
modifier.augment_servlet_contexts
7470

75-
@logger.debug { " Modified web.xml: #{web_xml.read}" }
71+
web_xml.open('w') do |file|
72+
file.write(modifier.to_s)
73+
file.fsync
7674
end
75+
76+
@logger.debug { " Modified web.xml: #{web_xml.read}" }
7777
end
7878

7979
end

lib/java_buildpack/jre/memory/weight_balancing_memory_heuristic.rb

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ def allocate_by_balancing(buckets)
100100
issue_memory_wastage_warning(buckets)
101101
issue_close_to_default_warnings(buckets)
102102

103-
if stack_bucket
104-
# Convert stack size from total stack memory to stack size
105-
stack_bucket.size = buckets['stack'].size / num_threads
106-
buckets['stack'] = stack_bucket
107-
end
103+
return unless stack_bucket
104+
105+
# Convert stack size from total stack memory to stack size
106+
stack_bucket.size = buckets['stack'].size / num_threads
107+
buckets['stack'] = stack_bucket
108108
end
109109

110110
def normalise_stack_bucket(stack_bucket, buckets)
@@ -186,9 +186,9 @@ def issue_memory_wastage_warning(buckets)
186186

187187
total_size = MemorySize::ZERO
188188
buckets.each_value { |bucket| total_size += bucket.size }
189-
if @memory_limit * TOTAL_MEMORY_WARNING_FACTOR > total_size
190-
@logger.warn { "The allocated Java memory sizes total #{total_size} which is less than #{TOTAL_MEMORY_WARNING_FACTOR} of the available memory, so configured Java memory sizes may be too small or available memory may be too large" }
191-
end
189+
return unless @memory_limit * TOTAL_MEMORY_WARNING_FACTOR > total_size
190+
191+
@logger.warn { "The allocated Java memory sizes total #{total_size} which is less than #{TOTAL_MEMORY_WARNING_FACTOR} of the available memory, so configured Java memory sizes may be too small or available memory may be too large" }
192192
end
193193

194194
def nil_safe_range(size)
@@ -209,17 +209,18 @@ def issue_close_to_default_warnings(buckets)
209209
end
210210

211211
def check_close_to_default(type, bucket, total_weighting)
212-
if bucket.range.degenerate?
213-
default_size = apply_weighting_to_memory_limit(bucket, total_weighting)
214-
actual_size = bucket.size
215-
if default_size > 0
216-
factor = ((actual_size - default_size) / default_size).abs
217-
@logger.debug { "factor for memory size #{type} is #{factor}" }
218-
end
219-
if (default_size == 0 && actual_size == 0) || (factor && (factor < CLOSE_TO_DEFAULT_FACTOR))
220-
@logger.warn { "The computed value #{actual_size} of memory size #{type} is close to the default value #{default_size}. Consider taking the default." }
221-
end
212+
return unless bucket.range.degenerate?
213+
214+
default_size = apply_weighting_to_memory_limit(bucket, total_weighting)
215+
actual_size = bucket.size
216+
if default_size > 0
217+
factor = ((actual_size - default_size) / default_size).abs
218+
@logger.debug { "factor for memory size #{type} is #{factor}" }
222219
end
220+
221+
return unless (default_size == 0 && actual_size == 0) || (factor && (factor < CLOSE_TO_DEFAULT_FACTOR))
222+
223+
@logger.warn { "The computed value #{actual_size} of memory size #{type} is close to the default value #{default_size}. Consider taking the default." }
223224
end
224225

225226
def switches(buckets)

lib/java_buildpack/util/cache/download_cache.rb

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -148,27 +148,29 @@ def cache_content(response, cached_file)
148148

149149
def cache_etag(response, cached_file)
150150
etag = response['Etag']
151-
if etag
152-
@logger.debug { "Persisting etag: #{etag}" }
153151

154-
cached_file.etag(File::CREAT | File::WRONLY) do |f|
155-
f.truncate(0)
156-
f.write etag
157-
f.fsync
158-
end
152+
return unless etag
153+
154+
@logger.debug { "Persisting etag: #{etag}" }
155+
156+
cached_file.etag(File::CREAT | File::WRONLY) do |f|
157+
f.truncate(0)
158+
f.write etag
159+
f.fsync
159160
end
160161
end
161162

162163
def cache_last_modified(response, cached_file)
163164
last_modified = response['Last-Modified']
164-
if last_modified
165-
@logger.debug { "Persisting last-modified: #{last_modified}" }
166165

167-
cached_file.last_modified(File::CREAT | File::WRONLY) do |f|
168-
f.truncate(0)
169-
f.write last_modified
170-
f.fsync
171-
end
166+
return unless last_modified
167+
168+
@logger.debug { "Persisting last-modified: #{last_modified}" }
169+
170+
cached_file.last_modified(File::CREAT | File::WRONLY) do |f|
171+
f.truncate(0)
172+
f.write last_modified
173+
f.fsync
172174
end
173175
end
174176

@@ -185,10 +187,10 @@ def from_immutable_caches(uri)
185187
@immutable_cache_roots.each do |cache_root|
186188
candidate = CachedFile.new cache_root, uri
187189

188-
if candidate.cached?
189-
@logger.debug { "#{uri} found in cache #{cache_root}" }
190-
return candidate
191-
end
190+
next unless candidate.cached?
191+
192+
@logger.debug { "#{uri} found in cache #{cache_root}" }
193+
return candidate
192194
end
193195

194196
nil
@@ -258,15 +260,15 @@ def update(uri, cached_file)
258260
end
259261

260262
def validate_size(expected_size, cached_file)
261-
if expected_size
262-
actual_size = cached_file.cached(File::RDONLY) { |f| f.size }
263-
@logger.debug { "Validated content size #{actual_size} is #{expected_size}" }
263+
return unless expected_size
264264

265-
unless expected_size.to_i == actual_size
266-
cached_file.destroy
267-
fail InferredNetworkFailure, "Content has invalid size. Was #{actual_size}, should be #{expected_size}."
268-
end
269-
end
265+
actual_size = cached_file.cached(File::RDONLY) { |f| f.size }
266+
@logger.debug { "Validated content size #{actual_size} is #{expected_size}" }
267+
268+
return if expected_size.to_i == actual_size
269+
270+
cached_file.destroy
271+
fail InferredNetworkFailure, "Content has invalid size. Was #{actual_size}, should be #{expected_size}."
270272
end
271273

272274
end

lib/java_buildpack/util/play/post22.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def java_opts
4343
java_opts = @droplet.java_opts
4444

4545
java_opts.each do |option|
46-
if option.shellsplit.length > 1 && !bash_expression?(option)
47-
fail "Invalid Java option contains more than one option: '#{option}'"
48-
end
46+
next unless option.shellsplit.length > 1 && !bash_expression?(option)
47+
48+
fail "Invalid Java option contains more than one option: '#{option}'"
4949
end
5050

5151
java_opts.map { |java_opt| "-J#{java_opt}" }

0 commit comments

Comments
 (0)