Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Tests

'on':
- push
- pull_request

jobs:
rubocop:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install ruby-3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby-3.2
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop --parallel

test:
name: "Test ${{matrix.ruby}}"
env:
CI: true
runs-on: ubuntu-22.04
continue-on-error: "${{matrix.experimental || false}}"
strategy:
fail-fast: false
matrix:
ruby:
- ruby-2.6
- ruby-2.7
- ruby-3.0
- ruby-3.1
- ruby-3.2
- jruby-9.3
- jruby-9.4
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: "Install ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
- name: Run tests
run: |
bundle exec rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ doc
script
*.gem
exp
Gemfile.lock
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
12 changes: 12 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.6
NewCops: enable

RSpec/DescribedClass:
Enabled: false
54 changes: 54 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 1000`
# on 2023-04-20 21:06:39 UTC using RuboCop version 1.50.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 31

# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 3
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 25

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 174

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 9

# Offense count: 6
RSpec/MultipleExpectations:
Max: 5

# Offense count: 4
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/moji.rb'
- 'lib/moji/detail.rb'
- 'lib/moji/flag_set.rb'
- 'lib/moji/flags.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

### 2023/04/21 - v2.0.0

- Remove GREEK, CYRILLIC, and LINE constants.
- Fix a bug where Moji.type? was returning true for unknown types.
- Move all classes under Moji namespace.
- Drop support for Ruby 2.5 and earlier.
- Add Rubocop.
- Add Github Actions.
- Add RSpec tests.
- Code cleanup.

### 2010/9/19 - v1.5.0

- Ruby 1.9に対応。

### 2008/8/30 - v1.4.0

- Moji.type("\n")がnilを返すバグを修正。(thanks to 橋爪さん)

### 2006/7/23 - v1.3.0

- 半角中黒(・)の字種判別、全角中黒との相互変換ができていなかったのを修正。(thanks to xyzzyさん)

### 2006/10/5 - v1.2.0

- *EUC 以外の文字コードにも対応し、ライブラリ名を Moji に変更。
- han_to_zen, zen_to_han の対象文字種のデフォルトを全て( (({ALL})) )に。
- normalize_zen_han 追加。

### 2005/1/3 - v1.1.0

- (({$KCODE})) が指定されていないとEUCUtil.typeが正常動作しない問題を修正。
- 定数に (({ASYMBOL})) と (({JSYMBOL})) を追加。

### 2004/11/16 - v1.0.0

- EUCUtil 公開。
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

group :development, :test do
gem 'rspec'
gem 'rubocop', '~> 1.49.0'
gem 'rubocop-performance', '~> 1.16.0'
gem 'rubocop-rspec', '~> 2.19.0'
end
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) Hiroshi Ichikawa

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading