unf 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3524dc58d3575e1f05725af1ad24dbd338ca6e5e
4
- data.tar.gz: a1c587d572c5ec2eb56e641fdefb3c7891b89ae8
2
+ SHA256:
3
+ metadata.gz: 3cd3437bbb5ef6ed11a0bf07ea1cfa036ae874b3adbf359a5d21732dc9829f2f
4
+ data.tar.gz: 71e0dd4ccfdfa25ce034289101c7f8043e25080192c0219c20fbd1aa9d7e24de
5
5
  SHA512:
6
- metadata.gz: cba56bc2480fe1d68a28bacc3ed2ff53d38530db8b3cca06f33b0f5de39c0cf4f67f9c01dfb7b37605b23fe2fac91bbaee2188be424c8cd8717e5455b72277da
7
- data.tar.gz: 5e641987179703915581effa487da34ca28c39b879c26424979ea4a9e8bdede7726e61531612f689b943ee3b0f6b893c72453602a007d90271c4b414aec48450
6
+ metadata.gz: 8cc7545ae4404bcc585fd011e330cba5ca00fdcf377b4aa464f06c93a4d4304f1338b8d84f9e2e85e07c6cb5ff931fb282c4435fcd51ac9cb4d2daf54725cb78
7
+ data.tar.gz: d923e127bc468d2795624ff03a9bf417c49ff204f618d372a8195bfc889d714b57b96b11ac09b84709c044874406f089f0b228617292903a7631fa411cf94cbf
@@ -0,0 +1,42 @@
1
+ name: test
2
+
3
+ on: [push, pull_request, workflow_dispatch]
4
+
5
+ jobs:
6
+ ruby-versions:
7
+ uses: ruby/actions/.github/workflows/ruby_versions.yml@master
8
+ with:
9
+ engine: cruby
10
+ min_version: 3.2
11
+
12
+ build:
13
+ needs: ruby-versions
14
+ name: build (${{ matrix.ruby_engine }} / ${{ matrix.ruby_version || 'latest' }} / ${{ matrix.os }})
15
+ strategy:
16
+ matrix:
17
+ os:
18
+ - ubuntu-latest
19
+ ruby_engine:
20
+ - ruby
21
+ ruby_version:
22
+ - '2.0'
23
+ - '2.7'
24
+ - '${{ fromJson(needs.ruby-versions.outputs.versions) }}'
25
+ include:
26
+ - { os: ubuntu-latest, ruby_engine: jruby, ruby_version: '' }
27
+ - { os: ubuntu-latest, ruby_engine: jruby, ruby_version: head }
28
+ - { os: macos-latest, ruby_engine: ruby, ruby_version: '' }
29
+ - { os: windows-latest, ruby_engine: ruby, ruby_version: ucrt }
30
+ - { os: windows-latest, ruby_engine: ruby, ruby_version: mswin }
31
+ runs-on: ${{ matrix.os }}
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+
35
+ - name: Set up Ruby
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby_engine }}-${{ matrix.ruby_version }}
39
+ bundler-cache: true
40
+
41
+ - name: Run test
42
+ run: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 0.2.0 (2024-08-18)
2
+
3
+ Features:
4
+
5
+ - Use String#unicode_normalize on Ruby >=2.2 unless unf_ext is already loaded.
6
+
7
+ - Reduce the gem size by removing unnecessary files. (GH #22)
8
+
9
+ ## 0.1.4 (2014-04-04)
10
+
11
+ Bugfixes:
12
+
13
+ - Fix the gem platform name for JRuby.
14
+
1
15
  ## 0.1.3 (2013-10-25)
2
16
 
3
17
  Features:
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ extdir = File.dirname(__FILE__)
4
+
5
+ unless defined?(JRUBY_VERSION) || String.method_defined?(:unicode_normalize)
6
+ require 'fileutils'
7
+ require 'rubygems'
8
+ require 'rubygems/command.rb'
9
+ require 'rubygems/dependency_installer.rb'
10
+
11
+ Gem::Command.build_args = ARGV
12
+
13
+ gemsdir = File.expand_path('gems', extdir)
14
+ installer = Gem::DependencyInstaller.new(install_dir: gemsdir)
15
+ specs = installer.install('unf_ext', '>= 0')
16
+
17
+ unf_ext = specs.find { |spec| spec.name == 'unf_ext' }
18
+ FileUtils.cp_r(File.join(unf_ext.gem_dir, 'lib'), File.expand_path('..', extdir))
19
+ FileUtils.rm_rf(gemsdir)
20
+ end
21
+
22
+ File.write(File.expand_path('Rakefile', extdir), <<EOF)
23
+ task :default
24
+ EOF
@@ -1 +1,26 @@
1
- require 'unf_ext'
1
+ case
2
+ when defined?(UNF::Normalizer)
3
+ # Probably unf_ext is preloaded.
4
+ when String.method_defined?(:unicode_normalize)
5
+ class String
6
+ [:nfc, :nfd, :nfkc, :nfkd].each { |form|
7
+ eval %{
8
+ remove_method :to_#{form} if method_defined?(:to_#{form})
9
+
10
+ def to_#{form}
11
+ unicode_normalize(#{form.inspect})
12
+ end
13
+ }
14
+ }
15
+ end
16
+
17
+ module UNF # :nodoc: all
18
+ class Normalizer
19
+ def normalize(string, normalization_form)
20
+ String.try_convert(string).unicode_normalize(normalization_form)
21
+ end
22
+ end
23
+ end
24
+ else
25
+ require 'unf_ext'
26
+ end
data/lib/unf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module UNF
2
- VERSION = '0.1.4'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/unf.rb CHANGED
@@ -35,4 +35,4 @@ class String
35
35
  end
36
36
  }
37
37
  }
38
- end
38
+ end unless String.method_defined?(:to_nfc)
data/unf.gemspec CHANGED
@@ -13,23 +13,19 @@ to Ruby/JRuby.
13
13
  gem.summary = %q{A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby}
14
14
  gem.homepage = "https://github.com/knu/ruby-unf"
15
15
  gem.platform = defined?(JRUBY_VERSION) ? 'java' : Gem::Platform::RUBY
16
- gem.license = "2-clause BSDL"
16
+ gem.license = "BSD-2-Clause"
17
17
 
18
- gem.files = `git ls-files`.split("\n")
18
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?(*%w[test/ Rakefile .gitignore .travis.yml]) }
19
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/.*\.rb})
21
20
  gem.require_paths = ["lib"]
22
21
  gem.extra_rdoc_files = ['README.md', 'LICENSE']
23
22
 
24
- gem.add_dependency 'unf_ext', '>= 0' unless defined?(JRUBY_VERSION)
23
+ gem.required_ruby_version = '>= 1.9.3'
24
+ gem.extensions = 'ext/mkrf_conf.rb'
25
25
 
26
- gem.add_development_dependency 'shoulda', [RUBY_VERSION < '1.9' ? '< 3.5.0' : '>= 0']
27
- if RUBY_VERSION < '1.9'
28
- # Cap dependency on activesupport with < 4.0 on behalf of
29
- # shoulda-matchers to satisfy bundler.
30
- gem.add_development_dependency 'activesupport', ['< 4.0']
31
- end
32
26
  gem.add_development_dependency 'bundler', '>= 1.2.0'
33
27
  gem.add_development_dependency 'rake', '>= 0.9.2.2'
34
28
  gem.add_development_dependency 'rdoc', '> 2.4.2'
29
+ gem.add_development_dependency 'test-unit'
30
+ gem.add_development_dependency 'unf_ext', '>= 0' unless defined?(JRUBY_VERSION)
35
31
  end
metadata CHANGED
@@ -1,117 +1,114 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2024-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: unf_ext
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
19
+ version: 1.2.0
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: shoulda
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.9.2.2
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.9.2.2
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.0
47
+ version: 2.4.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.0
54
+ version: 2.4.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: test-unit
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.2.2
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.2.2
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rdoc
70
+ name: unf_ext
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.4.2
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.4.2
82
+ version: '0'
83
83
  description: |
84
84
  This is a wrapper library to bring Unicode Normalization Form support
85
85
  to Ruby/JRuby.
86
86
  email:
87
87
  - knu@idaemons.org
88
88
  executables: []
89
- extensions: []
89
+ extensions:
90
+ - ext/mkrf_conf.rb
90
91
  extra_rdoc_files:
91
92
  - README.md
92
93
  - LICENSE
93
94
  files:
94
- - ".gitignore"
95
- - ".travis.yml"
95
+ - ".github/workflows/test.yml"
96
96
  - CHANGELOG.md
97
97
  - Gemfile
98
98
  - LICENSE
99
99
  - README.md
100
- - Rakefile
100
+ - ext/mkrf_conf.rb
101
101
  - lib/unf.rb
102
102
  - lib/unf/normalizer.rb
103
103
  - lib/unf/normalizer_cruby.rb
104
104
  - lib/unf/normalizer_jruby.rb
105
105
  - lib/unf/version.rb
106
- - test/helper.rb
107
- - test/normalization-test.txt
108
- - test/test_unf.rb
109
106
  - unf.gemspec
110
107
  homepage: https://github.com/knu/ruby-unf
111
108
  licenses:
112
- - 2-clause BSDL
109
+ - BSD-2-Clause
113
110
  metadata: {}
114
- post_install_message:
111
+ post_install_message:
115
112
  rdoc_options: []
116
113
  require_paths:
117
114
  - lib
@@ -119,18 +116,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
116
  requirements:
120
117
  - - ">="
121
118
  - !ruby/object:Gem::Version
122
- version: '0'
119
+ version: 1.9.3
123
120
  required_rubygems_version: !ruby/object:Gem::Requirement
124
121
  requirements:
125
122
  - - ">="
126
123
  - !ruby/object:Gem::Version
127
124
  version: '0'
128
125
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.2.0
131
- signing_key:
126
+ rubygems_version: 3.5.17
127
+ signing_key:
132
128
  specification_version: 4
133
129
  summary: A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby
134
- test_files:
135
- - test/helper.rb
136
- - test/test_unf.rb
130
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.8.7
4
- - ree
5
- - 1.9.3
6
- - 2.0.0
7
- - ruby-head
8
- - jruby-18mode
9
- - jruby-19mode
10
- - jruby-head
11
- - rbx-18mode
12
- - rbx-19mode
13
- matrix:
14
- allow_failures:
15
- - rvm: ruby-head
16
- - rvm: rbx-18mode
17
- - rvm: rbx-19mode
data/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
-
4
- gemspec = Bundler::GemHelper.gemspec
5
-
6
- require 'rake/testtask'
7
- Rake::TestTask.new(:test) do |test|
8
- test.libs << 'test'
9
- test.test_files = gemspec.test_files
10
- test.verbose = true
11
- end
12
-
13
- require 'rdoc/task'
14
- Rake::RDocTask.new do |rdoc|
15
- rdoc.rdoc_dir = 'rdoc'
16
- rdoc.title = "#{gemspec.name} #{gemspec.version}"
17
- rdoc.rdoc_files.include(gemspec.extra_rdoc_files)
18
- rdoc.rdoc_files.include('lib/**/*.rb')
19
- end
20
-
21
- task :default => :test
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'unf'
16
-
17
- class Test::Unit::TestCase
18
- end