naturalsorter 3.0.27 → 3.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb70054db38c144413c6377ae9baea628e58446b499f6e33ee9324f733c5391a
4
- data.tar.gz: d98475af5e41de9fb63d0e75063ab9355fdfe0e4359bed11063047347e5259d4
3
+ metadata.gz: c2e74c8afd80ac74a50b5512b063bb9787061a4d921220958e6b4fe4cc50b5a6
4
+ data.tar.gz: 852db30bdd5503eb99ba0e1a8a6734f2291793a81f0b588aa107345e09f6bf6a
5
5
  SHA512:
6
- metadata.gz: 2f9e67ae41ed2dfcf070c47019ad909172921ee3b56cae2037446202a4189196a96792fc96ba8d4c5636520fa4ce041dc0863456fde965065465d4c1f280a8a0
7
- data.tar.gz: 440e2a3e8b4d4572dcff510c4acd5f44cd96885cf8ed373f10972dcee11d4d73393c73bbbfb26744cfa5beb99ce4bf8c04c0539edd19aa413a0b3df2216abf36
6
+ metadata.gz: 5ae502c169639242eea60fb9e14add9d3242cf2fc66b1df948d0b1b00cdead5c9d53d954bc7a650fb970f87c4568d362490e168a593aad2c2a33421650b4622f
7
+ data.tar.gz: 7b08f71ad042cc08cad72166e59d9aa4ca6cc8ab03e4e8df891f14654f56966dc45e08ba15a77bdf57e018c8b10dcce74553d03ce267d17904751c4b6481bec8
data/README.markdown CHANGED
@@ -1,11 +1,9 @@
1
1
  # NaturalSorter
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/naturalsorter.png)](http://badge.fury.io/rb/naturalsorter)
4
- [![Dependency Status](https://www.versioneye.com/ruby/naturalsorter/badge?style=flat)](https://www.versioneye.com/ruby/naturalsorter)
5
4
  [![Build Status](https://travis-ci.org/versioneye/naturalsorter.png)](https://travis-ci.org/versioneye/naturalsorter)
6
5
  [![Coverage Status](https://coveralls.io/repos/versioneye/naturalsorter/badge.svg?branch=master&service=github)](https://coveralls.io/github/versioneye/naturalsorter?branch=master)
7
6
  [![Code Climate](https://codeclimate.com/github/versioneye/naturalsorter.png)](https://codeclimate.com/github/versioneye/naturalsorter)
8
- [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=157523)](https://www.bountysource.com/trackers/157523-versioneye-naturalsorter?utm_source=157523&utm_medium=shield&utm_campaign=TRACKER_BADGE)
9
7
 
10
8
 
11
9
  ## The Mission
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "3.0.27"
2
+ VERSION = "3.0.29"
3
3
  end
data/lib/naturalsorter.rb CHANGED
@@ -51,10 +51,12 @@ module Naturalsorter
51
51
  end
52
52
 
53
53
 
54
- def self.sort_version_by_method(array, method, asc = true )
55
- return array if (array.nil? || array.empty? || array.length == 1 )
56
- return array.sort { |a,b| Versioncmp.compare(a.send(method), b.send(method)) } if asc
57
- return array.sort { |a,b| Versioncmp.compare(b.send(method), a.send(method)) }
54
+ def self.sort_version_by_method( array, method, asc = true )
55
+ return array if (array.nil? || array.empty? || array.length < 1 || method.to_s.strip.empty? )
56
+ return array if (array[0].nil? || array[1].nil?)
57
+ return array if (array[0].send(method).nil? || array[1].send(method).nil?)
58
+ return array&.sort { |a,b| Versioncmp.compare(a.send(method), b.send(method)) } if asc
59
+ return array&.sort { |a,b| Versioncmp.compare(b.send(method), a.send(method)) }
58
60
  end
59
61
 
60
62
 
@@ -118,7 +120,7 @@ module Naturalsorter
118
120
  (0..min_length).each do |z|
119
121
  ver = versions[z]
120
122
  cur = newests[z]
121
- if (cur > ver)
123
+ if cur > ver
122
124
  return false
123
125
  end
124
126
  end
@@ -188,7 +188,7 @@ class VersionTagRecognizer
188
188
  end
189
189
 
190
190
  def self.pre? value
191
- value.to_s.match(/.*pre.*$/i)
191
+ value.to_s.match(/.*pre.*$/i) || value.to_s.match(/.*insiders.*$/i)
192
192
  end
193
193
 
194
194
  def self.jbossorg? value
@@ -349,6 +349,9 @@ describe VersionTagRecognizer do
349
349
  it "does fit stability" do
350
350
  expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1", "stable" )).to be_truthy
351
351
  end
352
+ it "does not fit stability" do
353
+ expect( VersionTagRecognizer.does_it_fit_stability?( "3.9.2-insiders.20200509", "stable" )).to be_falsey
354
+ end
352
355
  it "does not fit stability" do
353
356
  expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1-BETA", "stable" )).to be_falsey
354
357
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturalsorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.27
4
+ version: 3.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - reiz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-23 00:00:00.000000000 Z
12
+ date: 2025-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.0.8
104
+ rubygems_version: 3.3.6
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Sorting arrays in natural order