cureutils 1.1.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90d25e39bd4085788158a6cd882b3034d2e8f74307598ee4897fa5121f00dc8
4
- data.tar.gz: 3ff1a7babf0e27cb7a1a80fed1cf75a54c412ff50a71bd206d83933d776faeb1
3
+ metadata.gz: b4087fd092908eb5ad6e4e1ca3fe6115315f58208acd62fb7b74e2302742141f
4
+ data.tar.gz: 3d24edb4069d72b2e60f1f0b2fc8fda2c8ed069ace9aaf42856367c5f311366f
5
5
  SHA512:
6
- metadata.gz: 27447af338d7ae3c5f4ff764f5d1d95fb6e683ddbdb50fd595fc699d645d5bed5d4ac07f3c81ab4f885ae5a79a9e1888bb2431ec828eb65a1e5ae7fda393aa9a
7
- data.tar.gz: bc11984f1da210d77fd1ff4d32c998f51258f15083f9f5f4e49eff9de598c651f5e5117e8ac35de408193c22d8b5bc30cac72b446e329a1c48d19d8594faed72
6
+ metadata.gz: e35b963fb4d2326bce0b2ff9433cd0dc9652d2d0b3052cbd8ffcea09d04ce2fbc934a370ed3297f3c8a4c3d9120dbccbebc4a141a678063d1aeec5dc86aff002
7
+ data.tar.gz: cf016c599b3521362793dc69c942664f88b0dd74901c8fae08b6690167b7ec28ea3e8b81152673b0715d22fd27e6109d05283bfb6b6042b34df0e4187c5ec6fe
@@ -24,4 +24,4 @@ matrix:
24
24
  sudo: false
25
25
 
26
26
  script:
27
- - bash test/test.sh
27
+ - bundle exec rspec
@@ -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
  #
@@ -3,7 +3,7 @@ module Cureutils
3
3
  class Version
4
4
  MAJOR = 1
5
5
  MINOR = 1
6
- PATCH = 0
6
+ PATCH = 1
7
7
  PRE = nil
8
8
 
9
9
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
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.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamada, Yasuhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-04 00:00:00.000000000 Z
11
+ date: 2018-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,7 +123,6 @@ extensions: []
123
123
  extra_rdoc_files: []
124
124
  files:
125
125
  - ".gitignore"
126
- - ".gitmodules"
127
126
  - ".rspec"
128
127
  - ".travis.yml"
129
128
  - Gemfile
@@ -1,3 +0,0 @@
1
- [submodule "test/shunit2"]
2
- path = test/shunit2
3
- url = https://github.com/zandev/shunit2.git