Skip to content

Commit 87b7ef4

Browse files
author
Christopher Frost
committed
Update dependencies and fix Rubocop issues
This commit updates the Ruby/Gem dependencies and then the code as required to pass the new rubocop cops. EmptyLinesAroundBody has been split in to EmptyLinesAroundModuleBody and EmptyLinesAroundClassBody. An AbcSize metric has been introduced and the default overriden to 18, setting this any lower causes far too many invasive refactorings where they arn't required. IntelliJ code formatting settings are also in line with the new cops. [#83541054]
1 parent abefeea commit 87b7ef4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+262
-230
lines changed

.idea/codeStyleSettings.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.rubocop.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ AllCops:
66
Exclude:
77
- build/**/*
88
- vendor/**/*
9+
AbcSize:
10+
Max: 18
911
ClassLength:
1012
Max: 200
1113
CyclomaticComplexity:
1214
Max: 10
1315
Documentation:
1416
Enabled: false
15-
EmptyLinesAroundBody:
17+
EmptyLinesAroundModuleBody:
18+
Enabled: false
19+
EmptyLinesAroundClassBody:
20+
Enabled: false
21+
MultilineOperationIndentation:
1622
Enabled: false
1723
LineLength:
1824
Enabled: false

Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ GEM
55
ast (2.0.0)
66
astrolabe (1.3.0)
77
parser (>= 2.2.0.pre.3, < 3.0)
8-
codeclimate-test-reporter (0.4.1)
8+
codeclimate-test-reporter (0.4.3)
99
simplecov (>= 0.7.1, < 1.0.0)
1010
crack (0.4.2)
1111
safe_yaml (~> 1.0.0)
1212
diff-lcs (1.2.5)
1313
docile (1.1.5)
1414
multi_json (1.10.1)
15-
parser (2.2.0.pre.6)
15+
parser (2.2.0.pre.8)
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.2)
21-
redcarpet (3.2.0)
20+
rake (10.4.2)
21+
redcarpet (3.2.1)
2222
rspec (3.1.0)
2323
rspec-core (~> 3.1.0)
2424
rspec-expectations (~> 3.1.0)
@@ -31,13 +31,13 @@ GEM
3131
rspec-mocks (3.1.3)
3232
rspec-support (~> 3.1.0)
3333
rspec-support (3.1.2)
34-
rubocop (0.26.1)
34+
rubocop (0.27.1)
3535
astrolabe (~> 1.3)
36-
parser (>= 2.2.0.pre.4, < 3.0)
36+
parser (>= 2.2.0.pre.7, < 3.0)
3737
powerpack (~> 0.0.6)
3838
rainbow (>= 1.99.1, < 3.0)
3939
ruby-progressbar (~> 1.4)
40-
ruby-progressbar (1.6.0)
40+
ruby-progressbar (1.7.0)
4141
rubyzip (1.1.6)
4242
safe_yaml (1.0.4)
4343
simplecov (0.9.1)
@@ -47,7 +47,7 @@ GEM
4747
simplecov-html (0.8.0)
4848
slop (3.6.0)
4949
tee (1.0.0)
50-
webmock (1.20.0)
50+
webmock (1.20.4)
5151
addressable (>= 2.3.6)
5252
crack (>= 0.3.2)
5353
yard (0.8.7.6)

java-buildpack.iml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -266,37 +266,37 @@
266266
<excludeFolder url="file://$MODULE_DIR$/coverage" />
267267
<excludeFolder url="file://$MODULE_DIR$/doc" />
268268
</content>
269-
<orderEntry type="jdk" jdkName="ruby-1.9.3-p551" jdkType="RUBY_SDK" />
269+
<orderEntry type="jdk" jdkName="rbenv: 1.9.3-p551" jdkType="RUBY_SDK" />
270270
<orderEntry type="sourceFolder" forTests="false" />
271-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.6, ruby-1.9.3-p551) [gem]" level="application" />
272-
<orderEntry type="library" scope="PROVIDED" name="ast (v2.0.0, ruby-1.9.3-p551) [gem]" level="application" />
273-
<orderEntry type="library" scope="PROVIDED" name="astrolabe (v1.3.0, ruby-1.9.3-p551) [gem]" level="application" />
274-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.7.6, ruby-1.9.3-p551) [gem]" level="application" />
275-
<orderEntry type="library" scope="PROVIDED" name="codeclimate-test-reporter (v0.4.1, ruby-1.9.3-p551) [gem]" level="application" />
276-
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, ruby-1.9.3-p551) [gem]" level="application" />
277-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, ruby-1.9.3-p551) [gem]" level="application" />
278-
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.5, ruby-1.9.3-p551) [gem]" level="application" />
279-
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, ruby-1.9.3-p551) [gem]" level="application" />
280-
<orderEntry type="library" scope="PROVIDED" name="parser (v2.2.0.pre.6, ruby-1.9.3-p551) [gem]" level="application" />
281-
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.0.9, ruby-1.9.3-p551) [gem]" level="application" />
282-
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.0.0, ruby-1.9.3-p551) [gem]" level="application" />
283-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, ruby-1.9.3-p551) [gem]" level="application" />
284-
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.2.0, ruby-1.9.3-p551) [gem]" level="application" />
285-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.1.0, ruby-1.9.3-p551) [gem]" level="application" />
286-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.1.7, ruby-1.9.3-p551) [gem]" level="application" />
287-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.1.2, ruby-1.9.3-p551) [gem]" level="application" />
288-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.1.3, ruby-1.9.3-p551) [gem]" level="application" />
289-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.1.2, ruby-1.9.3-p551) [gem]" level="application" />
290-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.26.1, ruby-1.9.3-p551) [gem]" level="application" />
291-
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.6.0, ruby-1.9.3-p551) [gem]" level="application" />
292-
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.1.6, ruby-1.9.3-p551) [gem]" level="application" />
293-
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.4, ruby-1.9.3-p551) [gem]" level="application" />
294-
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.9.1, ruby-1.9.3-p551) [gem]" level="application" />
295-
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, ruby-1.9.3-p551) [gem]" level="application" />
296-
<orderEntry type="library" scope="PROVIDED" name="slop (v3.6.0, ruby-1.9.3-p551) [gem]" level="application" />
297-
<orderEntry type="library" scope="PROVIDED" name="tee (v1.0.0, ruby-1.9.3-p551) [gem]" level="application" />
298-
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.20.0, ruby-1.9.3-p551) [gem]" level="application" />
299-
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.6, ruby-1.9.3-p551) [gem]" level="application" />
271+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.6, rbenv: 1.9.3-p551) [gem]" level="application" />
272+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.0.0, rbenv: 1.9.3-p551) [gem]" level="application" />
273+
<orderEntry type="library" scope="PROVIDED" name="astrolabe (v1.3.0, rbenv: 1.9.3-p551) [gem]" level="application" />
274+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.7.7, rbenv: 1.9.3-p551) [gem]" level="application" />
275+
<orderEntry type="library" scope="PROVIDED" name="codeclimate-test-reporter (v0.4.3, rbenv: 1.9.3-p551) [gem]" level="application" />
276+
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, rbenv: 1.9.3-p551) [gem]" level="application" />
277+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, rbenv: 1.9.3-p551) [gem]" level="application" />
278+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.5, rbenv: 1.9.3-p551) [gem]" level="application" />
279+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, rbenv: 1.9.3-p551) [gem]" level="application" />
280+
<orderEntry type="library" scope="PROVIDED" name="parser (v2.2.0.pre.8, rbenv: 1.9.3-p551) [gem]" level="application" />
281+
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.0.9, rbenv: 1.9.3-p551) [gem]" level="application" />
282+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.0.0, rbenv: 1.9.3-p551) [gem]" level="application" />
283+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, rbenv: 1.9.3-p551) [gem]" level="application" />
284+
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.2.1, rbenv: 1.9.3-p551) [gem]" level="application" />
285+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.1.0, rbenv: 1.9.3-p551) [gem]" level="application" />
286+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.1.7, rbenv: 1.9.3-p551) [gem]" level="application" />
287+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.1.2, rbenv: 1.9.3-p551) [gem]" level="application" />
288+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.1.3, rbenv: 1.9.3-p551) [gem]" level="application" />
289+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.1.2, rbenv: 1.9.3-p551) [gem]" level="application" />
290+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.27.1, rbenv: 1.9.3-p551) [gem]" level="application" />
291+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.7.0, rbenv: 1.9.3-p551) [gem]" level="application" />
292+
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.1.6, rbenv: 1.9.3-p551) [gem]" level="application" />
293+
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.4, rbenv: 1.9.3-p551) [gem]" level="application" />
294+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.9.1, rbenv: 1.9.3-p551) [gem]" level="application" />
295+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, rbenv: 1.9.3-p551) [gem]" level="application" />
296+
<orderEntry type="library" scope="PROVIDED" name="slop (v3.6.0, rbenv: 1.9.3-p551) [gem]" level="application" />
297+
<orderEntry type="library" scope="PROVIDED" name="tee (v1.0.0, rbenv: 1.9.3-p551) [gem]" level="application" />
298+
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.20.4, rbenv: 1.9.3-p551) [gem]" level="application" />
299+
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.6, rbenv: 1.9.3-p551) [gem]" level="application" />
300300
</component>
301301
<component name="RModuleSettingsStorage">
302302
<LOAD_PATH number="4" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" string2="$MODULE_DIR$/bin" string3="$MODULE_DIR$/spec/bin" />

lib/java_buildpack/buildpack.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ def initialize(app_dir, application)
108108
immutable_java_home = Component::ImmutableJavaHome.new mutable_java_home, app_dir
109109
java_opts = Component::JavaOpts.new app_dir
110110

111-
components = JavaBuildpack::Util::ConfigurationUtils.load 'components'
111+
instantiate_components(additional_libraries, app_dir, application, immutable_java_home, java_opts, mutable_java_home)
112+
end
112113

114+
def instantiate_components(additional_libraries, app_dir, application, immutable_java_home, java_opts, mutable_java_home)
115+
components = JavaBuildpack::Util::ConfigurationUtils.load 'components'
113116
@jres = instantiate(components['jres'], additional_libraries, application, mutable_java_home, java_opts,
114117
app_dir)
115118
@frameworks = instantiate(components['frameworks'], additional_libraries, application, immutable_java_home,
@@ -214,7 +217,5 @@ def handle_error(e, message)
214217
end
215218

216219
end
217-
218220
end
219-
220221
end

lib/java_buildpack/container/dist_zip.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DistZip < JavaBuildpack::Container::DistZipLike
3232
# @param [Hash] context a collection of utilities used the component
3333
def initialize(context)
3434
super(context)
35-
@ratpack_utils = JavaBuildpack::Util::RatpackUtils.new
35+
@ratpack_utils = JavaBuildpack::Util::RatpackUtils.new
3636
@spring_boot_utils = JavaBuildpack::Util::SpringBootUtils.new
3737
end
3838

@@ -49,8 +49,8 @@ def supports?
4949
start_script(root).exist? &&
5050
jars? &&
5151
!@ratpack_utils.is?(@application) &&
52-
!@spring_boot_utils.is?(@application) &&
53-
!JavaBuildpack::Util::Play::Factory.create(@droplet)
52+
!@spring_boot_utils.is?(@application) &&
53+
!JavaBuildpack::Util::Play::Factory.create(@droplet)
5454
end
5555

5656
private

lib/java_buildpack/container/groovy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Groovy < JavaBuildpack::Component::VersionedDependencyComponent
3838
#
3939
# @param [Hash] context a collection of utilities used the component
4040
def initialize(context)
41-
@logger = JavaBuildpack::Logging::LoggerFactory.instance.get_logger Groovy
41+
@logger = JavaBuildpack::Logging::LoggerFactory.instance.get_logger Groovy
4242
@ratpack_utils = JavaBuildpack::Util::RatpackUtils.new
4343
super(context) { |candidate_version| candidate_version.check_size(3) }
4444
end

lib/java_buildpack/container/java_main.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@ def release
4141
@droplet.additional_libraries.insert 0, @application.root
4242
manifest_class_path.each { |path| @droplet.additional_libraries << path }
4343

44-
[
45-
port,
46-
"#{@droplet.java_home.root}/bin/java",
47-
@droplet.additional_libraries.as_classpath,
48-
@droplet.java_opts.join(' '),
49-
main_class,
50-
arguments
51-
].flatten.compact.join(' ')
44+
release_text
5245
end
5346

5447
private
@@ -59,6 +52,17 @@ def release
5952

6053
private_constant :ARGUMENTS_PROPERTY, :CLASS_PATH_PROPERTY
6154

55+
def release_text
56+
[
57+
port,
58+
"#{@droplet.java_home.root}/bin/java",
59+
@droplet.additional_libraries.as_classpath,
60+
@droplet.java_opts.join(' '),
61+
main_class,
62+
arguments
63+
].flatten.compact.join(' ')
64+
end
65+
6266
def arguments
6367
@configuration[ARGUMENTS_PROPERTY]
6468
end

lib/java_buildpack/framework/app_dynamics_agent.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def release
3636
java_opts = @droplet.java_opts
3737

3838
java_opts
39-
.add_javaagent(@droplet.sandbox + 'javaagent.jar')
40-
.add_system_property('appdynamics.agent.applicationName', "'#{application_name}'")
41-
.add_system_property('appdynamics.agent.tierName', "'#{tier_name(credentials)}'")
42-
.add_system_property('appdynamics.agent.nodeName',
43-
"$(expr \"$VCAP_APPLICATION\" : '.*instance_index[\": ]*\\([[:digit:]]*\\).*')")
39+
.add_javaagent(@droplet.sandbox + 'javaagent.jar')
40+
.add_system_property('appdynamics.agent.applicationName', "'#{application_name}'")
41+
.add_system_property('appdynamics.agent.tierName', "'#{tier_name(credentials)}'")
42+
.add_system_property('appdynamics.agent.nodeName',
43+
"$(expr \"$VCAP_APPLICATION\" : '.*instance_index[\": ]*\\([[:digit:]]*\\).*')")
4444

4545
account_access_key(java_opts, credentials)
4646
account_name(java_opts, credentials)

0 commit comments

Comments
 (0)