Skip to content

Commit

Permalink
Revert &. auto corrections and use Ruby v2.0 for Rubocop
Browse files Browse the repository at this point in the history
The save navigation operator (&.) is supported since Ruby v2.3.0
(JRuby v9.1.0.0, see jruby/jruby#3479).
So these autocorrection would fail for lower versions, like 9.0.5.0,
which is e.g. used by Travis CI.
  • Loading branch information
paulgoetze authored and mkristian committed Oct 24, 2017
1 parent 82f37de commit b78488e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.0
Exclude:
- '*.gemspec'
- 'Gemfile'
Expand Down
2 changes: 1 addition & 1 deletion lib/jar_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def home

def require_jars_lock!(scope = :runtime)
urls = jars_lock_from_class_loader
if !urls&.empty?
if urls && !urls.empty?
@@jars_lock = true
# funny error during spec where it tries to load it again
# and finds it as gem instead of the LOAD_PATH
Expand Down
8 changes: 4 additions & 4 deletions lib/jars/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.load_from_maven(file)
result = []
File.read(file).each_line do |line|
dep = Dependency.new(line)
result << dep if dep&.scope == :runtime
result << dep if dep && dep.scope == :runtime
end
result
end
Expand Down Expand Up @@ -101,12 +101,12 @@ def self.write_dep(file, _dir, dep, _vendor)
def self.print_require_jar(file, dep, fallback = false)
return if dep.type != :jar || dep.scope != :runtime
if dep.system?
file&.puts("require '#{dep.file}'")
file.puts("require '#{dep.file}'") if file
elsif dep.scope == :runtime
if fallback
file&.puts(" require '#{dep.path}'")
file.puts(" require '#{dep.path}'") if file
else
file&.puts(" require_jar '#{dep.gav.gsub(':', "', '")}'")
file.puts(" require_jar '#{dep.gav.gsub(':', "', '")}'") if file
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion specs/jars_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

it 'extract maven settings' do
settings = Jars.maven_settings
settings&.sub(/.*\.m2./, '')&.must_equal 'settings.xml'
settings.sub(/.*\.m2./, '').must_equal 'settings.xml' if settings

ENV['JARS_MAVEN_SETTINGS'] = 'specs/settings.xml'
Jars.reset
Expand Down

0 comments on commit b78488e

Please sign in to comment.