charwidth 0.2.0 → 0.2.1

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
2
  SHA256:
3
- metadata.gz: 4a160471d7981b5ac57ce572d4f1bd4e718c30d01572865089ca8ae594fb512b
4
- data.tar.gz: c85aae5292b8aff58894f9af501dfd3c3bc4ee6d2848f6df44e3882399b4c473
3
+ metadata.gz: 133819f5ab71a842c32836111306f610641d82cfd4a77c00bbcec383ac981ea7
4
+ data.tar.gz: a6b8a19034123788ae3954034d71fa3b58f25debf9e5501868b23fd6b9df1030
5
5
  SHA512:
6
- metadata.gz: d6ee373af2b62eadff932a240cd06e12493a1e3b7681bcbf4053a75cc9d351f27f59751c1c7c705615659b67554f278245a41fc1a0255dcfe8df672dd5d376c0
7
- data.tar.gz: 694fde3a7d2b19c772de341a3a6a478cc4befde8fc1ba7c2da0109c994fd58c3bce410abbd473396e6de8f6e8ec5043aa60f34ab88682f7319e48261efa63301
6
+ metadata.gz: a3aaa79d412eb608c15d546c1b30e86b640ca9f3958665a656ca109fed36597879695d01dc39076088165ad00af307bfadd0a2f976edb502e23ad5b708b3ac1f
7
+ data.tar.gz: e02b783ac3c5b8d17488f2df375770232ad31b22c5bb43d7da0a946268a5a59b6188c34ca22ee310a144fb83405ec7ed1aa04c181ad5bdc84771162fa59fb7db
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### v0.2.1
2
+
3
+ - Exclude dependency executables (rspec, rubocop). (Thank you @ta1kt0me for reporting an issue)
4
+
5
+ ### v0.2.0
6
+
7
+ - Add `normalize_charwidth` method instead of problematic ActiveRecord integration.
8
+
1
9
  ### v0.1.5
2
10
 
3
11
  - Fix active_record.rb to follow the change of AR after 5.2.
data/charwidth.gemspec CHANGED
@@ -1,6 +1,4 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "charwidth/version"
1
+ require_relative "lib/charwidth/version"
4
2
 
5
3
  Gem::Specification.new do |spec|
6
4
  spec.name = "charwidth"
@@ -11,11 +9,18 @@ Gem::Specification.new do |spec|
11
9
  spec.summary = "Normalize Japanese / Korean fullwidth (zenkaku) and halfwidth (hankaku) characters"
12
10
  spec.homepage = "https://github.com/labocho/charwidth"
13
11
  spec.license = "MIT"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
14
13
 
15
- spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r(^bin/)) {|f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = "https://github.com/labocho/charwidth/blob/master/CHANGELOG.md"
19
17
 
20
- spec.required_ruby_version = ">= 2.4.0"
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r(^exe/)) {|f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
21
26
  end
File without changes
@@ -1,3 +1,3 @@
1
1
  module Charwidth
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charwidth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - labocho
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-19 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Normalize Japanese / Korean fullwidth (zenkaku) and halfwidth (hankaku)
14
14
  characters
@@ -16,8 +16,6 @@ email:
16
16
  - labocho@penguinlab.jp
17
17
  executables:
18
18
  - charwidth
19
- - rspec
20
- - rubocop
21
19
  extensions: []
22
20
  extra_rdoc_files: []
23
21
  files:
@@ -32,23 +30,23 @@ files:
32
30
  - LICENSE.txt
33
31
  - README.md
34
32
  - Rakefile
35
- - bin/charwidth
36
33
  - bin/rspec
37
34
  - bin/rubocop
38
35
  - charwidth.gemspec
36
+ - exe/charwidth
39
37
  - lib/charwidth.rb
40
38
  - lib/charwidth/active_model.rb
41
39
  - lib/charwidth/characters.rb
42
40
  - lib/charwidth/cli.rb
43
41
  - lib/charwidth/string.rb
44
42
  - lib/charwidth/version.rb
45
- - spec/charwidth/active_model_spec.rb
46
- - spec/charwidth_spec.rb
47
- - spec/spec_helper.rb
48
43
  homepage: https://github.com/labocho/charwidth
49
44
  licenses:
50
45
  - MIT
51
- metadata: {}
46
+ metadata:
47
+ homepage_uri: https://github.com/labocho/charwidth
48
+ source_code_uri: https://github.com/labocho/charwidth
49
+ changelog_uri: https://github.com/labocho/charwidth/blob/master/CHANGELOG.md
52
50
  post_install_message:
53
51
  rdoc_options: []
54
52
  require_paths:
@@ -68,7 +66,4 @@ rubygems_version: 3.1.2
68
66
  signing_key:
69
67
  specification_version: 4
70
68
  summary: Normalize Japanese / Korean fullwidth (zenkaku) and halfwidth (hankaku) characters
71
- test_files:
72
- - spec/charwidth/active_model_spec.rb
73
- - spec/charwidth_spec.rb
74
- - spec/spec_helper.rb
69
+ test_files: []
@@ -1,44 +0,0 @@
1
- require "spec_helper"
2
- require "active_model"
3
- require "charwidth/active_model"
4
-
5
- describe Charwidth::ActiveModel do
6
- before(:all) do
7
- # rubocop:disable Lint/ConstantDefinitionInBlock
8
- class User
9
- include ActiveModel::Attributes
10
- include Charwidth::ActiveModel
11
-
12
- attribute :name, :string
13
- normalize_charwidth :name
14
-
15
- def initialize(name: nil)
16
- super()
17
- self.name = name
18
- end
19
- end
20
- # rubocop:enable Lint/ConstantDefinitionInBlock
21
- end
22
-
23
- after(:all) do
24
- Object.send(:remove_const, :User)
25
- end
26
-
27
- subject { User.new }
28
- context "assign unnormalized valud" do
29
- before(:each) do
30
- subject.name = "ABCアイウ"
31
- end
32
- its(:name) { should == "ABCアイウ" }
33
- end
34
- context "assign nil" do
35
- before(:each) do
36
- subject.name = nil
37
- end
38
- its(:name) { should.nil? }
39
- end
40
- context "mass assignment" do
41
- subject { User.new(name: "ABCアイウ") }
42
- its(:name) { should == "ABCアイウ" }
43
- end
44
- end
@@ -1,87 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Charwidth" do
4
- describe ".normalize" do
5
- it "should convert full-width alphabet to half-width" do
6
- expect(Charwidth.normalize("ABCabc")).to eq("ABCabc")
7
- end
8
- it "should convert full-width number to half-width" do
9
- expect(Charwidth.normalize("123")).to eq("123")
10
- end
11
- it "should convert full-width ASCII symbol before numbers to half-width" do
12
- expect(Charwidth.normalize("!"#")).to eq("!\"#")
13
- end
14
- it "should convert full-width ASCII symbol between numbers and upper-case to half-width" do
15
- expect(Charwidth.normalize(":;")).to eq(":;")
16
- end
17
- it "should convert full-width ASCII symbol between upper-case and lower-case to half-width" do
18
- expect(Charwidth.normalize("[\]")).to eq("[\\]")
19
- end
20
- it "should convert full-width ASCII symbol after lower-case to half-width" do
21
- expect(Charwidth.normalize("{|}")).to eq("{|}")
22
- end
23
-
24
- it "should convert half-width CJK punctuation to full-width" do
25
- expect(Charwidth.normalize("、。「」")).to eq("、。「」")
26
- end
27
-
28
- it "should convert half-width katakana to full-width" do
29
- expect(Charwidth.normalize("アカサタナハマヤラワヲンァャッー・")).to eq("アカサタナハマヤラワヲンァャッー・")
30
- expect(Charwidth.normalize("タチツテトナニヌネノ")).to eq("タチツテトナニヌネノ")
31
- end
32
-
33
- it "should unify half-width (semi) voiced katakana with dakuon to full-width" do
34
- expect(Charwidth.normalize("ガザダバパ")).to eq("ガザダバパ")
35
- end
36
-
37
- it "should convert half-width hangul to full-width" do
38
- expect(Charwidth.normalize("アカサタナハマヤラワヲンァャッー・")).to eq("アカサタナハマヤラワヲンァャッー・")
39
- end
40
-
41
- it "should convert IDIOGRAPHIC-SPACE to SPACE" do
42
- expect(Charwidth.normalize("\u3000")).to eq(" ")
43
- end
44
- end
45
-
46
- describe ".to_full_width" do
47
- it "should convert half-width alphabet to full-width" do
48
- expect(Charwidth.to_full_width("ABCabc")).to eq("ABCabc")
49
- end
50
- it "should convert half-width number to full-width" do
51
- expect(Charwidth.to_full_width("123")).to eq("123")
52
- end
53
- it "should convert half-width ASCII symbol before numbers to full-width" do
54
- expect(Charwidth.to_full_width("!\"#")).to eq("!"#")
55
- end
56
- it "should convert half-width ASCII symbol between numbers and upper-case to full-width" do
57
- expect(Charwidth.to_full_width(":;")).to eq(":;")
58
- end
59
- it "should convert half-width ASCII symbol between upper-case and lower-case to full-width" do
60
- expect(Charwidth.to_full_width("[\\]")).to eq("[\]")
61
- end
62
- it "should convert half-width ASCII symbol after lower-case to full-width" do
63
- expect(Charwidth.to_full_width("{|}")).to eq("{|}")
64
- end
65
-
66
- it "should convert half-width CJK punctuation to full-width" do
67
- expect(Charwidth.to_full_width("、。「」")).to eq("、。「」")
68
- end
69
-
70
- it "should convert half-width katakana to full-width" do
71
- expect(Charwidth.to_full_width("アカサタナハマヤラワヲンァャッー・")).to eq("アカサタナハマヤラワヲンァャッー・")
72
- expect(Charwidth.to_full_width("タチツテトナニヌネノ")).to eq("タチツテトナニヌネノ")
73
- end
74
-
75
- it "should unify half-width (semi) voiced katakana with dakuon to full-width" do
76
- expect(Charwidth.to_full_width("ガザダバパ")).to eq("ガザダバパ")
77
- end
78
-
79
- it "should convert half-width hangul to full-width" do
80
- expect(Charwidth.to_full_width("アカサタナハマヤラワヲンァャッー・")).to eq("アカサタナハマヤラワヲンァャッー・")
81
- end
82
-
83
- it "should convert SPACE to IDIOGRAPHIC-SPACE" do
84
- expect(Charwidth.to_full_width(" ")).to eq("\u3000")
85
- end
86
- end
87
- end
data/spec/spec_helper.rb DELETED
@@ -1,14 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require "rspec"
4
- require "rspec/its"
5
- require "charwidth"
6
- require "byebug"
7
-
8
- # Requires supporting files with custom matchers and macros, etc,
9
- # in ./support/ and its subdirectories.
10
- Dir["#{__dir__}/support/**/*.rb"].sort.each {|f| require f }
11
-
12
- RSpec.configure do |config|
13
- # noop
14
- end