jkf 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ module Jkf
130
130
  s3 = parse_result
131
131
  s3 = nil if s3 == :failed
132
132
  @reported_pos = s0
133
- s0 = -> (hd, tl, res) do
133
+ s0 = lambda do |hd, tl, res|
134
134
  tl.unshift(hd)
135
135
  tl << { 'special' => res } if res && !tl[tl.length - 1]['special']
136
136
  tl
@@ -177,7 +177,7 @@ module Jkf
177
177
  s5 = match_space if s5 == :failed
178
178
  end
179
179
  @reported_pos = s0
180
- s0 = -> (line, c) do
180
+ s0 = lambda do |line, c|
181
181
  ret = { 'move' => line }
182
182
  ret['comments'] = c unless c.empty?
183
183
  ret
@@ -406,6 +406,7 @@ module Jkf
406
406
 
407
407
  str.gsub(/ $/, '').split(' ').each do |kind|
408
408
  next if kind.empty?
409
+
409
410
  ret[kind2csa(kind[0])] = kind.length == 1 ? 1 : kan2n2(kind[1..-1])
410
411
  end
411
412
 
@@ -539,9 +539,7 @@ module Jkf
539
539
  end
540
540
  transform_root_header_data(ret) if ret['initial'] && ret['initial']['data']
541
541
  transform_root_forks(forks, moves)
542
- if ret['initial'] && ret['initial']['data'] && ret['initial']['data']['color'] == 1
543
- reverse_color(ret['moves'])
544
- end
542
+ reverse_color(ret['moves']) if ret['initial'] && ret['initial']['data'] && ret['initial']['data']['color'] == 1
545
543
  ret
546
544
  end
547
545
 
@@ -600,6 +598,7 @@ module Jkf
600
598
 
601
599
  str.split(/[  ]/).each do |kind|
602
600
  next if kind.empty?
601
+
603
602
  ret[kind2csa(kind[0])] = kind.length == 1 ? 1 : kan2n2(kind[1..-1])
604
603
  end
605
604
 
@@ -609,9 +608,7 @@ module Jkf
609
608
  # exchange sente gote
610
609
  def reverse_color(moves)
611
610
  moves.each do |move|
612
- if move['move'] && move['move']['color']
613
- move['move']['color'] = (move['move']['color'] + 1) % 2
614
- end
611
+ move['move']['color'] = (move['move']['color'] + 1) % 2 if move['move'] && move['move']['color']
615
612
  move['forks']&.each { |fork| reverse_color(fork) }
616
613
  end
617
614
  end
@@ -479,7 +479,7 @@ module Jkf
479
479
  end
480
480
  end
481
481
 
482
- # nonl :
482
+ # nonl :
483
483
  def parse_nonl
484
484
  match_regexp(/[^\r\n]/)
485
485
  end
@@ -517,7 +517,7 @@ module Jkf
517
517
  make_hand(ret['header']['先手の持駒'] || ret['header']['下手の持駒']),
518
518
  make_hand(ret['header']['後手の持駒'] || ret['header']['上手の持駒'])
519
519
  ]
520
- %w(先手の持駒 下手の持駒 後手の持駒 上手の持駒).each do |key|
520
+ %w[先手の持駒 下手の持駒 後手の持駒 上手の持駒].each do |key|
521
521
  ret['header'].delete(key)
522
522
  end
523
523
  end
data/lib/jkf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jkf
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
data/lib/jkf.rb CHANGED
@@ -49,6 +49,7 @@ module Jkf
49
49
  break
50
50
  end
51
51
  raise FileTypeError if result.nil?
52
+
52
53
  result
53
54
  end
54
55
  end
data/manifest.scm CHANGED
@@ -1,115 +1,17 @@
1
1
  (use-modules ((guix licenses)
2
2
  #:prefix license:)
3
3
  (gnu packages ruby)
4
+ (gnu packages ruby-check)
5
+ (gnu packages ruby-xyz)
4
6
  (guix build-system ruby)
5
7
  (guix download)
6
- (guix git)
7
8
  (guix packages)
8
- (guix git-download))
9
-
10
- (define-public ruby-guard-rubocop
11
- (package
12
- (name "ruby-guard-rubocop")
13
- (version "1.5.0")
14
- (source (origin
15
- (method url-fetch)
16
- (uri (rubygems-uri "guard-rubocop" version))
17
- (sha256
18
- (base32
19
- "0lb2fgfac97lvgwqvx2gbcimyvw2a0i76x6yabik3vmmvjbdfh9h"))))
20
- (build-system ruby-build-system)
21
- (arguments
22
- `(#:tests? #f)) ;TODO
23
- (propagated-inputs (list ruby-guard ruby-rubocop))
24
- (synopsis
25
- "Automatically checks Ruby code style with RuboCop when files are
26
- modified")
27
- (description
28
- "@code{Guard::RuboCop} automatically checks Ruby code style with
29
- RuboCop when files are modified.")
30
- (home-page "https://github.com/rubocop/guard-rubocop")
31
- (license license:expat)))
32
-
33
- (define-public ruby-guard-compat
34
- (package
35
- (name "ruby-guard-compat")
36
- (version "1.2.1")
37
- (source (origin
38
- (method url-fetch)
39
- (uri (rubygems-uri "guard-compat" version))
40
- (sha256
41
- (base32
42
- "1zj6sr1k8w59mmi27rsii0v8xyy2rnsi09nqvwpgj1q10yq1mlis"))))
43
- (build-system ruby-build-system)
44
- (arguments
45
- `(#:test-target "spec"))
46
- (native-inputs (list ruby-rspec ruby-rubocop))
47
- (synopsis "Helps creating valid Guard plugins and testing them")
48
- (description "guard-compat helps creating valid Guard plugins and testing them.")
49
- (home-page "https://github.com/guard/guard-compat")
50
- (license license:expat)))
51
-
52
- (define-public ruby-gem-isolator
53
- (package
54
- (name "ruby-gem-isolator")
55
- (version "0.2.3")
56
- (source (origin
57
- (method git-fetch)
58
- (uri (git-reference
59
- (url "https://github.com/e2/gem_isolator")
60
- (commit "1ec35362d946e682089a3983e7063593231d5188")))
61
- (file-name (git-file-name name version))
62
- (sha256
63
- (base32
64
- "1kkg7y2lw2jpdcdw33f2pvz9q14rlnx29l3a2qcwc5smivd03kww"))))
65
- (build-system ruby-build-system)
66
- (arguments
67
- `(#:test-target "spec"
68
- #:tests? #f ;FIXME: uninitialized constant Pathname
69
- ))
70
- (native-inputs (list ruby-rspec ruby-nenv ruby-rubocop))
71
- (propagated-inputs (list ruby-dep))
72
- (synopsis
73
- "Good for testing dependencies of a gem and/or different gem version
74
- combinations")
75
- (description
76
- "gem_isolator is good for testing dependencies of a gem and/or
77
- different gem version combinations.")
78
- (home-page "https://github.com/e2/gem_isolator")
79
- (license license:expat)))
80
-
81
- (define-public ruby-guard-rspec
82
- (package
83
- (name "ruby-guard-rspec")
84
- (version "4.7.3")
85
- (source (origin
86
- (method url-fetch)
87
- (uri (rubygems-uri "guard-rspec" version))
88
- (sha256
89
- (base32
90
- "1jkm5xp90gm4c5s51pmf92i9hc10gslwwic6mvk72g0yplya0yx4"))))
91
- (build-system ruby-build-system)
92
- (arguments
93
- `(#:test-target "spec"
94
- #:tests? #f ;FIXME: uninitialized constant Bundler
95
- ))
96
- (native-inputs (list ruby-rubocop ruby-launchy ruby-gem-isolator bundler ruby))
97
- (propagated-inputs (list ruby-guard ruby-guard-compat ruby-rspec))
98
- (synopsis "Automatically run your specs (much like autotest)")
99
- (description
100
- "@code{Guard::RSpec} automatically run your specs (much like autotest).")
101
- (home-page "https://github.com/guard/guard-rspec")
102
- (license license:expat)))
9
+ (guix git-download)
10
+ (guix profiles))
103
11
 
104
12
  (packages->manifest (list ruby-rake
105
13
  ruby-yard
106
- ruby-redcarpet
107
- ruby-rubocop
108
- ruby-guard-rubocop
109
- ruby-rubocop-rake
110
- ruby-rubocop-rspec
111
14
  ruby-rspec
112
15
  ruby-simplecov
113
16
  ruby-benchmark-ips
114
- ruby-rubocop-performance
115
17
  ruby))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jkf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - iyuuya
@@ -9,10 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-10-26 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2025-07-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  description: The jkf gem provides parsers and converters (generaters) for several
15
- shogi formats.
29
+ shogi formats, including json-kifu-format, KIF, KI2, and CSA.
16
30
  email:
17
31
  - i.yuuya@gmail.com
18
32
  - gemmaro.dev@gmail.com
@@ -21,23 +35,16 @@ extensions: []
21
35
  extra_rdoc_files: []
22
36
  files:
23
37
  - ".envrc"
24
- - ".github/workflows/ci.yml"
25
38
  - ".gitignore"
26
- - ".hound.yml"
27
39
  - ".rspec"
28
- - ".rubocop.yml"
29
- - ".rubocop_todo.yml"
30
40
  - ".yardopts"
31
41
  - CHANGELOG.md
32
42
  - Gemfile
33
- - Guardfile
34
43
  - LICENSE.txt
35
44
  - README.en.md
36
45
  - README.md
37
46
  - Rakefile
38
47
  - bench.rb
39
- - bin/console
40
- - bin/setup
41
48
  - jkf.gemspec
42
49
  - lib/jkf.rb
43
50
  - lib/jkf/converter.rb
@@ -58,7 +65,7 @@ files:
58
65
  - po/en.po
59
66
  - po/en.rdoc.po
60
67
  - po4a.cfg
61
- homepage: https://github.com/iyuuya/jkf
68
+ homepage: https://sourceforge.net/projects/ruby-jkf/
62
69
  licenses:
63
70
  - MIT
64
71
  metadata:
@@ -79,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
86
  - !ruby/object:Gem::Version
80
87
  version: '0'
81
88
  requirements: []
82
- rubygems_version: 3.3.26
89
+ rubygems_version: 3.5.22
83
90
  signing_key:
84
91
  specification_version: 4
85
92
  summary: Shogi formats parser and converter
@@ -1,16 +0,0 @@
1
- name: CI
2
- on: [push, pull_request]
3
- jobs:
4
- test:
5
- strategy:
6
- fail-fast: false
7
- matrix:
8
- ruby: ['3.0', '3.1', '3.2']
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v3
12
- - uses: ruby/setup-ruby@v1
13
- with:
14
- ruby-version: ${{ matrix.ruby }}
15
- bundler-cache: true
16
- - run: bundle exec rake
data/.hound.yml DELETED
@@ -1,3 +0,0 @@
1
- ruby:
2
- enabled: true
3
- config_file: .rubocop.yml
data/.rubocop.yml DELETED
@@ -1,75 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- NewCops: enable
5
- DisabledByDefault: true
6
-
7
- require:
8
- - rubocop-rake
9
- - rubocop-rspec
10
- - rubocop-performance
11
-
12
- Style/FrozenStringLiteralComment:
13
- Enabled: true
14
- EnforcedStyle: never
15
-
16
- Layout/HashAlignment:
17
- Enabled: true
18
- EnforcedHashRocketStyle: key # キーが全角文字の場合が多いため
19
-
20
- Lint/AssignmentInCondition:
21
- Enabled: true
22
-
23
- Lint/DuplicateBranch:
24
- Enabled: false # FIXME
25
-
26
- Lint/UnderscorePrefixedVariableName:
27
- Enabled: true
28
-
29
- Naming/AccessorMethodName:
30
- Enabled: true
31
-
32
- RSpec/DescribedClass:
33
- Enabled: true
34
-
35
- Style/ClassAndModuleChildren:
36
- Enabled: true
37
-
38
- Style/Encoding:
39
- Enabled: true
40
-
41
- Style/ExpandPathArguments:
42
- Enabled: true
43
-
44
- Style/HashLikeCase:
45
- Enabled: true
46
-
47
- Style/NegatedIf:
48
- Enabled: true
49
-
50
- Style/RedundantAssignment:
51
- Enabled: true
52
-
53
- Style/RedundantReturn:
54
- Enabled: true
55
-
56
- Style/RescueStandardError:
57
- Enabled: true
58
-
59
- Style/SafeNavigation:
60
- Enabled: true
61
-
62
- Style/StringLiterals:
63
- Enabled: true
64
-
65
- Style/GuardClause:
66
- Enabled: true
67
-
68
- Performance/StringInclude:
69
- Enabled: true
70
-
71
- Performance/RegexpMatch:
72
- Enabled: true
73
-
74
- Performance/MapCompact:
75
- Enabled: true
data/.rubocop_todo.yml DELETED
@@ -1,7 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2023-06-18 08:39:04 UTC using RuboCop version 1.48.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
data/Guardfile DELETED
@@ -1,27 +0,0 @@
1
- scope(groups: %w(specs))
2
-
3
- directories %w(spec lib)
4
-
5
- group :specs, halt_on_fail: true do
6
- guard :rspec, cmd: 'bundle exec rspec', failed_mode: :keep do
7
- require 'guard/rspec/dsl'
8
- dsl = Guard::RSpec::Dsl.new(self)
9
-
10
- # RSpec files
11
- rspec = dsl.rspec
12
- watch(rspec.spec_helper) { rspec.spec_dir }
13
- watch(rspec.spec_support) { rspec.spec_dir }
14
- watch(rspec.spec_files)
15
-
16
- # Ruby files
17
- ruby = dsl.ruby
18
- dsl.watch_spec_files_for(ruby.lib_files)
19
- end
20
-
21
- guard :rubocop, all_on_start: false, cli: '--rails' do
22
- watch(%r{.+\.rb$}) { |m| m[0] }
23
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
24
- end
25
- end
26
-
27
- # vim: ft=ruby
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'jkf'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- if require 'pry'
11
- Pry.start
12
- else
13
- require 'irb'
14
- IRB.start
15
- end
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here