diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..145ce76 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: CI RSpec Test + +on: [push, pull_request] + +jobs: + build: + name: >- + ${{ matrix.ruby }} + env: + CI: true + TESTOPTS: -v + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: true + matrix: + ruby: + - 2.7 + - 3.0 + - 3.1 + - 3.2 + - 3.3 + experimental: [false] + include: + - ruby: head + experimental: true + + steps: + - name: repo checkout + uses: actions/checkout@v2 + + - name: load ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler: 2 + + - name: bundle install + run: bundle install --jobs 4 --retry 3 + + - name: test + timeout-minutes: 10 + run: bundle exec rake spec + continue-on-error: ${{ matrix.experimental }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5ad162a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: ruby - -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 - - 2.1.5 - - 2.2.0 - - ruby-head - - rbx - - jruby - -matrix: - allow_failures: - - rvm: ruby-head - - rvm: rbx - - rvm: jruby diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e97eae..e929779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.3.0 - 2024-10-20 + +* Remove `NaturalSort::Kernel` module. +* Add Github Actions and remove Travis CI. + ## 1.2.0 - 2013-10-10 * DEPRECATION: deprecate `NaturalSort.naturalsort` and replace with `NaturalSort.sort` diff --git a/README.md b/README.md index 1926b3d..ea6afbb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # NaturalSort -[![Build Status](https://secure.travis-ci.org/johnnyshields/naturalsort.png?branch=master)](http://travis-ci.org/johnnyshields/naturalsort) -[![Code Climate](https://codeclimate.com/github/johnnyshields/naturalsort.png)](https://codeclimate.com/github/johnnyshields/naturalsort) - NaturalSort is a simple library which implements a natural, human-friendly alphanumeric sort in Ruby. ## Examples @@ -35,7 +32,7 @@ gem 'naturalsort' or to optionally extend Ruby native objects: ```ruby -gem 'naturalsort', :require => 'natural_sort_kernel' +gem 'naturalsort', require: 'natural_sort_kernel' ``` #### From Command Line @@ -53,7 +50,7 @@ $ gem install naturalsort ```ruby require 'natural_sort_kernel' - sorted = %w(a b c A B C).natural_sort + %w[a b c A B C].natural_sort ``` #### Use as a module function @@ -61,7 +58,7 @@ $ gem install naturalsort ```ruby require 'natural_sort' # unless using Bundler - sorted = NaturalSort.sort %w(a b c d A B C D) + NaturalSort.sort %w[a b c d A B C D] ``` #### Use comparator function as a standalone @@ -75,7 +72,7 @@ Adds `natural_sort` methods to Ruby native enumerable objects (Array, Hash, etc. [person_1, person_2, person_3].sort{|a,b| NaturalSort.comparator(a.name, b.name)} #=> [person_3, person_2, person_1] - sorted = %w(a b c A B C).natural_sort + sorted = %w[a b c A B C].natural_sort ``` #### Include into your own objects diff --git a/lib/natural_sort.rb b/lib/natural_sort.rb index b27faa3..78d221c 100644 --- a/lib/natural_sort.rb +++ b/lib/natural_sort.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'forwardable' require 'natural_sort/version' require 'natural_sort/engine' diff --git a/lib/natural_sort/base.rb b/lib/natural_sort/base.rb index 14b695d..bfc4f62 100644 --- a/lib/natural_sort/base.rb +++ b/lib/natural_sort/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Public: The public interface for NaturalSort module # For method descriptions refer to NaturalSort::Engine # diff --git a/lib/natural_sort/engine.rb b/lib/natural_sort/engine.rb index 3eb5348..2e1d0f7 100644 --- a/lib/natural_sort/engine.rb +++ b/lib/natural_sort/engine.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Internal: Singleton module which sorts elements in a natural, # human-friendly alphanumeric order. module NaturalSort::Engine diff --git a/lib/natural_sort/kernel.rb b/lib/natural_sort/kernel.rb index e5287c4..3a100b8 100644 --- a/lib/natural_sort/kernel.rb +++ b/lib/natural_sort/kernel.rb @@ -1,11 +1,4 @@ -# Public: Adds #natural_sort instance method to Ruby Kernel enumerable objects. -# -# Examples -# -# require 'natural_sort_kernel' -# defined?(NaturalSort::Kernel) #=> true -# ['a', 'b', 'A', 'B'].natural_sort #=> ['A', 'a', 'B', 'b'] -module NaturalSort::Kernel; end +# frozen_string_literal: true module Enumerable # Add #natural_sort method to Enumerable module. diff --git a/lib/natural_sort/version.rb b/lib/natural_sort/version.rb index cff11b1..52c845e 100644 --- a/lib/natural_sort/version.rb +++ b/lib/natural_sort/version.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + module NaturalSort module Version - VERSION = '1.2.0' + VERSION = '1.3.0' end end diff --git a/lib/natural_sort_kernel.rb b/lib/natural_sort_kernel.rb index b812bd3..cc6064d 100644 --- a/lib/natural_sort_kernel.rb +++ b/lib/natural_sort_kernel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'natural_sort' require 'natural_sort/kernel' diff --git a/naturalsort.gemspec b/naturalsort.gemspec index 54abc02..eb1952b 100644 --- a/naturalsort.gemspec +++ b/naturalsort.gemspec @@ -5,16 +5,13 @@ require 'natural_sort/version' Gem::Specification.new do |spec| spec.name = 'naturalsort' spec.version = NaturalSort::Version::VERSION - spec.authors = ['Benjamin Francisoud'] - spec.email = ['pub.cog@gmail.com'] + spec.authors = ['Johnny Shields'] + spec.email = 'info@tablecheck.com' spec.summary = %q{NaturalSort is a simple library which implements a natural, human-friendly alphanumeric sort in Ruby} - spec.description = %q{Example: %w(1 2a A1 a11 A12 a2 a21 x__2 X_1).natural_sort => %w(1 2a A1 a11 A12 a2 a21 x__2 X_1)} - spec.homepage = 'http://rubyforge.org/projects/naturalsort/' + spec.description = %q{Example: %w[1 2a A1 a11 A12 a2 a21 x__2 X_1].natural_sort => %w[1 2a A1 a11 A12 a2 a21 x__2 X_1]} + spec.homepage = 'https://github.com/johnnyshields/naturalsort' spec.license = 'MIT' - - spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.files = Dir.glob('lib/**/*') + %w[CHANGELOG.md LICENSE README.md] spec.require_paths = ['lib'] spec.add_development_dependency 'minitest'