Skip to content

Commit

Permalink
Remove kernel module
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed Oct 19, 2024
1 parent cf94f21 commit 895d21f
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 41 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -53,15 +50,15 @@ $ 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

```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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/natural_sort.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'forwardable'
require 'natural_sort/version'
require 'natural_sort/engine'
Expand Down
2 changes: 2 additions & 0 deletions lib/natural_sort/base.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Public: The public interface for NaturalSort module
# For method descriptions refer to NaturalSort::Engine
#
Expand Down
2 changes: 2 additions & 0 deletions lib/natural_sort/engine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Internal: Singleton module which sorts elements in a natural,
# human-friendly alphanumeric order.
module NaturalSort::Engine
Expand Down
9 changes: 1 addition & 8 deletions lib/natural_sort/kernel.rb
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 3 additions & 1 deletion lib/natural_sort/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

module NaturalSort
module Version
VERSION = '1.2.0'
VERSION = '1.3.0'
end
end
1 change: 1 addition & 0 deletions lib/natural_sort_kernel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

require 'natural_sort'
require 'natural_sort/kernel'
13 changes: 5 additions & 8 deletions naturalsort.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 895d21f

Please sign in to comment.