diff --git a/.rubocop.yml b/.rubocop.yml index 10019482e7c..f34fa0afe86 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -164,6 +164,10 @@ Style/ClassAndModuleChildren: - lib/gemcutter/middleware/hostess.rb - lib/gemcutter/middleware/redirector.rb +Rails/Present: + Exclude: + - lib/compact_index/*.rb + Rails/ThreeStateBooleanColumn: Enabled: false diff --git a/lib/compact_index/gem_version.rb b/lib/compact_index/gem_version.rb index 65644378e68..70a5703f069 100644 --- a/lib/compact_index/gem_version.rb +++ b/lib/compact_index/gem_version.rb @@ -3,7 +3,7 @@ module CompactIndex module GemVersionMethods def version_token - return "#{number}-#{content_address}" if content_address.present? + return "#{number}-#{content_address}" if content_address? if platform.nil? || platform == "ruby" number @@ -27,12 +27,16 @@ def to_line line = "#{version_token} #{deps_line}|checksum:#{checksum}" line << ",ruby:#{ruby_version_line}" if ruby_version && ruby_version != ">= 0" line << ",rubygems:#{rubygems_version_line}" if rubygems_version && rubygems_version != ">= 0" - line << ",platform:= #{platform}" if content_address.present? + line << ",platform:= #{platform}" if content_address? line end private + def content_address? + !content_address.nil? && !content_address.empty? + end + def ruby_version_line join_multiple(ruby_version) end