Skip to content

Commit 3affa05

Browse files
committed
Bug and CodeClimate fixes
Some bugs have cropped up when running on Travis. These changes fix some of those bugs and eliminate some duplication highlighted by CodeClimate. [#61738342]
1 parent 833be19 commit 3affa05

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
language: ruby
33
rvm:
4-
- 2.0.0
5-
- 1.9.3
4+
- 2.0.0-p353
5+
- 1.9.3-p484
66
before_script: "if [[ $TRAVIS_RUBY_VERSION != '1.9.3' || $TRAVIS_SECURE_ENV_VARS != 'true' ]]; then unset CODECLIMATE_REPO_TOKEN; fi"
77
install: bundle install --deployment --without debug
88
notifications:

lib/java_buildpack/util/play/base.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ def augment_classpath
7373
fail "Method 'augment_classpath' must be defined"
7474
end
7575

76+
# Find the single directory in the root of the droplet
77+
#
78+
# @return [Pathname, nil] the single directory in the root of the droplet, otherwise +nil+
79+
def find_single_directory
80+
roots = (@droplet.root + '*').glob.select { |child| child.directory? }
81+
roots.size == 1 ? roots.first : nil
82+
end
83+
7684
# Returns the +JAVA_OPTS+ in the form that they need to be added to the command line
7785
#
7886
# @return [Array<String>] the +JAVA_OPTS+ in the form that they need to be added to the command line

lib/java_buildpack/util/play/post22.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Post22 < Base
2525
protected
2626

2727
def augment_classpath
28-
additional_classpath = @droplet.additional_libraries.map do |additional_library|
28+
additional_classpath = @droplet.additional_libraries.sort.map do |additional_library|
2929
"$app_home/#{additional_library.relative_path_from(start_script.dirname)}"
3030
end
3131

lib/java_buildpack/util/play/post22_dist.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ class Post22Dist < Post22
2323

2424
protected
2525

26-
def root
27-
roots = (@droplet.root + '*').glob.select { |child| child.directory? }
28-
roots.size == 1 ? roots.first : nil
29-
end
26+
alias_method :root, :find_single_directory
3027

3128
end
3229

lib/java_buildpack/util/play/pre22_dist.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ def lib_dir
4343
root + 'lib'
4444
end
4545

46-
def root
47-
roots = (@droplet.root + '*').glob.select { |child| child.directory? }
48-
roots.size == 1 ? roots.first : nil
49-
end
46+
alias_method :root, :find_single_directory
5047

5148
end
5249

0 commit comments

Comments
 (0)