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 +4 -4
- data/.travis.yml +1 -1
- data/lib/cureutils/cli.rb +6 -6
- data/lib/cureutils/logic/base_logic.rb +0 -1
- data/lib/cureutils/logic/date_logic.rb +6 -2
- data/lib/cureutils/logic/echo_logic.rb +7 -3
- data/lib/cureutils/logic/grep_logic.rb +2 -1
- data/lib/cureutils/logic/janken_logic.rb +3 -3
- data/lib/cureutils/logic/translate_logic.rb +1 -1
- data/lib/cureutils/version.rb +1 -1
- metadata +2 -3
- data/.gitmodules +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4087fd092908eb5ad6e4e1ca3fe6115315f58208acd62fb7b74e2302742141f
|
4
|
+
data.tar.gz: 3d24edb4069d72b2e60f1f0b2fc8fda2c8ed069ace9aaf42856367c5f311366f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35b963fb4d2326bce0b2ff9433cd0dc9652d2d0b3052cbd8ffcea09d04ce2fbc934a370ed3297f3c8a4c3d9120dbccbebc4a141a678063d1aeec5dc86aff002
|
7
|
+
data.tar.gz: cf016c599b3521362793dc69c942664f88b0dd74901c8fae08b6690167b7ec28ea3e8b81152673b0715d22fd27e6109d05283bfb6b6042b34df0e4187c5ec6fe
|
data/.travis.yml
CHANGED
data/lib/cureutils/cli.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
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
|
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,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
data/lib/cureutils/version.rb
CHANGED
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.
|
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-
|
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
|
data/.gitmodules
DELETED