rubicure 0.2.4 → 0.2.5
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/.hound.yml +115 -13
- data/.rubocop.yml +2 -23
- data/.tachikoma.yml +1 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +9 -3
- data/Gemfile +1 -1
- data/Rakefile +1 -2
- data/config/girls/012_go_princess.yml +2 -2
- data/lib/rubicure.rb +3 -3
- data/lib/rubicure/core.rb +1 -1
- data/lib/rubicure/cure.rb +5 -5
- data/lib/rubicure/girl.rb +55 -56
- data/lib/rubicure/movie.rb +41 -41
- data/lib/rubicure/series.rb +46 -43
- data/lib/rubicure/version.rb +1 -1
- data/lib/ubicure.rb +1 -1
- data/rubicure.gemspec +7 -7
- data/spec/core_spec.rb +1 -1
- data/spec/cure_spec.rb +14 -14
- data/spec/girl_spec.rb +8 -8
- data/spec/movie_spec.rb +1 -2
- data/spec/rubicure_spec.rb +6 -6
- data/spec/series_spec.rb +4 -2
- data/spec/spec_helper.rb +73 -75
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c80e77cad5c6641ce8388a541660de5711750f6
|
4
|
+
data.tar.gz: 3170324d8e5caaea97a16fc5a1bcde2e1fbde261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85f590162caacf2ae584444fc3539f6ef9d882a0aa81e9c0787cb363af442e33a57817e86a70e9a39196be6f3346c0b186d4b849793be5c73a487ff74ea81050
|
7
|
+
data.tar.gz: d6c07c54fd2566fe7bc29fd647f5523d4dd0c670b9000de7318c81f53b5b76f4812620419b7193b50ac1b7f90bbf5ce50a7dac0e55e52be748cd9d3e9627855a
|
data/.hound.yml
CHANGED
@@ -1,25 +1,127 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# target_version:
|
2
|
+
# rubocop v0.30.0
|
3
|
+
|
4
|
+
# Exclude autogenerated files
|
5
|
+
AllCops:
|
6
|
+
Exclude:
|
7
|
+
- "vendor/**/*" # rubocop config/default.yml
|
8
|
+
- "db/schema.rb"
|
9
|
+
DisplayCopNames: true
|
10
|
+
|
11
|
+
##################### Style ##################################
|
12
|
+
|
13
|
+
Style/AndOr:
|
14
|
+
EnforcedStyle: conditionals
|
15
|
+
|
16
|
+
Style/AsciiComments:
|
5
17
|
Enabled: false
|
6
|
-
|
18
|
+
|
19
|
+
Style/BlockDelimiters:
|
7
20
|
Enabled: false
|
8
|
-
|
21
|
+
|
22
|
+
Style/BracesAroundHashParameters:
|
9
23
|
Enabled: false
|
10
|
-
|
24
|
+
|
25
|
+
Style/DeprecatedHashMethods:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/Documentation:
|
11
29
|
Enabled: false
|
12
|
-
|
30
|
+
|
31
|
+
Style/DoubleNegation:
|
13
32
|
Enabled: false
|
14
|
-
|
33
|
+
|
34
|
+
Style/DotPosition:
|
35
|
+
EnforcedStyle: trailing
|
36
|
+
|
37
|
+
Style/EmptyElse:
|
38
|
+
EnforcedStyle: empty
|
39
|
+
|
40
|
+
Style/FormatString:
|
41
|
+
EnforcedStyle: percent
|
42
|
+
|
43
|
+
Style/GuardClause:
|
44
|
+
MinBodyLength: 5
|
45
|
+
|
46
|
+
Style/HashSyntax:
|
47
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
48
|
+
Exclude:
|
49
|
+
- "**/*.rake"
|
50
|
+
- "Rakefile"
|
51
|
+
|
52
|
+
Style/IfUnlessModifier:
|
15
53
|
Enabled: false
|
16
|
-
|
54
|
+
|
55
|
+
Style/IndentHash:
|
56
|
+
EnforcedStyle: consistent
|
57
|
+
|
58
|
+
Style/Lambda:
|
17
59
|
Enabled: false
|
18
|
-
|
60
|
+
|
61
|
+
Style/NumericLiterals:
|
62
|
+
MinDigits: 6
|
63
|
+
|
64
|
+
Style/PredicateName:
|
19
65
|
Enabled: false
|
66
|
+
|
67
|
+
Style/RedundantSelf:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Style/RedundantReturn:
|
71
|
+
AllowMultipleReturnValues: true
|
72
|
+
|
20
73
|
Style/SignalException:
|
74
|
+
EnforcedStyle: only_raise
|
75
|
+
|
76
|
+
Style/SpaceAroundOperators:
|
77
|
+
MultiSpaceAllowedForOperators:
|
78
|
+
- "="
|
79
|
+
- "=>"
|
80
|
+
- "||"
|
81
|
+
|
82
|
+
Style/StringLiterals:
|
83
|
+
EnforcedStyle: double_quotes
|
84
|
+
|
85
|
+
Style/StringLiteralsInInterpolation:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/SingleLineBlockParams:
|
21
89
|
Enabled: false
|
22
|
-
|
90
|
+
|
91
|
+
Style/SingleSpaceBeforeFirstArg:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/TrailingComma:
|
95
|
+
EnforcedStyleForMultiline: comma
|
96
|
+
|
97
|
+
##################### Lint ##################################
|
98
|
+
|
99
|
+
Lint/UnderscorePrefixedVariableName:
|
23
100
|
Enabled: false
|
24
|
-
|
101
|
+
|
102
|
+
Lint/UnusedMethodArgument:
|
25
103
|
Enabled: false
|
104
|
+
|
105
|
+
##################### Metrics ##################################
|
106
|
+
|
107
|
+
Metrics/AbcSize:
|
108
|
+
Max: 30
|
109
|
+
|
110
|
+
Metrics/CyclomaticComplexity:
|
111
|
+
Max: 10
|
112
|
+
|
113
|
+
Metrics/LineLength:
|
114
|
+
Max: 160
|
115
|
+
Exclude:
|
116
|
+
- "db/migrate/*.rb"
|
117
|
+
|
118
|
+
Metrics/MethodLength:
|
119
|
+
Max: 20
|
120
|
+
Exclude:
|
121
|
+
- "db/migrate/*.rb"
|
122
|
+
|
123
|
+
Metrics/PerceivedComplexity:
|
124
|
+
Max: 8
|
125
|
+
|
126
|
+
Metrics/ClassLength:
|
127
|
+
Max: 120
|
data/.rubocop.yml
CHANGED
@@ -1,23 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Max: 130
|
4
|
-
Style/SpaceInsideParens:
|
5
|
-
Enabled: false
|
6
|
-
Style/SpaceBeforeBlockBraces:
|
7
|
-
Enabled: false
|
8
|
-
StringLiterals:
|
9
|
-
Enabled: false
|
10
|
-
Style/TrailingComma:
|
11
|
-
Enabled: false
|
12
|
-
Style/BlockComments:
|
13
|
-
Enabled: false
|
14
|
-
Style/NilComparison:
|
15
|
-
Enabled: false
|
16
|
-
Style/Documentation:
|
17
|
-
Enabled: false
|
18
|
-
Style/RegexpLiteral:
|
19
|
-
Enabled: false
|
20
|
-
Style/SignalException:
|
21
|
-
Enabled: false
|
22
|
-
Style/CaseEquality:
|
23
|
-
Enabled: false
|
1
|
+
inherit_from:
|
2
|
+
- .hound.yml
|
data/.tachikoma.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
strategy: 'bundler'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
## master
|
2
|
-
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.
|
2
|
+
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.5...master)
|
3
3
|
|
4
|
-
## v0.2.
|
4
|
+
## v0.2.5
|
5
|
+
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.4...v0.2.5)
|
6
|
+
|
7
|
+
* Fix typo
|
8
|
+
* https://github.com/sue445/rubicure/pull/78
|
9
|
+
|
10
|
+
## v0.2.4
|
5
11
|
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.3...v0.2.4)
|
6
12
|
|
7
13
|
* Tweak transform message
|
8
14
|
* https://github.com/sue445/rubicure/pull/76
|
9
15
|
|
10
|
-
## v0.2.
|
16
|
+
## v0.2.3
|
11
17
|
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.2.1...v0.2.3)
|
12
18
|
|
13
19
|
* Add Go! Princess Precure
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -36,7 +36,7 @@ cure_mermaid: &cure_mermaid
|
|
36
36
|
attack_messages:
|
37
37
|
- |
|
38
38
|
エクスチェンジ!モードエレガント!
|
39
|
-
|
39
|
+
高鳴れ、海よ!プリキュア・マーメイド・リップル!
|
40
40
|
(ドリーミング)
|
41
41
|
ごきげんよう
|
42
42
|
transform_calls:
|
@@ -58,7 +58,7 @@ cure_twinkle: &cure_twinkle
|
|
58
58
|
attack_messages:
|
59
59
|
- |
|
60
60
|
エクスチェンジ!モードエレガント!
|
61
|
-
|
61
|
+
キラキラ、星よ!プリキュア・トゥインクル・ハミング!
|
62
62
|
(ドリーミング)
|
63
63
|
ごきげんよう
|
64
64
|
transform_calls:
|
data/lib/rubicure.rb
CHANGED
data/lib/rubicure/core.rb
CHANGED
data/lib/rubicure/cure.rb
CHANGED
@@ -10,10 +10,10 @@ module Cure
|
|
10
10
|
[Cure.peace, Cure.cure_peace].each do |peace|
|
11
11
|
class << peace
|
12
12
|
HANDS =
|
13
|
-
([
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
(["グー"] * 13) +
|
14
|
+
(["チョキ"] * 14) +
|
15
|
+
(["パー"] * 15) +
|
16
|
+
["グッチョッパー"]
|
17
17
|
MESSAGE = <<EOF
|
18
18
|
ピカピカピカリン
|
19
19
|
ジャンケンポン!
|
@@ -22,7 +22,7 @@ EOF
|
|
22
22
|
def pikarin_janken
|
23
23
|
print_by_line(MESSAGE % HANDS.sample)
|
24
24
|
end
|
25
|
-
|
25
|
+
alias_method :janken, :pikarin_janken
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/lib/rubicure/girl.rb
CHANGED
@@ -9,14 +9,8 @@ module Rubicure
|
|
9
9
|
|
10
10
|
attr_writer :io
|
11
11
|
|
12
|
-
@@cache = {}
|
13
|
-
@@config = nil
|
14
|
-
@@colors = nil
|
15
|
-
@@sleep_sec = 1
|
16
|
-
|
17
12
|
def current_state
|
18
13
|
@current_state ||= 0
|
19
|
-
@current_state
|
20
14
|
end
|
21
15
|
|
22
16
|
def state_names
|
@@ -35,7 +29,7 @@ module Rubicure
|
|
35
29
|
def name
|
36
30
|
state_names[current_state]
|
37
31
|
end
|
38
|
-
|
32
|
+
alias_method :to_s, :name
|
39
33
|
|
40
34
|
# human -> precure ( -> extra forms ) -> human ...
|
41
35
|
# @return [Rubicure::Girl] self
|
@@ -50,7 +44,7 @@ module Rubicure
|
|
50
44
|
@current_state = 0
|
51
45
|
self
|
52
46
|
end
|
53
|
-
|
47
|
+
alias_method :humanize, :humanize!
|
54
48
|
deprecate humanize: "Use #humanize! instead of #humanize"
|
55
49
|
|
56
50
|
def attack!
|
@@ -61,63 +55,68 @@ module Rubicure
|
|
61
55
|
current_attack_message
|
62
56
|
end
|
63
57
|
|
64
|
-
|
65
|
-
|
66
|
-
def self.find(girl_name)
|
67
|
-
raise "unknown girl: #{girl_name}" unless valid?(girl_name)
|
58
|
+
class << self
|
59
|
+
attr_writer :sleep_sec
|
68
60
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
61
|
+
# @param girl_name [Symbol]
|
62
|
+
# @return [Rubicure::Girl]
|
63
|
+
def find(girl_name)
|
64
|
+
raise "unknown girl: #{girl_name}" unless valid?(girl_name)
|
73
65
|
|
74
|
-
|
75
|
-
|
66
|
+
@cache ||= {}
|
67
|
+
unless @cache[girl_name]
|
68
|
+
girl_config = config[girl_name] || {}
|
69
|
+
@cache[girl_name] = Rubicure::Girl[girl_config].tap { |girl| girl.io = $stdout }
|
70
|
+
end
|
76
71
|
|
77
|
-
|
78
|
-
|
79
|
-
config.keys
|
80
|
-
end
|
72
|
+
@cache[girl_name]
|
73
|
+
end
|
81
74
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
uniq_names << name unless uniq_names.any? { |uniq_name| config[uniq_name][:precure_name] == girl[:precure_name] }
|
75
|
+
# @return [Array<Symbol>]
|
76
|
+
def names
|
77
|
+
config.keys
|
86
78
|
end
|
87
|
-
end
|
88
79
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
80
|
+
# @return [Array<Symbol>]
|
81
|
+
def uniq_names
|
82
|
+
config.each_with_object([]) do |(name, girl), uniq_names|
|
83
|
+
uniq_names << name unless uniq_names.any? { |uniq_name| config[uniq_name][:precure_name] == girl[:precure_name] }
|
84
|
+
end
|
93
85
|
end
|
94
|
-
@@config
|
95
|
-
end
|
96
86
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
87
|
+
# @return [Hash] content of config/girls/*.yml
|
88
|
+
def config
|
89
|
+
unless @config
|
90
|
+
@config = SengiriYaml.load_dir("#{File.dirname(__FILE__)}/../../config/girls").deep_symbolize_keys
|
91
|
+
end
|
92
|
+
@config
|
93
|
+
end
|
104
94
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
95
|
+
# @return [Hash] content of config/precure.yml
|
96
|
+
def reload_config!
|
97
|
+
@cache = {}
|
98
|
+
@config = nil
|
99
|
+
@colors = nil
|
100
|
+
config
|
101
|
+
end
|
109
102
|
|
110
|
-
|
111
|
-
|
112
|
-
|
103
|
+
# @param [Symbol] girl_name
|
104
|
+
def valid?(girl_name)
|
105
|
+
names.include?(girl_name)
|
106
|
+
end
|
107
|
+
|
108
|
+
def sleep_sec
|
109
|
+
@sleep_sec ||= 1
|
110
|
+
end
|
113
111
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
# return defined colors
|
113
|
+
# @return [Array<Symbol>]
|
114
|
+
def colors
|
115
|
+
unless @colors
|
116
|
+
@colors = config.values.each_with_object([]) { |girl, colors| colors << girl[:color].to_sym }.uniq.sort
|
117
|
+
end
|
118
|
+
@colors
|
119
119
|
end
|
120
|
-
@@colors
|
121
120
|
end
|
122
121
|
|
123
122
|
colors.each do |color|
|
@@ -141,7 +140,7 @@ module Rubicure
|
|
141
140
|
def print_by_line(message)
|
142
141
|
index = 0
|
143
142
|
message.each_line do |line|
|
144
|
-
sleep(
|
143
|
+
sleep(self.class.sleep_sec) if index > 0
|
145
144
|
@io.puts line
|
146
145
|
index += 1
|
147
146
|
end
|
@@ -152,8 +151,8 @@ module Rubicure
|
|
152
151
|
return super if has_key?(method_name)
|
153
152
|
|
154
153
|
shortened_name = method_name.to_s.
|
155
|
-
|
156
|
-
|
154
|
+
sub(/\Aprecure_|_precure\z/, "").
|
155
|
+
sub(/!\z/, "")
|
157
156
|
|
158
157
|
return transform!(*args) if transform_calls.include?(shortened_name)
|
159
158
|
|
data/lib/rubicure/movie.rb
CHANGED
@@ -5,58 +5,58 @@ module Rubicure
|
|
5
5
|
class Movie < Hash
|
6
6
|
include Hashie::Extensions::MethodAccess
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
class << self
|
9
|
+
# @return [Array<Symbol>]
|
10
|
+
def names
|
11
|
+
config.keys
|
12
|
+
end
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
# @return [Array<Symbol>]
|
15
|
+
def uniq_names
|
16
|
+
uniq_names = []
|
17
|
+
config.each do |name, series|
|
18
|
+
uniq_names << name unless uniq_names.any? { |uniq_name| config[uniq_name][:title] == series[:title] }
|
19
|
+
end
|
20
|
+
uniq_names
|
21
|
+
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
# @return [Hash] content of config/movies.yml
|
24
|
+
def config
|
25
|
+
unless @config
|
26
|
+
config_file = "#{File.dirname(__FILE__)}/../../config/movies.yml"
|
27
|
+
@config = YAML.load_file(config_file).deep_symbolize_keys
|
28
|
+
end
|
29
|
+
@config
|
21
30
|
end
|
22
|
-
uniq_names
|
23
|
-
end
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
# @return [Hash] content of config/movies.yml
|
33
|
+
def reload_config!
|
34
|
+
@cache = {}
|
35
|
+
@config = nil
|
36
|
+
config
|
30
37
|
end
|
31
|
-
@@config
|
32
|
-
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
config
|
39
|
-
end
|
39
|
+
# @param [Symbol] series_name
|
40
|
+
def valid?(series_name)
|
41
|
+
names.include?(series_name)
|
42
|
+
end
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
# @param movie_name [Symbol]
|
45
|
+
# @return [Rubicure::Movie]
|
46
|
+
# @raise arg is invalid
|
47
|
+
def find(movie_name)
|
48
|
+
raise "unknown movie: #{movie_name}" unless valid?(movie_name)
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
raise "unknown movie: #{movie_name}" unless valid?(movie_name)
|
50
|
+
@cache ||= {}
|
51
|
+
unless @cache[movie_name]
|
52
|
+
movie_config = config[movie_name] || {}
|
53
|
+
movie_config.reject! { |_k, v| v.nil? }
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
movie_config.reject! { |k, v| v.nil? }
|
55
|
+
@cache[movie_name] = Rubicure::Movie[movie_config]
|
56
|
+
end
|
55
57
|
|
56
|
-
|
58
|
+
@cache[movie_name]
|
57
59
|
end
|
58
|
-
|
59
|
-
@@cache[movie_name]
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/lib/rubicure/series.rb
CHANGED
@@ -6,8 +6,8 @@ module Rubicure
|
|
6
6
|
include Rubicure::Concerns::Util
|
7
7
|
include Enumerable
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
@cache = {}
|
10
|
+
@config = nil
|
11
11
|
|
12
12
|
# @param [Rubicure::Series,Rubicure::Girl] other
|
13
13
|
# @return [Boolean] other is same Rubicure::Series or Rubicure::Series include Rubicure::Girl
|
@@ -28,7 +28,7 @@ module Rubicure
|
|
28
28
|
if respond_to?(:started_date)
|
29
29
|
if respond_to?(:ended_date)
|
30
30
|
# ended title
|
31
|
-
return (started_date
|
31
|
+
return (started_date..ended_date).cover?(date)
|
32
32
|
else
|
33
33
|
# on air title
|
34
34
|
return started_date <= date
|
@@ -55,57 +55,60 @@ module Rubicure
|
|
55
55
|
def each_with_girls
|
56
56
|
girls.each { |girl| yield girl }
|
57
57
|
end
|
58
|
-
|
58
|
+
alias_method :each, :each_with_girls
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
class << self
|
61
|
+
# @return [Array<Symbol>]
|
62
|
+
def names
|
63
|
+
config.keys
|
64
|
+
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
# @return [Array<Symbol>]
|
67
|
+
def uniq_names
|
68
|
+
uniq_names = []
|
69
|
+
config.each do |name, series|
|
70
|
+
uniq_names << name unless uniq_names.any? { |uniq_name| config[uniq_name][:title] == series[:title] }
|
71
|
+
end
|
72
|
+
uniq_names
|
70
73
|
end
|
71
|
-
uniq_names
|
72
|
-
end
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
# @return [Hash] content of config/series.yml
|
76
|
+
def config
|
77
|
+
unless @config
|
78
|
+
config_file = "#{File.dirname(__FILE__)}/../../config/series.yml"
|
79
|
+
@config = YAML.load_file(config_file).deep_symbolize_keys
|
80
|
+
end
|
81
|
+
@config
|
79
82
|
end
|
80
|
-
@@config
|
81
|
-
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
# @return [Hash] content of config/precure.yml
|
85
|
+
def reload_config!
|
86
|
+
@cache = {}
|
87
|
+
@config = nil
|
88
|
+
config
|
89
|
+
end
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
# @param [Symbol] series_name
|
92
|
+
def valid?(series_name)
|
93
|
+
names.include?(series_name)
|
94
|
+
end
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
# @param series_name [Symbol]
|
97
|
+
# @return [Rubicure::Series]
|
98
|
+
# @raise arg is not precure
|
99
|
+
def find(series_name)
|
100
|
+
raise "unknown series: #{series_name}" unless valid?(series_name)
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
@cache ||= {}
|
103
|
+
unless @cache[series_name]
|
104
|
+
series_config = config[series_name] || {}
|
105
|
+
series_config.reject! { |_k, v| v.nil? }
|
104
106
|
|
105
|
-
|
106
|
-
|
107
|
+
@cache[series_name] = Rubicure::Series[series_config]
|
108
|
+
end
|
107
109
|
|
108
|
-
|
110
|
+
@cache[series_name]
|
111
|
+
end
|
109
112
|
end
|
110
113
|
end
|
111
114
|
end
|
data/lib/rubicure/version.rb
CHANGED
data/lib/ubicure.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "rubicure"
|
data/rubicure.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "rubicure/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rubicure"
|
8
8
|
spec.version = Rubicure::VERSION
|
9
9
|
spec.authors = ["sue445"]
|
10
10
|
spec.email = ["sue445@sue445.net"]
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
11
|
+
spec.description = 'All about Japanese battle heroine "Pretty Cure (Precure)".'
|
12
|
+
spec.summary = 'All about Japanese battle heroine "Pretty Cure (Precure)".'
|
13
13
|
spec.homepage = "https://github.com/sue445/rubicure"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.required_ruby_version =
|
16
|
+
spec.required_ruby_version = ">= 2.0.0"
|
17
17
|
|
18
|
-
spec.files = `git ls-files`.split(
|
18
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "rspec-collection_matchers", "~> 1.0.0"
|
35
35
|
spec.add_development_dependency "rspec-its", "~> 1.0.1"
|
36
36
|
spec.add_development_dependency "rspec-parameterized", "~> 0.1.2"
|
37
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
37
|
+
spec.add_development_dependency "rubocop", "~> 0.30.0"
|
38
38
|
spec.add_development_dependency "yard"
|
39
39
|
end
|
data/spec/core_spec.rb
CHANGED
data/spec/cure_spec.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
describe "Cure" do
|
2
2
|
describe ".peace" do
|
3
3
|
describe "#pikarin_janken" do
|
4
|
-
subject{ girl.pikarin_janken }
|
4
|
+
subject { girl.pikarin_janken }
|
5
5
|
|
6
6
|
shared_examples :do_janken do
|
7
|
-
it{ should match
|
7
|
+
it { should match(/ピカピカピカリン\nジャンケンポン!\n(.+)/) }
|
8
8
|
end
|
9
9
|
|
10
10
|
context "When peace" do
|
11
|
-
let(:girl){ Cure.peace }
|
11
|
+
let(:girl) { Cure.peace }
|
12
12
|
it_behaves_like :do_janken
|
13
13
|
end
|
14
14
|
|
15
15
|
context "When cure_peace" do
|
16
|
-
let(:girl){ Cure.cure_peace }
|
16
|
+
let(:girl) { Cure.cure_peace }
|
17
17
|
it_behaves_like :do_janken
|
18
18
|
end
|
19
19
|
end
|
@@ -21,9 +21,9 @@ describe "Cure" do
|
|
21
21
|
|
22
22
|
describe ".passion" do
|
23
23
|
describe "!" do
|
24
|
-
subject{ !Cure.passion }
|
24
|
+
subject { !Cure.passion }
|
25
25
|
|
26
|
-
let(:girl){ Cure.passion }
|
26
|
+
let(:girl) { Cure.passion }
|
27
27
|
|
28
28
|
after do
|
29
29
|
girl.rollback
|
@@ -31,7 +31,7 @@ describe "Cure" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
context "called once" do
|
34
|
-
it{ expect{ subject }.to change{ girl.name }.from("東せつな").to("イース") }
|
34
|
+
it { expect { subject }.to change { girl.name }.from("東せつな").to("イース") }
|
35
35
|
end
|
36
36
|
|
37
37
|
context "called twice" do
|
@@ -39,7 +39,7 @@ describe "Cure" do
|
|
39
39
|
!Cure.passion
|
40
40
|
end
|
41
41
|
|
42
|
-
it{ expect{ subject }.to change{ girl.name }.from("イース").to("東せつな") }
|
42
|
+
it { expect { subject }.to change { girl.name }.from("イース").to("東せつな") }
|
43
43
|
end
|
44
44
|
|
45
45
|
context "after transform" do
|
@@ -47,16 +47,16 @@ describe "Cure" do
|
|
47
47
|
girl.transform!
|
48
48
|
end
|
49
49
|
|
50
|
-
it{ expect{ subject }.to change{ girl.name }.from("キュアパッション").to("イース") }
|
50
|
+
it { expect { subject }.to change { girl.name }.from("キュアパッション").to("イース") }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe ".beat" do
|
56
56
|
describe "!" do
|
57
|
-
subject{ !Cure.beat }
|
57
|
+
subject { !Cure.beat }
|
58
58
|
|
59
|
-
let(:girl){ Cure.beat }
|
59
|
+
let(:girl) { Cure.beat }
|
60
60
|
|
61
61
|
after do
|
62
62
|
girl.rollback
|
@@ -64,7 +64,7 @@ describe "Cure" do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
context "called once" do
|
67
|
-
it{ expect{ subject }.to change{ girl.name }.from("黒川エレン").to("セイレーン") }
|
67
|
+
it { expect { subject }.to change { girl.name }.from("黒川エレン").to("セイレーン") }
|
68
68
|
end
|
69
69
|
|
70
70
|
context "called twice" do
|
@@ -72,7 +72,7 @@ describe "Cure" do
|
|
72
72
|
!Cure.beat
|
73
73
|
end
|
74
74
|
|
75
|
-
it{ expect{ subject }.to change{ girl.name }.from("セイレーン").to("黒川エレン") }
|
75
|
+
it { expect { subject }.to change { girl.name }.from("セイレーン").to("黒川エレン") }
|
76
76
|
end
|
77
77
|
|
78
78
|
context "after transform" do
|
@@ -80,7 +80,7 @@ describe "Cure" do
|
|
80
80
|
girl.transform!
|
81
81
|
end
|
82
82
|
|
83
|
-
it{ expect{ subject }.to change{ girl.name }.from("キュアビート").to("セイレーン") }
|
83
|
+
it { expect { subject }.to change { girl.name }.from("キュアビート").to("セイレーン") }
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/spec/girl_spec.rb
CHANGED
@@ -35,7 +35,7 @@ EOF
|
|
35
35
|
"プリキュアピースサンダーハリケーン!",
|
36
36
|
]
|
37
37
|
end
|
38
|
-
let(:transform_calls){ %w(smile_charge) }
|
38
|
+
let(:transform_calls) { %w(smile_charge) }
|
39
39
|
|
40
40
|
describe "#name" do
|
41
41
|
context "when before transform" do
|
@@ -154,20 +154,20 @@ EOF
|
|
154
154
|
context "When Cure Lemonade calls metamorphose" do
|
155
155
|
let(:girl) { Cure.lemonade }
|
156
156
|
let(:transform_call) { "metamorphose" }
|
157
|
-
it { expect{ subject }.not_to raise_error }
|
157
|
+
it { expect { subject }.not_to raise_error }
|
158
158
|
end
|
159
159
|
|
160
160
|
context "When Milkey Rose calls sky_rose_translate!" do
|
161
161
|
let(:girl) { Milky.rose }
|
162
162
|
let(:transform_call) { "sky_rose_translate!" }
|
163
|
-
it { expect{ subject }.not_to raise_error }
|
163
|
+
it { expect { subject }.not_to raise_error }
|
164
164
|
end
|
165
165
|
|
166
166
|
context "When Milky Rose calls metamorphose" do
|
167
167
|
let(:girl) { Milky.rose }
|
168
168
|
let(:transform_call) { "metamorphose" }
|
169
169
|
|
170
|
-
it { expect{ subject }.to raise_error NameError }
|
170
|
+
it { expect { subject }.to raise_error NameError }
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
@@ -177,10 +177,10 @@ EOF
|
|
177
177
|
end
|
178
178
|
|
179
179
|
describe "humanize!" do
|
180
|
-
let(:humanize!){ girl.humanize! }
|
180
|
+
let(:humanize!) { girl.humanize! }
|
181
181
|
|
182
182
|
context "When not transformed" do
|
183
|
-
subject!{ humanize! }
|
183
|
+
subject! { humanize! }
|
184
184
|
|
185
185
|
it_behaves_like :a_humanize_method
|
186
186
|
end
|
@@ -190,14 +190,14 @@ EOF
|
|
190
190
|
girl.transform!
|
191
191
|
end
|
192
192
|
|
193
|
-
subject!{ humanize! }
|
193
|
+
subject! { humanize! }
|
194
194
|
|
195
195
|
it_behaves_like :a_humanize_method
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
199
|
describe "#colors" do
|
200
|
-
subject{ Rubicure::Girl.colors }
|
200
|
+
subject { Rubicure::Girl.colors }
|
201
201
|
|
202
202
|
let(:expected) do
|
203
203
|
%i(
|
data/spec/movie_spec.rb
CHANGED
data/spec/rubicure_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Rubicure do
|
4
|
-
it
|
4
|
+
it "should have a version number" do
|
5
5
|
expect(Rubicure::VERSION).not_to be_nil
|
6
6
|
end
|
7
7
|
|
@@ -105,13 +105,13 @@ describe Rubicure do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
with_them do
|
108
|
-
it { expect(
|
109
|
-
it { expect(
|
108
|
+
it { expect(Cure.send(name)).to be_an_instance_of Rubicure::Girl }
|
109
|
+
it { expect(Cure.send(name).precure_name).to be_start_with "キュア" }
|
110
110
|
end
|
111
111
|
|
112
112
|
context "When precure who not starting 'cure'" do
|
113
|
-
it { expect(
|
114
|
-
it { expect(
|
113
|
+
it { expect(Shiny.luminous.precure_name).to eq "シャイニールミナス" }
|
114
|
+
it { expect(Milky.rose.precure_name).to eq "ミルキィローズ" }
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
data/spec/series_spec.rb
CHANGED
@@ -66,6 +66,7 @@ describe Rubicure::Series do
|
|
66
66
|
]
|
67
67
|
end
|
68
68
|
|
69
|
+
# rubocop:disable Style/CaseEquality, Lint/UselessComparison, Style/NilComparison
|
69
70
|
describe "#===" do
|
70
71
|
let(:series) { Rubicure::Series.find(series_name) }
|
71
72
|
let(:series_name) { :smile }
|
@@ -92,6 +93,7 @@ describe Rubicure::Series do
|
|
92
93
|
it { expect(series === nil).to be false }
|
93
94
|
end
|
94
95
|
end
|
96
|
+
# rubocop:enable Style/CaseEquality, Lint/UselessComparison, Style/NilComparison
|
95
97
|
|
96
98
|
describe "#names" do
|
97
99
|
subject { Rubicure::Series.names }
|
@@ -124,10 +126,10 @@ describe Rubicure::Series do
|
|
124
126
|
end
|
125
127
|
|
126
128
|
describe "#each_with_girls" do
|
127
|
-
subject{ series.each_with_girls }
|
129
|
+
subject { series.each_with_girls }
|
128
130
|
|
129
131
|
let(:series) { Rubicure::Series.find(series_name) }
|
130
|
-
let(:series_name){ :splash_star }
|
132
|
+
let(:series_name) { :splash_star }
|
131
133
|
|
132
134
|
it { expect { |b| series.each_with_girls(&b) }.to yield_successive_args(Rubicure::Girl, Rubicure::Girl) }
|
133
135
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,92 +16,90 @@
|
|
16
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
17
|
|
18
18
|
if ENV["COVERAGE"]
|
19
|
-
require
|
19
|
+
require "codeclimate-test-reporter"
|
20
20
|
CodeClimate::TestReporter.start
|
21
21
|
|
22
|
-
require
|
22
|
+
require "coveralls"
|
23
23
|
Coveralls.wear!
|
24
24
|
end
|
25
25
|
|
26
|
-
$LOAD_PATH.unshift File.expand_path(
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
26
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
27
|
+
require "rubicure"
|
28
|
+
require "rspec"
|
29
|
+
require "rspec-parameterized"
|
30
|
+
require "rspec/its"
|
31
|
+
require "rspec/collection_matchers"
|
32
|
+
require "delorean"
|
33
|
+
require "tempfile"
|
34
34
|
|
35
35
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
36
36
|
# in spec/support/ and its subdirectories.
|
37
37
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
38
38
|
|
39
39
|
RSpec.configure do |config|
|
40
|
-
# The settings below are suggested to provide a good initial experience
|
41
|
-
# with RSpec, but feel free to customize to your heart's content.
|
42
|
-
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
config.
|
48
|
-
|
49
|
-
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
|
81
|
-
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
#
|
93
|
-
#
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
end
|
104
|
-
=end
|
40
|
+
# The settings below are suggested to provide a good initial experience
|
41
|
+
# with RSpec, but feel free to customize to your heart's content.
|
42
|
+
# # These two settings work together to allow you to limit a spec run
|
43
|
+
# # to individual examples or groups you care about by tagging them with
|
44
|
+
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
45
|
+
# # get run.
|
46
|
+
# config.filter_run :focus
|
47
|
+
# config.run_all_when_everything_filtered = true
|
48
|
+
#
|
49
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
50
|
+
# # file, and it's useful to allow more verbose output when running an
|
51
|
+
# # individual spec file.
|
52
|
+
# if config.files_to_run.one?
|
53
|
+
# # RSpec filters the backtrace by default so as not to be so noisy.
|
54
|
+
# # This causes the full backtrace to be printed when running a single
|
55
|
+
# # spec file (e.g. to troubleshoot a particular spec failure).
|
56
|
+
# config.full_backtrace = true
|
57
|
+
#
|
58
|
+
# # Use the documentation formatter for detailed output,
|
59
|
+
# # unless a formatter has already been configured
|
60
|
+
# # (e.g. via a command-line flag).
|
61
|
+
# config.default_formatter = 'doc'
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# # Print the 10 slowest examples and example groups at the
|
65
|
+
# # end of the spec run, to help surface which specs are running
|
66
|
+
# # particularly slow.
|
67
|
+
# config.profile_examples = 10
|
68
|
+
#
|
69
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
70
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
71
|
+
# # the seed, which is printed after each run.
|
72
|
+
# # --seed 1234
|
73
|
+
# config.order = :random
|
74
|
+
#
|
75
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
76
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
77
|
+
# # test failures related to randomization by passing the same `--seed` value
|
78
|
+
# # as the one that triggered the failure.
|
79
|
+
# Kernel.srand config.seed
|
80
|
+
#
|
81
|
+
# # rspec-expectations config goes here. You can use an alternate
|
82
|
+
# # assertion/expectation library such as wrong or the stdlib/minitest
|
83
|
+
# # assertions if you prefer.
|
84
|
+
# config.expect_with :rspec do |expectations|
|
85
|
+
# # Enable only the newer, non-monkey-patching expect syntax.
|
86
|
+
# # For more details, see:
|
87
|
+
# # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
88
|
+
# expectations.syntax = :expect
|
89
|
+
# end
|
90
|
+
#
|
91
|
+
# # rspec-mocks config goes here. You can use an alternate test double
|
92
|
+
# # library (such as bogus or mocha) by changing the `mock_with` option here.
|
93
|
+
# config.mock_with :rspec do |mocks|
|
94
|
+
# # Enable only the newer, non-monkey-patching expect syntax.
|
95
|
+
# # For more details, see:
|
96
|
+
# # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
97
|
+
# mocks.syntax = :expect
|
98
|
+
#
|
99
|
+
# # Prevents you from mocking or stubbing a method that does not exist on
|
100
|
+
# # a real object. This is generally recommended.
|
101
|
+
# mocks.verify_partial_doubles = true
|
102
|
+
# end
|
105
103
|
|
106
104
|
config.order = :random
|
107
105
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubicure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 0.
|
201
|
+
version: 0.30.0
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: 0.
|
208
|
+
version: 0.30.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: yard
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- ".hound.yml"
|
233
233
|
- ".rspec"
|
234
234
|
- ".rubocop.yml"
|
235
|
+
- ".tachikoma.yml"
|
235
236
|
- ".travis.yml"
|
236
237
|
- ".yardopts"
|
237
238
|
- CHANGELOG.md
|