rubimas 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +9 -1
  4. data/CHANGELOG.md +10 -1
  5. data/README.md +1 -1
  6. data/bin/touch_idol_files.rb +5 -0
  7. data/config/idols/01_haruka.yml +27 -0
  8. data/config/idols/02_chihaya.yml +26 -0
  9. data/config/idols/03_miki.yml +28 -0
  10. data/config/idols/04_yukiho.yml +26 -0
  11. data/config/idols/05_yayoi.yml +28 -0
  12. data/config/idols/06_makoto.yml +27 -0
  13. data/config/idols/07_iori.yml +27 -0
  14. data/config/idols/08_takane.yml +27 -0
  15. data/config/idols/09_ritsuko.yml +27 -0
  16. data/config/idols/10_azusa.yml +26 -0
  17. data/config/idols/11_ami.yml +27 -0
  18. data/config/idols/12_mami.yml +27 -0
  19. data/config/idols/13_hibiki.yml +28 -0
  20. data/config/idols/14_mirai.yml +26 -0
  21. data/config/idols/15_shizuka.yml +26 -0
  22. data/config/idols/16_tsubasa.yml +26 -0
  23. data/config/idols/17_kotoha.yml +26 -0
  24. data/config/idols/18_erena.yml +26 -0
  25. data/config/idols/19_minako.yml +26 -0
  26. data/config/idols/20_megumi.yml +26 -0
  27. data/config/idols/21_matsuri.yml +27 -0
  28. data/config/idols/22_serika.yml +27 -0
  29. data/config/idols/23_akane.yml +26 -0
  30. data/config/idols/24_anna.yml +26 -0
  31. data/config/idols/25_roko.yml +27 -0
  32. data/config/idols/26_yuriko.yml +26 -0
  33. data/config/idols/27_sayoko.yml +27 -0
  34. data/config/idols/28_arisa.yml +26 -0
  35. data/config/idols/29_umi.yml +26 -0
  36. data/config/idols/30_iku.yml +26 -0
  37. data/config/idols/31_tomoka.yml +26 -0
  38. data/config/idols/32_emily.yml +27 -0
  39. data/config/idols/33_shiho.yml +27 -0
  40. data/config/idols/34_ayumu.yml +26 -0
  41. data/config/idols/35_hinata.yml +26 -0
  42. data/config/idols/36_kana.yml +26 -0
  43. data/config/idols/37_nao.yml +26 -0
  44. data/config/idols/38_chiduru.yml +26 -0
  45. data/config/idols/39_konomi.yml +26 -0
  46. data/config/idols/40_tamaki.yml +26 -0
  47. data/config/idols/41_fuuka.yml +26 -0
  48. data/config/idols/42_miya.yml +27 -0
  49. data/config/idols/43_noriko.yml +26 -0
  50. data/config/idols/44_mizuki.yml +26 -0
  51. data/config/idols/45_karen.yml +26 -0
  52. data/config/idols/46_rio.yml +26 -0
  53. data/config/idols/47_subaru.yml +26 -0
  54. data/config/idols/48_reika.yml +26 -0
  55. data/config/idols/49_momoko.yml +26 -0
  56. data/config/idols/50_juria.yml +22 -0
  57. data/config/units/brand_new_stage/aquarius.yml +5 -0
  58. data/config/units/brand_new_stage/aries.yml +5 -0
  59. data/config/units/brand_new_stage/cancer.yml +5 -0
  60. data/config/units/brand_new_stage/capricorn.yml +5 -0
  61. data/config/units/brand_new_stage/gemini.yml +5 -0
  62. data/config/units/brand_new_stage/leo.yml +5 -0
  63. data/config/units/brand_new_stage/libra.yml +5 -0
  64. data/config/units/brand_new_stage/pisces.yml +5 -0
  65. data/config/units/brand_new_stage/sagittarius.yml +5 -0
  66. data/config/units/brand_new_stage/scorpio.yml +5 -0
  67. data/config/units/brand_new_stage/taurus.yml +5 -0
  68. data/config/units/brand_new_stage/virgo.yml +5 -0
  69. data/config/units/platinum_star_live/arrive.yml +8 -0
  70. data/config/units/platinum_star_live/birth.yml +8 -0
  71. data/config/units/platinum_star_live/burning_girl.yml +8 -0
  72. data/config/units/platinum_star_live/crescendo_blue.yml +8 -0
  73. data/config/units/platinum_star_live/eternal_harmony.yml +8 -0
  74. data/config/units/platinum_star_live/legend_days.yml +8 -0
  75. data/config/units/platinum_star_live/milkyway.yml +8 -0
  76. data/config/units/platinum_star_live/mixnuts.yml +8 -0
  77. data/config/units/platinum_star_live/otome_storm.yml +8 -0
  78. data/config/units/platinum_star_live/ricotta.yml +8 -0
  79. data/lib/rubimas/core_ext/{fixnum → integer}/production.rb +1 -1
  80. data/lib/rubimas/core_ext/integer.rb +1 -0
  81. data/lib/rubimas/idol/name.rb +3 -0
  82. data/lib/rubimas/idol.rb +9 -5
  83. data/lib/rubimas/unit.rb +18 -0
  84. data/lib/rubimas/version.rb +1 -1
  85. data/lib/rubimas.rb +2 -1
  86. data/rubimas.gemspec +4 -4
  87. data/spec/units/misc_spec.rb +67 -0
  88. data/spec/units/rubimas/idol_spec.rb +91 -0
  89. data/spec/units/rubimas_spec.rb +7 -0
  90. metadata +97 -18
  91. data/config/idols.yml +0 -1267
  92. data/lib/rubimas/core_ext/fixnum.rb +0 -1
  93. data/spec/rubimas_spec.rb +0 -110
@@ -0,0 +1,26 @@
1
+ reika:
2
+ idol_id: 48
3
+ idol_type: Da
4
+ name:
5
+ family: "北上"
6
+ family_kana: "きたかみ"
7
+ given: "麗花"
8
+ given_kana: "れいか"
9
+ shorten: "麗花"
10
+ age: 20
11
+ height: 164.0
12
+ weight: 47.0
13
+ bust: 84.0
14
+ waist: 58.0
15
+ hip: 84.0
16
+ birthday: 05/17
17
+ blood_type: A
18
+ handedness: right
19
+ hobbies:
20
+ - "登山"
21
+ talents:
22
+ - "肺活量が大きい"
23
+ favorites:
24
+ - "ドライブ"
25
+ color: "#6bb6b0"
26
+ cv: 平山笑美
@@ -0,0 +1,26 @@
1
+ momoko:
2
+ idol_id: 49
3
+ idol_type: Vi
4
+ name:
5
+ family: "周防"
6
+ family_kana: "すおう"
7
+ given: "桃子"
8
+ given_kana: "ももこ"
9
+ shorten: "桃子"
10
+ age: 11
11
+ height: 140.0
12
+ weight: 35.0
13
+ bust: 73.0
14
+ waist: 53.0
15
+ hip: 74.0
16
+ birthday: 11/06
17
+ blood_type: B
18
+ handedness: right
19
+ hobbies:
20
+ - "かわいいシール集め"
21
+ talents:
22
+ - "演技や台詞の暗記"
23
+ favorites:
24
+ - "ホットケーキ"
25
+ color: "#efb864"
26
+ cv: 渡部恵子
@@ -0,0 +1,22 @@
1
+ juria:
2
+ idol_id: 50
3
+ idol_type: Vo
4
+ name:
5
+ aka: "ジュリア"
6
+ shorten: "ジュリア"
7
+ age: 16
8
+ height: 157.0
9
+ weight: 43.0
10
+ bust: 79.0
11
+ waist: 54.0
12
+ hip: 80.0
13
+ birthday: 09/26
14
+ blood_type: O
15
+ handedness: left
16
+ hobbies:
17
+ talents:
18
+ - "ギター"
19
+ favorites:
20
+ - "パンクロック"
21
+ color: "#d7385f"
22
+ cv: 愛美
@@ -0,0 +1,5 @@
1
+ name: アクアリウス
2
+ members:
3
+ - 48
4
+ - 50
5
+ - 27
@@ -0,0 +1,5 @@
1
+ name: アリエス
2
+ members:
3
+ - 40
4
+ - 23
5
+ - 22
@@ -0,0 +1,5 @@
1
+ name: キャンサー
2
+ members:
3
+ - 32
4
+ - 35
5
+ - 37
@@ -0,0 +1,5 @@
1
+ name: カプリコーン
2
+ members:
3
+ - 36
4
+ - 24
5
+ - 46
@@ -0,0 +1,5 @@
1
+ name: ジェミニ
2
+ members:
3
+ - 49
4
+ - 41
5
+ - 39
@@ -0,0 +1,5 @@
1
+ name: レオ
2
+ members:
3
+ - 18
4
+ - 30
5
+ - 25
@@ -0,0 +1,5 @@
1
+ name: リブラ
2
+ members:
3
+ - 16
4
+ - 19
5
+ - 43
@@ -0,0 +1,5 @@
1
+ name: ピスケス
2
+ members:
3
+ - 45
4
+ - 31
5
+ - 38
@@ -0,0 +1,5 @@
1
+ name: サジタリアス
2
+ members:
3
+ - 20
4
+ - 34
5
+ - 44
@@ -0,0 +1,5 @@
1
+ name: スコーピオ
2
+ members:
3
+ - 33
4
+ - 29
5
+ - 28
@@ -0,0 +1,5 @@
1
+ name: タウラス
2
+ members:
3
+ - 14
4
+ - 21
5
+ - 42
@@ -0,0 +1,5 @@
1
+ name: ウィルゴ
2
+ members:
3
+ - 47
4
+ - 26
5
+ - 15
@@ -0,0 +1,8 @@
1
+ name: ARRIVE
2
+ leader_id: 45
3
+ members:
4
+ - 45
5
+ - 8
6
+ - 46
7
+ - 18
8
+ - 25
@@ -0,0 +1,8 @@
1
+ name: BIRTH
2
+ leader_id: 6
3
+ members:
4
+ - 6
5
+ - 4
6
+ - 34
7
+ - 10
8
+ - 36
@@ -0,0 +1,8 @@
1
+ name: 灼熱少女
2
+ leader_id: 17
3
+ members:
4
+ - 17
5
+ - 40
6
+ - 29
7
+ - 20
8
+ - 42
@@ -0,0 +1,8 @@
1
+ name: クレシェンドブルー
2
+ leader_id: 15
3
+ members:
4
+ - 15
5
+ - 48
6
+ - 33
7
+ - 23
8
+ - 22
@@ -0,0 +1,8 @@
1
+ name: エターナルハーモニー
2
+ leader_id: 2
3
+ members:
4
+ - 2
5
+ - 32
6
+ - 50
7
+ - 21
8
+ - 41
@@ -0,0 +1,8 @@
1
+ name: レジェンドデイズ
2
+ leader_id: 13
3
+ members:
4
+ - 13
5
+ - 9
6
+ - 7
7
+ - 5
8
+ - 11
@@ -0,0 +1,8 @@
1
+ name: ミルキーウェイ
2
+ leader_id: 3
3
+ members:
4
+ - 3
5
+ - 31
6
+ - 27
7
+ - 47
8
+ - 38
@@ -0,0 +1,8 @@
1
+ name: ミックスナッツ
2
+ leader_id: 39
3
+ members:
4
+ - 39
5
+ - 35
6
+ - 19
7
+ - 30
8
+ - 12
@@ -0,0 +1,8 @@
1
+ name: 乙女ストーム!
2
+ leader_id: 14
3
+ members:
4
+ - 14
5
+ - 16
6
+ - 44
7
+ - 26
8
+ - 24
@@ -0,0 +1,8 @@
1
+ name: リコッタ
2
+ leader_id: 1
3
+ members:
4
+ - 1
5
+ - 49
6
+ - 43
7
+ - 28
8
+ - 37
@@ -1,4 +1,4 @@
1
- class Fixnum
1
+ class Integer
2
2
  def production
3
3
  self == 765 ? Rubimas : super
4
4
  end
@@ -0,0 +1 @@
1
+ require 'rubimas/core_ext/integer/production'
@@ -30,6 +30,9 @@ module Rubimas
30
30
  end
31
31
  end
32
32
 
33
+ def ==(other)
34
+ super || [aka, given, full].compact.include?(other)
35
+ end
33
36
  end
34
37
  end
35
38
  end
data/lib/rubimas/idol.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Rubimas
2
2
  class Idol
3
3
  attr_reader :idol_id, :key, :idol_type, :name, :age, :height, :weight, :bust, :waist, :hip,
4
- :birthday, :blood_type, :handedness, :hobbies, :talents, :favorites, :color
4
+ :birthday, :blood_type, :handedness, :hobbies, :talents, :favorites, :color, :cv
5
5
  @@config = nil
6
6
  @@all_idols = nil
7
7
 
@@ -23,14 +23,16 @@ module Rubimas
23
23
  @talents = args[:talents]
24
24
  @favorites = args[:favorites]
25
25
  @color = args[:color]
26
+ @cv = args[:cv]
26
27
  end
27
28
  alias_method :id, :idol_id
28
29
 
29
30
  class << self
30
31
  def config
31
32
  unless @@config
32
- config_file = "#{File.dirname(__FILE__)}/../../config/idols.yml"
33
- @@config = YAML.load_file(config_file).deep_symbolize_keys
33
+ @@config = Dir.glob("#{File.dirname(__FILE__)}/../../config/idols/*.yml").each_with_object({}) do |file, idols|
34
+ idols.merge!(YAML.load_file(file))
35
+ end.deep_symbolize_keys
34
36
  end
35
37
  @@config
36
38
  end
@@ -40,7 +42,7 @@ module Rubimas
40
42
  end
41
43
 
42
44
  def all
43
- @@all_idols ||= config.map { |key, prof| prof[:key] = key; new(prof) }
45
+ @@all_idols ||= config.map { |key, prof| prof[:key] = key; new(prof) }.sort_by { |idol| idol.id }
44
46
  end
45
47
  alias_method :all_idols, :all
46
48
 
@@ -50,12 +52,14 @@ module Rubimas
50
52
  alias_method :find_by_id, :find
51
53
 
52
54
  def find_by_name(idol_name)
53
- all_idols.find { |idol| idol.key == idol_name } || raise("unknown idol: #{idol_name}")
55
+ all_idols.find { |idol| [idol.key, idol.name].include?(idol_name) } || (raise UnknownIdolError, "unknown idol: #{idol_name}")
54
56
  end
55
57
 
56
58
  def valid?(idol_name)
57
59
  names.include?(idol_name)
58
60
  end
59
61
  end
62
+
63
+ class UnknownIdolError < StandardError; end
60
64
  end
61
65
  end
@@ -0,0 +1,18 @@
1
+ module Rubimas
2
+ class Unit
3
+ attr_reader :name, :members, :leader
4
+
5
+ def initialize(name, members, leader: nil)
6
+ @name = name
7
+ @members = members
8
+ @leader = leader
9
+ end
10
+
11
+ def self.all
12
+ Dir.glob("#{File.dirname(__FILE__)}/../../config/units/**/*.yml").map do |unit_file|
13
+ unit_config = YAML.load_file(unit_file)
14
+ self.new(unit_config['name'], unit_config['members'].map { |id| Rubimas::Idol.find(id) }, leader: Rubimas::Idol.find(unit_config['leader_id']))
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Rubimas
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/rubimas.rb CHANGED
@@ -4,7 +4,8 @@ require 'hashie'
4
4
  require "rubimas/version"
5
5
  require "rubimas/idol"
6
6
  require "rubimas/idol/name"
7
- require "rubimas/core_ext/fixnum"
7
+ require "rubimas/unit"
8
+ require "rubimas/core_ext/integer"
8
9
 
9
10
  module Rubimas
10
11
  def self.method_missing(name, *args)
data/rubimas.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "rubimas"
8
8
  spec.version = Rubimas::VERSION
9
9
  spec.authors = ["treby"]
10
- spec.email = ["treby@atelier-nodoka.net"]
10
+ spec.email = ["me@treby.info"]
11
11
  spec.summary = %q{The 765 pro idol's information library.}
12
12
  spec.description = %q{The 765 pro idol's information library. This gem provides names, birthdays, favorites, etc.}
13
13
  spec.homepage = "https://github.com/imas/rubimas"
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'activesupport', '~> 4.0'
22
- spec.add_dependency 'hashie', '~> 2.0'
21
+ spec.add_dependency 'activesupport', '>= 4.0'
22
+ spec.add_dependency 'hashie', '>= 3.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1'
25
25
  spec.add_development_dependency 'rake', '~> 10'
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rspec-its', '~> 1'
29
29
  spec.add_development_dependency 'rspec-parameterized', '~> 0'
30
30
 
31
- spec.add_development_dependency 'parser', '~> 2.2'
31
+ spec.add_development_dependency 'parser', '~> 2'
32
32
  end
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Supported 765 Production idols.' do
4
+ context "When Idol.#<name>" do
5
+ where(:name) do
6
+ [
7
+ [:haruka],
8
+ [:chihaya],
9
+ [:miki],
10
+ [:yukiho],
11
+ [:yayoi],
12
+ [:makoto],
13
+ [:iori],
14
+ [:takane],
15
+ [:ritsuko],
16
+ [:azusa],
17
+ [:ami],
18
+ [:mami],
19
+ [:hibiki],
20
+
21
+ [:mirai],
22
+ [:shizuka],
23
+ [:tsubasa],
24
+ [:kotoha],
25
+ [:erena],
26
+ [:minako],
27
+ [:megumi],
28
+ [:matsuri],
29
+ [:serika],
30
+ [:akane],
31
+ [:anna],
32
+ [:roko],
33
+ [:yuriko],
34
+ [:sayoko],
35
+ [:arisa],
36
+ [:umi],
37
+ [:iku],
38
+ [:tomoka],
39
+ [:emily],
40
+ [:shiho],
41
+ [:ayumu],
42
+ [:hinata],
43
+ [:kana],
44
+ [:nao],
45
+ [:chiduru],
46
+ [:konomi],
47
+ [:tamaki],
48
+ [:fuuka],
49
+ [:miya],
50
+ [:noriko],
51
+ [:mizuki],
52
+ [:karen],
53
+ [:rio],
54
+ [:subaru],
55
+ [:reika],
56
+ [:momoko],
57
+ [:juria],
58
+ ]
59
+ end
60
+
61
+ with_them do
62
+ it { expect( 765.pro.send(name) ).to be_an_instance_of Rubimas::Idol }
63
+ it { expect( 765.pro.send(name).name ).to be_an_instance_of Rubimas::Idol::Name }
64
+ it { expect { 765.pro.send(name).name.full }.not_to raise_error }
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rubimas::Idol do
4
+ describe '#config' do
5
+ subject { described_class.config }
6
+
7
+ specify 'All idol count is 50' do
8
+ expect(subject.keys.count).to eq 50
9
+ end
10
+ end
11
+
12
+ describe '#all' do
13
+ subject { described_class.all }
14
+
15
+ specify 'Idols are order by id' do
16
+ expect(subject.first.key).to eq :haruka
17
+ expect(subject.last.key).to eq :juria
18
+ end
19
+ end
20
+
21
+
22
+ describe '#find_by_name' do
23
+ subject { Rubimas::Idol.find_by_name(name) }
24
+
25
+ describe 'alternative to find by key.' do
26
+ where(:input_name, :expected_key) do
27
+ [
28
+ ["未来", :mirai],
29
+ ["最上静香", :shizuka],
30
+ ["ジュリア", :juria],
31
+ ["ロコ", :roko],
32
+ ["エミリー", :emily],
33
+ ]
34
+ end
35
+
36
+ with_them do
37
+ let(:name) { input_name }
38
+ it { is_expected.to eq Rubimas.send(expected_key) }
39
+ end
40
+ end
41
+
42
+ context 'cannot find idol' do
43
+ where(:input_name) do
44
+ [[:kotori], ['春日'], [14]]
45
+ end
46
+
47
+ with_them do
48
+ let(:name) { input_name }
49
+ it { expect { subject }.to raise_error(Rubimas::Idol::UnknownIdolError) }
50
+ end
51
+ end
52
+ end
53
+
54
+ describe '#name' do
55
+ let(:idol_who_has_aka) { %i(roko emily juria) }
56
+
57
+ context 'When her specify name(a.k.a) as the name.' do
58
+ where(:name) { idol_who_has_aka }
59
+
60
+ with_them do
61
+ it { expect( 765.pro.send(name).name.to_s ).to eq 765.pro.send(name).name.aka }
62
+ end
63
+ end
64
+
65
+ context 'When her fullname as the name.' do
66
+ where(:name) { Rubimas::Idol.names - idol_who_has_aka }
67
+
68
+ with_them do
69
+ it { expect( 765.pro.send(name).name.to_s ).to eq 765.pro.send(name).name.full }
70
+ end
71
+ end
72
+
73
+ describe 'Idol#name#full' do
74
+ let(:idol_nobody_knows_her_fullname) { %i(juria) }
75
+
76
+ context 'When she has her fullname.' do
77
+ where(:name) { Rubimas::Idol.names - idol_nobody_knows_her_fullname }
78
+ with_them do
79
+ it { expect( 765.pro.send(name).name.full ).to eq 765.pro.send(name).name.full }
80
+ end
81
+ end
82
+
83
+ context "When nobody knows the idol's fullname." do
84
+ where(:name) { idol_nobody_knows_her_fullname }
85
+ with_them do
86
+ it { expect( 765.pro.send(name).name.full ).to eq 765.pro.send(name).name.aka }
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rubimas do
4
+ it 'has a version number' do
5
+ expect(Rubimas::VERSION).not_to be nil
6
+ end
7
+ end