cureutils 1.1.0 → 1.4.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
2
  SHA256:
3
- metadata.gz: e90d25e39bd4085788158a6cd882b3034d2e8f74307598ee4897fa5121f00dc8
4
- data.tar.gz: 3ff1a7babf0e27cb7a1a80fed1cf75a54c412ff50a71bd206d83933d776faeb1
3
+ metadata.gz: ea50c9084370c1ef9a414d4addc85cdd1f073e42358358d61f4478b156be6eb0
4
+ data.tar.gz: 1233ec304e3fd160d41b4938bb6bd79a697dbd53ac34b0b20a5d7f2abaed56cd
5
5
  SHA512:
6
- metadata.gz: 27447af338d7ae3c5f4ff764f5d1d95fb6e683ddbdb50fd595fc699d645d5bed5d4ac07f3c81ab4f885ae5a79a9e1888bb2431ec828eb65a1e5ae7fda393aa9a
7
- data.tar.gz: bc11984f1da210d77fd1ff4d32c998f51258f15083f9f5f4e49eff9de598c651f5e5117e8ac35de408193c22d8b5bc30cac72b446e329a1c48d19d8594faed72
6
+ metadata.gz: 1e9f9bfa238ac3ba52a9097b59036d10a537db24064c55e7433c6042b287cc2a8e57414659889d1c1d369f3089d98acb96c68cf10b91206f8856df51a6d2a55f
7
+ data.tar.gz: d76a19cf974711921cd2007259672ad1fdf7df1d21c52053dfae618263100068b264bb1f3c1557d62fc2cba67dd2d6fc9565e7bcde03b5b3c3e317e57d4c1918
@@ -0,0 +1,61 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - 'bugfix/**'
8
+ - 'feature/**'
9
+ pull_request:
10
+ types:
11
+ - opened
12
+ - synchronize
13
+ - reopened
14
+ schedule:
15
+ - cron: "0 0 * * 6"
16
+
17
+ env:
18
+ RUBYOPT: -EUTF-8
19
+
20
+ # Some configures are inspired by https://github.com/sue445/rubicure/blob/master/.github/workflows/test.yml
21
+ jobs:
22
+ test:
23
+ runs-on: ubuntu-latest
24
+ container: ${{ matrix.ruby }}
25
+
26
+ strategy:
27
+ matrix:
28
+ ruby:
29
+ - ruby:2.4
30
+ - ruby:2.5
31
+ - ruby:2.6
32
+ - ruby:2.7
33
+ - ruby:3.0
34
+ - rubylang/ruby:master-nightly-bionic
35
+ include:
36
+ - ruby: rubylang/ruby:master-nightly-bionic
37
+ allow_failures: "true"
38
+
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+
42
+ - name: Cache vendor/bundle
43
+ uses: actions/cache@v1
44
+ id: cache_gem
45
+ with:
46
+ path: vendor/bundle
47
+ key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
48
+ restore-keys: |
49
+ v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
50
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
51
+
52
+ - name: bundle update
53
+ run: |
54
+ set -xe
55
+ bundle config path vendor/bundle
56
+ bundle update --jobs $(nproc) --retry 3
57
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
58
+
59
+ - run: bundle exec rspec
60
+ timeout-minutes: 1
61
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  /tags
11
11
  /.byebug_history
12
+ /.ruby-version
data/.travis.yml CHANGED
@@ -2,20 +2,27 @@ language: ruby
2
2
 
3
3
  rvm:
4
4
  - 2.2.2
5
- - 2.3.3
6
- - 2.4.0
7
- - 2.5.0
5
+ - 2.3
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
9
+ - 2.7
8
10
  - ruby-head
9
11
 
10
12
  before_install:
11
- - gem update --system --no-document
12
- - gem install bundler -v 1.11.2
13
+ - travis_retry gem update --system || travis_retry gem update --system 2.7.8
14
+
15
+ install:
16
+ - travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
13
17
  - bundle install
14
18
 
15
19
  branches:
16
- only:
17
- - master
18
- - develop-1.0.0
20
+ only:
21
+ - master
22
+ - develop
23
+ - /^develop-.*/
24
+ - /^bugfix.*/
25
+ - /^feature.*/
19
26
 
20
27
  matrix:
21
28
  allow_failures:
@@ -24,4 +31,4 @@ matrix:
24
31
  sudo: false
25
32
 
26
33
  script:
27
- - bash test/test.sh
34
+ - bundle exec rspec
data/Gemfile CHANGED
@@ -2,7 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cureutils.gemspec
4
4
  gemspec
5
-
6
- if Gem::Version.create(RUBY_VERSION) < Gem::Version.create('2.3.0')
7
- gem 'backport_dig'
8
- end
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  <p align="center">
7
7
  <a href=https://badge.fury.io/rb/cureutils><img src="https://badge.fury.io/rb/cureutils.svg" alt="Gem Version" /></a>
8
- <a href=https://travis-ci.org/greymd/cureutils><img src="https://travis-ci.org/greymd/cureutils.svg?branch=master" alt="Build Status" /></a>
8
+ <a href=https://github.com/greymd/cureutils/actions?query=workflow%3Atest><img src="https://github.com/greymd/cureutils/workflows/test/badge.svg?branch=master" alt="Build Status" /></a>
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -306,5 +306,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/greymd
306
306
 
307
307
  ## License
308
308
 
309
+ ### Source code
309
310
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
310
311
 
312
+ ### Logo
313
+ <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />The logo is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.
data/cureutils.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'cureutils'
8
8
  spec.version = Cureutils::Version
9
9
  spec.authors = ['Yamada, Yasuhiro']
10
- spec.email = ['greengregson@gmail.com']
10
+ spec.email = ['yamadagrep@gmail.com']
11
11
  spec.summary = 'Useful commands for battle heroine Pretty Cure (Precure).'
12
12
  spec.description = 'Useful command line tool for Japanese battle heroine Pretty Cure (Precure).'
13
13
  spec.homepage = 'https://github.com/greymd/cureutils'
@@ -16,12 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.bindir = 'bin'
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
- spec.required_ruby_version = '>= 2.2.2'
20
- spec.add_development_dependency 'bundler', '~> 1.11'
21
- spec.add_development_dependency 'rake', '~> 10.0'
19
+ spec.required_ruby_version = '>= 2.4'
20
+ spec.add_development_dependency 'bundler', '>= 1.11'
21
+ spec.add_development_dependency 'rake', '>= 12.3.3'
22
22
  spec.add_development_dependency 'rspec', '~> 3.0'
23
23
  spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
24
- spec.add_dependency 'rubicure', '~> 1.1.0'
24
+ spec.add_dependency 'rubicure', '~> 2.1.0'
25
25
  spec.add_dependency 'colorize', '~> 0.7.7'
26
26
  spec.add_dependency 'activesupport', '>= 5.0.0'
27
27
  end
data/lib/cureutils/cli.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/version'
4
4
  require 'cureutils/common'
5
5
  require 'cureutils/logic/janken_logic'
@@ -18,7 +18,7 @@ module Cureutils
18
18
  #
19
19
  # The class represents the cli interface
20
20
  #
21
- class CLI < Thor
21
+ class CLI < Thor # rubocop:disable Metrics/ClassLength
22
22
  class << self
23
23
  def exit_on_failure?
24
24
  true
@@ -54,7 +54,7 @@ module Cureutils
54
54
  option 'movie', aliases: 'm',
55
55
  type: :boolean,
56
56
  desc: 'Include who have only appeared in the movies.'
57
- def girls
57
+ def girls # rubocop:disable Metrics/MethodLength
58
58
  girls = Precure.all_girls
59
59
  girls.delete(Cure.echo) unless options[:movie]
60
60
  if options['full-name'.to_sym]
@@ -88,7 +88,7 @@ module Cureutils
88
88
  option 'only-matching', aliases: 'o',
89
89
  type: :boolean,
90
90
  desc: 'Print only the matched parts.'
91
- def grep(default_pat = '[:precure_name:]', filename = nil)
91
+ def grep(default_pat = '[:precure_name:]', filename = nil) # rubocop:disable Metrics/AbcSize, Metrics/LineLength
92
92
  logic = GrepLogic.new
93
93
  logic.source_input(filename)
94
94
  logic.pattern(default_pat.clone, options['extended-regexp'.to_sym])
@@ -123,7 +123,7 @@ module Cureutils
123
123
  option 'style', aliases: 's',
124
124
  type: :string,
125
125
  desc: 'Choose style of the transformation.'
126
- def echo
126
+ def echo # rubocop:disable Metrics/AbcSize
127
127
  logic = EchoLogic.new
128
128
  logic.precure(options[:precure])
129
129
  logic.msg_attack(options[:attack])
@@ -139,7 +139,7 @@ module Cureutils
139
139
  desc: '-d STRING: Display time described by STRING.'
140
140
  option 'file', aliases: 'f',
141
141
  type: :string,
142
- desc: '-f DATEFILE: Load each line of DATEFILE as STRING of -d option.'
142
+ desc: '-f DATEFILE: Load each line of DATEFILE as STRING.'
143
143
  # Original date command's default is '+%a %b %e %H:%M:%S %Z %Y @P'
144
144
  # However, I would like to adopt this setting.
145
145
  def date(fmt = '+%F %H:%M:%S @P')
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
3
2
 
4
3
  #
5
4
  # Base class of logic class
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/logic/base_logic'
4
4
  require 'date'
5
5
 
@@ -20,6 +20,7 @@ class DateLogic < BaseLogic
20
20
 
21
21
  def opt_date(given_datetime)
22
22
  return if given_datetime.nil?
23
+
23
24
  @opt_date = true
24
25
  @in = []
25
26
  @in << given_datetime
@@ -27,6 +28,7 @@ class DateLogic < BaseLogic
27
28
 
28
29
  def opt_file(filename)
29
30
  return if filename.nil?
31
+
30
32
  @opt_file = true
31
33
  source_input(filename)
32
34
  end
@@ -35,6 +37,7 @@ class DateLogic < BaseLogic
35
37
 
36
38
  def print_results
37
39
  return 1 unless check_opts
40
+
38
41
  @in.each do |line|
39
42
  given_date = line ? natural_lang2time(line) : Time.now
40
43
  updated_fmt = update_fmt(given_date, @format) if given_date
@@ -48,6 +51,7 @@ class DateLogic < BaseLogic
48
51
  def check_opts
49
52
  # Either option must be true, but both must NOT be same.
50
53
  return true unless @opt_date && @opt_file
54
+
51
55
  @err.puts <<-EOS
52
56
  cure date: the options to specify dates for printing are mutually exclusive.
53
57
  EOS
@@ -58,7 +62,7 @@ cure date: the options to specify dates for printing are mutually exclusive.
58
62
  Date.parse(str)
59
63
  rescue ArgumentError => e
60
64
  @err.puts "cure date: #{e.message} '#{str.chomp}'"
61
- return false
65
+ false
62
66
  end
63
67
 
64
68
  def natural_lang2time(time_str)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/logic/base_logic'
4
4
 
5
5
  # Singleton class for cure echo
@@ -39,9 +39,10 @@ class EchoLogic < BaseLogic
39
39
 
40
40
  def print_results
41
41
  return 1 unless existing_precure?
42
+
42
43
  precure = Cure.send(@cure_name.to_sym)
43
44
  if @message_mode == EchoMode::TRANSFORM
44
- precure = original_transform(precure)
45
+ original_transform(precure)
45
46
  elsif @message_mode == EchoMode::ATTACK
46
47
  precure = original_transform(precure)
47
48
  precure.attack!
@@ -53,6 +54,7 @@ class EchoLogic < BaseLogic
53
54
 
54
55
  def original_transform(precure)
55
56
  return precure.transform! unless transformable?(precure)
57
+
56
58
  chosen_style = @style_priority.find do |s|
57
59
  precure.transform_styles.include?(s)
58
60
  end
@@ -66,7 +68,9 @@ class EchoLogic < BaseLogic
66
68
 
67
69
  def transformable?(precure)
68
70
  return false if precure.transform_calls.nil?
69
- return true if precure.respond_to?(:transform_styles)
71
+
72
+ return true if precure.key?(:transform_styles)
73
+
70
74
  false
71
75
  end
72
76
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/logic/base_logic'
4
4
  require 'colorize'
5
5
 
@@ -38,6 +38,7 @@ class GrepLogic < BaseLogic
38
38
  @in.each do |line|
39
39
  matched_strs = line.send(@match_method, @pattern)
40
40
  next unless matched_strs
41
+
41
42
  exit_status = 0
42
43
  if @only_matched
43
44
  matched_strs.each { |str| @out.puts str.send(@str_color) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/logic/base_logic'
4
4
 
5
5
  #
@@ -15,8 +15,8 @@ class JankenLogic < BaseLogic
15
15
  [1, 2, 0, 1],
16
16
  [0, 1, 2, 1],
17
17
  [0, 0, 0, 2]]
18
- @result_idx = %w(あなたのかち あなたのまけ あいこ)
19
- @te_idx = %w(グー チョキ パー グッチョッパー)
18
+ @result_idx = %w[あなたのかち あなたのまけ あいこ]
19
+ @te_idx = %w[グー チョキ パー グッチョッパー]
20
20
  @te_hash = Hash[[@te_idx, (0..3).map(&:to_s)].transpose]
21
21
  @buf = []
22
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # coding: utf-8
2
+
3
3
  require 'cureutils/logic/base_logic'
4
4
 
5
5
  #
@@ -2,7 +2,7 @@
2
2
  module Cureutils
3
3
  class Version
4
4
  MAJOR = 1
5
- MINOR = 1
5
+ MINOR = 4
6
6
  PATCH = 0
7
7
  PRE = nil
8
8
 
data/zsh-completion/_cure CHANGED
@@ -20,6 +20,7 @@ subcommands=(
20
20
  # ./bin/cure precures -m |./bin/cure tr '[:precure_name:]' '[:girl_name:]' | grep '[[:alnum:]]' | sort | uniq | sed "s/.*/\t'&'/"
21
21
  precure_girl_names=(
22
22
  'cure_ace'
23
+ 'cure_amour'
23
24
  'cure_ange'
24
25
  'cure_aqua'
25
26
  'cure_beat'
@@ -29,31 +30,40 @@ precure_girl_names=(
29
30
  'cure_bloom'
30
31
  'cure_blossom'
31
32
  'cure_chocolat'
33
+ 'cure_coral'
34
+ 'cure_cosmo'
32
35
  'cure_custard'
33
36
  'cure_diamond'
34
37
  'cure_dream'
38
+ 'cure_earth'
35
39
  'cure_echo'
36
40
  'cure_egret'
37
41
  'cure_etoile'
38
42
  'cure_felice'
43
+ 'cure_flamingo'
39
44
  'cure_flora'
45
+ 'cure_fontaine'
40
46
  'cure_fortune'
41
47
  'cure_gelato'
48
+ 'cure_grace'
42
49
  'cure_happy'
43
50
  'cure_heart'
44
51
  'cure_honey'
45
52
  'cure_lemonade'
46
53
  'cure_lovely'
47
54
  'cure_macaron'
55
+ 'cure_macherie'
48
56
  'cure_magical'
49
57
  'cure_march'
50
58
  'cure_marine'
51
59
  'cure_melody'
52
60
  'cure_mermaid'
61
+ 'cure_milky'
53
62
  'cure_mint'
54
63
  'cure_miracle'
55
64
  'cure_moonlight'
56
65
  'cure_muse'
66
+ 'cure_papaya'
57
67
  'cure_parfait'
58
68
  'cure_passion'
59
69
  'cure_peace'
@@ -64,6 +74,11 @@ precure_girl_names=(
64
74
  'cure_rosetta'
65
75
  'cure_rouge'
66
76
  'cure_scarlet'
77
+ 'cure_selene'
78
+ 'cure_soleil'
79
+ 'cure_sparkle'
80
+ 'cure_star'
81
+ 'cure_summer'
67
82
  'cure_sunny'
68
83
  'cure_sunshine'
69
84
  'cure_sword'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cureutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamada, Yasuhiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
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
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
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: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 1.1.0
81
+ version: 2.1.0
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 1.1.0
88
+ version: 2.1.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: colorize
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -116,14 +116,14 @@ dependencies:
116
116
  version: 5.0.0
117
117
  description: Useful command line tool for Japanese battle heroine Pretty Cure (Precure).
118
118
  email:
119
- - greengregson@gmail.com
119
+ - yamadagrep@gmail.com
120
120
  executables:
121
121
  - cure
122
122
  extensions: []
123
123
  extra_rdoc_files: []
124
124
  files:
125
+ - ".github/workflows/test.yml"
125
126
  - ".gitignore"
126
- - ".gitmodules"
127
127
  - ".rspec"
128
128
  - ".travis.yml"
129
129
  - Gemfile
@@ -150,7 +150,7 @@ homepage: https://github.com/greymd/cureutils
150
150
  licenses:
151
151
  - MIT
152
152
  metadata: {}
153
- post_install_message:
153
+ post_install_message:
154
154
  rdoc_options: []
155
155
  require_paths:
156
156
  - lib
@@ -158,16 +158,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - ">="
160
160
  - !ruby/object:Gem::Version
161
- version: 2.2.2
161
+ version: '2.4'
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubyforge_project:
169
- rubygems_version: 2.7.6
170
- signing_key:
168
+ rubygems_version: 3.0.3
169
+ signing_key:
171
170
  specification_version: 4
172
171
  summary: Useful commands for battle heroine Pretty Cure (Precure).
173
172
  test_files: []
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "test/shunit2"]
2
- path = test/shunit2
3
- url = https://github.com/zandev/shunit2.git