HyakuninIssyu 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/HyakuninIssyu.gemspec +0 -1
  3. data/README.md +47 -30
  4. data/Rakefile +1 -0
  5. data/{lib → assets}/data/poems.yml +0 -0
  6. data/{lib → assets}/data/poets.yml +0 -0
  7. data/assets/img/001.jpg +0 -0
  8. data/assets/img/002.jpg +0 -0
  9. data/assets/img/003.jpg +0 -0
  10. data/assets/img/004.jpg +0 -0
  11. data/assets/img/005.jpg +0 -0
  12. data/assets/img/006.jpg +0 -0
  13. data/assets/img/007.jpg +0 -0
  14. data/assets/img/008.jpg +0 -0
  15. data/assets/img/009.jpg +0 -0
  16. data/assets/img/010.jpg +0 -0
  17. data/assets/img/011.jpg +0 -0
  18. data/assets/img/012.jpg +0 -0
  19. data/assets/img/013.jpg +0 -0
  20. data/assets/img/014.jpg +0 -0
  21. data/assets/img/015.jpg +0 -0
  22. data/assets/img/016.jpg +0 -0
  23. data/assets/img/017.jpg +0 -0
  24. data/assets/img/018.jpg +0 -0
  25. data/assets/img/019.jpg +0 -0
  26. data/assets/img/020.jpg +0 -0
  27. data/assets/img/021.jpg +0 -0
  28. data/assets/img/022.jpg +0 -0
  29. data/assets/img/023.jpg +0 -0
  30. data/assets/img/024.jpg +0 -0
  31. data/assets/img/025.jpg +0 -0
  32. data/assets/img/026.jpg +0 -0
  33. data/assets/img/027.jpg +0 -0
  34. data/assets/img/028.jpg +0 -0
  35. data/assets/img/029.jpg +0 -0
  36. data/assets/img/030.jpg +0 -0
  37. data/assets/img/031.jpg +0 -0
  38. data/assets/img/032.jpg +0 -0
  39. data/assets/img/033.jpg +0 -0
  40. data/assets/img/034.jpg +0 -0
  41. data/assets/img/035.jpg +0 -0
  42. data/assets/img/036.jpg +0 -0
  43. data/assets/img/037.jpg +0 -0
  44. data/assets/img/038.jpg +0 -0
  45. data/assets/img/039.jpg +0 -0
  46. data/assets/img/040.jpg +0 -0
  47. data/assets/img/041.jpg +0 -0
  48. data/assets/img/042.jpg +0 -0
  49. data/assets/img/043.jpg +0 -0
  50. data/assets/img/044.jpg +0 -0
  51. data/assets/img/045.jpg +0 -0
  52. data/assets/img/046.jpg +0 -0
  53. data/assets/img/047.jpg +0 -0
  54. data/assets/img/048.jpg +0 -0
  55. data/assets/img/049.jpg +0 -0
  56. data/assets/img/050.jpg +0 -0
  57. data/assets/img/051.jpg +0 -0
  58. data/assets/img/052.jpg +0 -0
  59. data/assets/img/053.jpg +0 -0
  60. data/assets/img/054.jpg +0 -0
  61. data/assets/img/055.jpg +0 -0
  62. data/assets/img/056.jpg +0 -0
  63. data/assets/img/057.jpg +0 -0
  64. data/assets/img/058.jpg +0 -0
  65. data/assets/img/059.jpg +0 -0
  66. data/assets/img/060.jpg +0 -0
  67. data/assets/img/061.jpg +0 -0
  68. data/assets/img/062.jpg +0 -0
  69. data/assets/img/063.jpg +0 -0
  70. data/assets/img/064.jpg +0 -0
  71. data/assets/img/065.jpg +0 -0
  72. data/assets/img/066.jpg +0 -0
  73. data/assets/img/067.jpg +0 -0
  74. data/assets/img/068.jpg +0 -0
  75. data/assets/img/069.jpg +0 -0
  76. data/assets/img/070.jpg +0 -0
  77. data/assets/img/071.jpg +0 -0
  78. data/assets/img/072.jpg +0 -0
  79. data/assets/img/073.jpg +0 -0
  80. data/assets/img/074.jpg +0 -0
  81. data/assets/img/075.jpg +0 -0
  82. data/assets/img/076.jpg +0 -0
  83. data/assets/img/077.jpg +0 -0
  84. data/assets/img/078.jpg +0 -0
  85. data/assets/img/079.jpg +0 -0
  86. data/assets/img/080.jpg +0 -0
  87. data/assets/img/081.jpg +0 -0
  88. data/assets/img/082.jpg +0 -0
  89. data/assets/img/083.jpg +0 -0
  90. data/assets/img/084.jpg +0 -0
  91. data/assets/img/085.jpg +0 -0
  92. data/assets/img/086.jpg +0 -0
  93. data/assets/img/087.jpg +0 -0
  94. data/assets/img/088.jpg +0 -0
  95. data/assets/img/089.jpg +0 -0
  96. data/assets/img/090.jpg +0 -0
  97. data/assets/img/091.jpg +0 -0
  98. data/assets/img/092.jpg +0 -0
  99. data/assets/img/093.jpg +0 -0
  100. data/assets/img/094.jpg +0 -0
  101. data/assets/img/095.jpg +0 -0
  102. data/assets/img/096.jpg +0 -0
  103. data/assets/img/097.jpg +0 -0
  104. data/assets/img/098.jpg +0 -0
  105. data/assets/img/099.jpg +0 -0
  106. data/assets/img/100.jpg +0 -0
  107. data/lib/HyakuninIssyu.rb +25 -30
  108. data/lib/HyakuninIssyu/version.rb +1 -1
  109. data/lib/tasks/install_asset.rake +12 -0
  110. data/spec/hyakuninissyu_spec.rb +184 -208
  111. data/spec/spec_helper.rb +0 -2
  112. metadata +105 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 065f4bd1f89054fe5c8c6425feec6b66ce0bf7d1
4
- data.tar.gz: 57cbe12266bd96c0106c0c68731572a078b3eb91
3
+ metadata.gz: af4c596341f17568ecda3f6647985decfcf376d5
4
+ data.tar.gz: 4db23df31c69b63d862e2c2aa70fc7859d9dcf36
5
5
  SHA512:
6
- metadata.gz: f3ad79fe58cd84d2b30a807a97ddf7ffb2d9e5f2241967b73396b1cb535ea16f58808ba3d82f4b3a0ab92b4dae5482e63a4ec74b17fe1a4079f2ada1fdabb17a
7
- data.tar.gz: 0481f021dcff5544cc954ea44054bdcd6fb2be9a88102a660708f02fb459ed8353ecee164c12bbce5bcc10e96822842e956fb60a715448b294cf4b4120cceb48
6
+ metadata.gz: ef50097290b503bd5a9bad09a0f833e61057f8056b1cb7aa17c11b98558272e0206165ca530fa30f0250ffd00c93f173c26713fff0d4eaad2bd3e8eb5948a60a
7
+ data.tar.gz: 8035a0445e0b0d8b9a6f39fa1340d36f1feb88aa3014ec988324ff20a81ed0ab8df45a5a54f08f30e9bb371d55ac9dfa315a3183893da2c0865c46fd7d815627
@@ -22,5 +22,4 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "moji"
25
- spec.add_development_dependency "coveralls"
26
25
  end
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # HyakuninIssyu
2
2
  [![Build Status](https://travis-ci.org/Tomomichi/HyakuninIssyu.png?branch=master)](https://travis-ci.org/Tomomichi/HyakuninIssyu)
3
3
  [![Dependency Status](https://gemnasium.com/Tomomichi/HyakuninIssyu.png)](https://gemnasium.com/Tomomichi/HyakuninIssyu)
4
- [![Coverage Status](https://coveralls.io/repos/Tomomichi/HyakuninIssyu/badge.png?branch=master)](https://coveralls.io/r/Tomomichi/HyakuninIssyu?branch=master)
5
4
 
6
5
  "HyakuninIssyu" is a Gem for installing poems and poets info of Hyakunin-Issyu, 100 poems by 100 poets into your apps.
7
6
  You can take any poems of Hyakunin-Issyu, poets info and a commentary on it, in addition to the feature to take the first or last half of the poem.
@@ -25,51 +24,69 @@ Or install it yourself as:
25
24
  $ gem install HyakuninIssyu
26
25
 
27
26
  ## Usage
28
- When retrieving the 64th poem (it's one of my favourite),
29
- make the instance of HyakuninIssyu class with its poem id first.
27
+ First, you need to make the instance of HyakuninIssyu class.
30
28
 
31
- data = HyakuninIssyu.new(64)
29
+ data = HyakuninIssyu.new
32
30
 
33
- If you don't pass the poem id, it retrieve the data of the first poem by Tenchi-Tennoh.
31
+ Then use this to retrieve poem and poet data.
34
32
 
35
33
  ###Poem Info | 歌情報の取得
36
- To retrieve the poem info,
34
+ When retrieving the 64th poem (it's one of my favourite), what you can do is:
37
35
 
38
- data.poem.kanji #=> "朝ぼらけ 宇治の川霧 たえだえに あらはれわたる 瀬々の網代木"
39
- data.poem.kana #=> "あさぼらけうじのかわぎりたえだえに あらはれわたるせぜのあじろぎ"
40
- data.poem.en #=> "In the early dawn When the mists on Uji River Slowly lift and clear, From the shallows to the deep, The stakes of fishing nets appear."
36
+ poem_data = data.poem(64)
41
37
 
38
+ poem_data.kanji #=> "朝ぼらけ 宇治の川霧 たえだえに あらはれわたる 瀬々の網代木"
39
+ poem_data.kana #=> "あさぼらけうじのかわぎりたえだえに あらはれわたるせぜのあじろぎ"
40
+ poem_data.en #=> "In the early dawn When the mists on Uji River Slowly lift and clear, From the shallows to the deep, The stakes of fishing nets appear."
42
41
 
43
- data.poem.first.kanji #=> "朝ぼらけ宇治の川霧たえだえに"
44
- data.poem.first.kana #=> "あさぼらけうじのかわぎりたえだえに"
45
- data.poem.first.en #=> "In the early dawn When the mists on Uji River Slowly lift and clear,"
42
+ poem_data.first.kanji #=> "朝ぼらけ宇治の川霧たえだえに"
43
+ poem_data.first.kana #=> "あさぼらけうじのかわぎりたえだえに"
44
+ poem_data.first.en #=> "In the early dawn When the mists on Uji River Slowly lift and clear,"
46
45
 
47
- data.poem.last.kanji #=> "あらはれわたる瀬々の網代木"
48
- data.poem.last.kana #=> "あらはれわたるせぜのあじろぎ"
49
- data.poem.last.en #=> "From the shallows to the deep, The stakes of fishing nets appear."
46
+ poem_data.last.kanji #=> "あらはれわたる瀬々の網代木"
47
+ poem_data.last.kana #=> "あらはれわたるせぜのあじろぎ"
48
+ poem_data.last.en #=> "From the shallows to the deep, The stakes of fishing nets appear."
50
49
 
51
- data.poem.comment #=> "「朝ぼらけ」は夜明けであたりがほのぼのと明るくなってくる頃..."
52
-
53
- data.poem.list #=> ["秋の田の かりほの庵の 苫をあらみ わが衣手は 露にぬれつつ", "春過ぎて..."]
54
-
55
- "list" method returns all the poem data in array.
50
+ poem_data.comment #=> "「朝ぼらけ」は夜明けであたりがほのぼのと明るくなってくる頃..."
56
51
 
57
52
  ###Poet Info | 歌人情報の取得
58
53
  To retrieve the poet info for the same poem,
59
54
 
60
- data.poet.name.ja #=> "権中納言定頼"
61
- data.poet.name.en #=> "Fujiwara no Sadayori"
62
- data.poet.period #=> "995-1045"
63
- data.poet.info #=> "本名は藤原定頼(ふじわらの さだより)。平安時代中期の公家・歌人..."
55
+ poet_data = data.poet(64)
56
+
57
+ poet_data.name.ja #=> "権中納言定頼"
58
+ poet_data.name.en #=> "Fujiwara no Sadayori"
59
+ poet_data.period #=> "995-1045"
60
+ poet_data.info #=> "本名は藤原定頼(ふじわらの さだより)。平安時代中期の公家・歌人..."
61
+
62
+ poet_data.male? #=> true
63
+ poet_data.female? #=> false
64
+ poet_data.monk? #=> false
65
+ poet_data.semimaru? #=> false
66
+
67
+ ###List of poems and poets | データをまとめて扱うとき
68
+ If you want to list the poems and poets, you can use "poems" and "poets" method to retrieve the raw data of them.
69
+
70
+ data.poems #=>[{"id"=>1, "poem"=>{"kanji"=>"秋の田の..", ...}}, {"id"=>2, "poem"=>{"kanji"=>"..."}}, ...]
71
+ data.poets #=>[{"id"=>1, "name"=>{"ja"=>"天智天皇", ...}}, {"id"=>2, "name"=>{"kanji"=>"..."}}, ...]
72
+
73
+ Use these to retrieve many poems and poets at the same time.
74
+
75
+
76
+ ##Use image files of the cards
77
+ Image files of the Hyakunin-Issyu cards are installed in this gem.
78
+ If you wanna use these, it's better to copy them to your project directory.
79
+
80
+ The rake task for this is set. Just run the following:
81
+
82
+ rake HyakuninIssyu:install_img['IMG_PATH']
83
+
84
+ then "hyakunin-issyu" directory will be created under your IMG_PATH, and
85
+ all the images will be copied there.
64
86
 
65
- data.poet.male? #=> true
66
- data.poet.female? #=> false
67
- data.poet.monk? #=> false
68
- data.poet.semimaru? #=> false
69
87
 
70
- data.poet.list #=> ["天智天皇", "持統天皇", "柿本人麻呂", ... "]
88
+ **All the images used in this gem are from Wikipedia and they're under the public license.
71
89
 
72
- "list" method returns all the poet names in array.
73
90
 
74
91
  ## Contributing
75
92
 
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ load 'tasks/install_asset.rake'
2
3
 
3
4
  task :default => [:spec]
4
5
  begin
File without changes
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/HyakuninIssyu.rb CHANGED
@@ -2,38 +2,42 @@ require "HyakuninIssyu/version"
2
2
  require "yaml"
3
3
 
4
4
  class HyakuninIssyu
5
- def initialize(id=1)
6
- return false if id<1 || id>100
7
- @poem = Poem.new(id)
8
- @poet = Poet.new(id)
5
+ def initialize
6
+ @@poems = YAML.load_file(File.expand_path(File.join('..', '..', 'assets', 'data', 'poems.yml'), __FILE__))
7
+ @@poets = YAML.load_file(File.expand_path(File.join('..', '..', 'assets', 'data', 'poets.yml'), __FILE__))
9
8
  end
10
9
 
11
- def poem
12
- @poem
10
+ def self.img_path
11
+ File.expand_path("../../assets/img", __FILE__)
12
+ end
13
+
14
+ def poem(id=nil)
15
+ return false if id.nil? || id<1 || id>100
16
+ poem = Poem.new(id)
17
+ end
18
+
19
+ def poet(id=nil)
20
+ return false if id.nil? || id<1 || id>100
21
+ poet = Poet.new(id)
13
22
  end
14
23
 
15
- def poet
16
- @poet
24
+ def poems
25
+ @@poems
17
26
  end
18
27
 
19
- class Poem
28
+ def poets
29
+ @@poets
30
+ end
31
+
32
+ class Poem < self
20
33
  def initialize(id)
21
- @poems = YAML.load_file(File.expand_path(File.join('..', 'data', 'poems.yml'), __FILE__))
22
- @poem = @poems[id-1]
34
+ @poem = @@poems[id-1]
23
35
  end
24
36
 
25
37
  def id
26
38
  @poem['id']
27
39
  end
28
40
 
29
- def list
30
- list = Array.new
31
- for i in 0..99
32
- list << @poems[i]['poem']['kanji']
33
- end
34
- return list
35
- end
36
-
37
41
  def kana
38
42
  @poem["poem"]["kana"]
39
43
  end
@@ -115,24 +119,15 @@ class HyakuninIssyu
115
119
  end
116
120
  end
117
121
 
118
- class Poet
122
+ class Poet < self
119
123
  def initialize(id)
120
- @poets = YAML.load_file(File.expand_path(File.join('..', 'data', 'poets.yml'), __FILE__))
121
- @poet = @poets[id-1]
124
+ @poet = @@poets[id-1]
122
125
  end
123
126
 
124
127
  def id
125
128
  @poet['id']
126
129
  end
127
130
 
128
- def list
129
- list = Array.new
130
- for i in 0..99
131
- list << @poets[i]['name']['ja']
132
- end
133
- return list
134
- end
135
-
136
131
  def name
137
132
  Name.new(@poet)
138
133
  end
@@ -1,3 +1,3 @@
1
1
  class HyakuninIssyu
2
- VERSION = "0.6.2"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ namespace :HyakuninIssyu do
2
+ desc "Copy card images to target directory"
3
+ task :install_img, 'install_dir'
4
+ task :install_img do |t, args|
5
+ require 'HyakuninIssyu'
6
+
7
+ mkdir_p "#{args['install_dir']}/hyakunin-issyu"
8
+ Dir["#{HyakuninIssyu.img_path}/*.jpg"].each do |src|
9
+ cp src, "#{args['install_dir']}/hyakunin-issyu/"
10
+ end
11
+ end
12
+ end
@@ -1,256 +1,232 @@
1
1
  require "spec_helper.rb"
2
2
 
3
3
  describe HyakuninIssyu do
4
+ before { @data = HyakuninIssyu.new }
4
5
  describe 'Poem' do
5
- before { @poems = YAML.load_file(File.expand_path(File.join('..', '..', 'lib', 'data', 'poems.yml'), __FILE__)) }
6
+ before { @poems = YAML.load_file(File.expand_path(File.join('..', '..', 'assets', 'data', 'poems.yml'), __FILE__)) }
6
7
 
7
8
  describe '#id?' do
8
9
  context 'when provided proper id' do
9
- before { @poem = HyakuninIssyu.new(3) }
10
+ before { @poem = @data.poem(3) }
10
11
  it {
11
- @poem.poem.id.should be_true
12
+ @poem.id.should be_true
12
13
  }
13
14
  end
14
15
 
15
16
  context 'when provided unproper id' do
16
- before { @poem = HyakuninIssyu.new(101) }
17
+ before { @poem = @data.poem(101) }
17
18
  it {
18
- @poem.poem.should be_false
19
+ @poem.should be_false
19
20
  }
20
21
  end
21
22
 
22
23
  context 'when provided no id' do
23
- before { @poem = HyakuninIssyu.new }
24
+ before { @poem = @data.poem }
24
25
  it {
25
- @poem.poem.id.should be_true
26
- }
27
-
28
- it {
29
- @poem.poem.id.should eq(1)
26
+ @poem.should be_false
30
27
  }
31
28
  end
32
29
  end
33
30
 
34
- describe '#list' do
35
- before { @poem = HyakuninIssyu.new }
36
- it {
37
- @poem.poem.list.should have(100).items
38
- }
39
- end
40
-
41
- context 'when showing full part' do
42
- before { @poem = HyakuninIssyu.new(10) }
43
-
44
- describe '#kana' do
45
- it {
46
- @poem.poem.kana.should include_kana
47
- }
48
-
49
- it {
50
- @poem.poem.kana.split(//u).size.should eq(32)
51
- }
52
- end
53
-
54
- describe '#kanji' do
55
- it {
56
- @poem.poem.kanji.should include_kanji
57
- }
58
-
59
- it {
60
- @poem.poem.kanji.split(/ /).size.should eq(5)
61
- }
62
- end
63
-
64
- describe '#en' do
65
- it {
66
- @poem.poem.en.should be_english
67
- }
68
- end
69
-
70
- describe '#comment' do
71
- it {
72
- @poem.poem.comment.should include_kanji
73
- }
74
- end
75
-
76
- end
77
-
78
- context 'when showing the first part' do
79
- describe '#kana' do
80
- before { @poem = HyakuninIssyu.new(10) }
81
- it {
82
- @poem.poem.first.kana.should include_kana
83
- }
84
-
85
- it {
86
- @poem.poem.first.kana.split(//u).size.should eq(17)
87
- }
88
- end
89
-
90
- describe '#kanji' do
91
- before { @poem = HyakuninIssyu.new(10) }
92
- it {
93
- @poem.poem.first.kanji.should include_kanji
94
- }
95
- end
96
-
97
- describe '#en' do
98
- before { @poem = HyakuninIssyu.new(10) }
99
- it {
100
- @poem.poem.first.en.should be_english
101
- }
102
- end
103
- end
104
-
105
- context 'when showing the last part' do
106
- describe '#kana' do
107
- before { @poem = HyakuninIssyu.new(10) }
108
- it {
109
- @poem.poem.last.kana.should include_kana
110
- }
111
-
112
- it {
113
- @poem.poem.last.kana.split(//u).size.should eq(14)
114
- }
115
- end
116
-
117
- describe '#kanji' do
118
- before { @poem = HyakuninIssyu.new(10) }
119
- it {
120
- @poem.poem.last.kanji.should include_kanji
121
- }
122
- end
123
-
124
- describe '#en' do
125
- before { @poem = HyakuninIssyu.new(10) }
126
- it {
127
- @poem.poem.last.en.should be_english
128
- }
31
+ context 'with proper poem data' do
32
+ before { @poem = @data.poem(10) }
33
+
34
+ context 'when showing full part' do
35
+ describe '#kana' do
36
+ it {
37
+ @poem.kana.should include_kana
38
+ }
39
+
40
+ it {
41
+ @poem.kana.split(//u).size.should eq(32)
42
+ }
43
+ end
44
+
45
+ describe '#kanji' do
46
+ it {
47
+ @poem.kanji.should include_kanji
48
+ }
49
+
50
+ it {
51
+ @poem.kanji.split(/ /).size.should eq(5)
52
+ }
53
+ end
54
+
55
+ describe '#en' do
56
+ it {
57
+ @poem.en.should be_english
58
+ }
59
+ end
60
+
61
+ describe '#comment' do
62
+ it {
63
+ @poem.comment.should include_kanji
64
+ }
65
+ end
66
+
67
+ end
68
+
69
+ context 'when showing the first part' do
70
+ describe '#kana' do
71
+ it {
72
+ @poem.first.kana.should include_kana
73
+ }
74
+
75
+ it {
76
+ @poem.first.kana.split(//u).size.should eq(17)
77
+ }
78
+ end
79
+
80
+ describe '#kanji' do
81
+ it {
82
+ @poem.first.kanji.should include_kanji
83
+ }
84
+ end
85
+
86
+ describe '#en' do
87
+ it {
88
+ @poem.first.en.should be_english
89
+ }
90
+ end
91
+ end
92
+
93
+ context 'when showing the last part' do
94
+ describe '#kana' do
95
+ it {
96
+ @poem.last.kana.should include_kana
97
+ }
98
+
99
+ it {
100
+ @poem.last.kana.split(//u).size.should eq(14)
101
+ }
102
+ end
103
+
104
+ describe '#kanji' do
105
+ it {
106
+ @poem.last.kanji.should include_kanji
107
+ }
108
+ end
109
+
110
+ describe '#en' do
111
+ it {
112
+ @poem.last.en.should be_english
113
+ }
114
+ end
129
115
  end
130
116
  end
131
117
  end
132
118
 
133
119
  describe 'Poet' do
134
- before { @poets = YAML.load_file(File.expand_path(File.join('..', '..', 'lib', 'data', 'poets.yml'), __FILE__)) }
120
+ before { @poets = YAML.load_file(File.expand_path(File.join('..', '..', 'assets', 'data', 'poets.yml'), __FILE__)) }
135
121
 
136
122
  describe '#id?' do
137
123
  context 'when provided proper id' do
138
- before { @poet = HyakuninIssyu.new(3) }
124
+ before { @poet = @data.poet(3) }
139
125
  it {
140
- @poet.poet.id.should be_true
126
+ @poet.id.should be_true
141
127
  }
142
128
  end
143
129
 
144
130
  context 'when provided unproper id' do
145
- before { @poet = HyakuninIssyu.new(101) }
131
+ before { @poet = @data.poet(101) }
146
132
  it {
147
- @poet.poet.should be_false
133
+ @poet.should be_false
148
134
  }
149
135
  end
150
136
 
151
137
  context 'when provided no id' do
152
- before { @poet = HyakuninIssyu.new }
153
- it {
154
- @poet.poet.id.should be_true
155
- }
156
-
157
- it {
158
- @poet.poet.id.should eq(1)
159
- }
160
- end
161
- end
162
-
163
- describe '#list' do
164
- before { @poet = HyakuninIssyu.new }
165
- it {
166
- @poet.poet.list.should have(100).items
167
- }
168
- end
169
-
170
- describe '#name' do
171
- before { @poet = HyakuninIssyu.new }
172
-
173
- describe '#ja' do
174
- it {
175
- @poet.poet.name.ja.should include_kanji
176
- }
177
- end
178
-
179
- describe '#en' do
180
- it {
181
- @poet.poet.name.en.should be_english
182
- }
183
- end
184
- end
185
-
186
- describe '#period' do
187
- before { @poet = HyakuninIssyu.new }
188
- it {
189
- @poet.poet.period.should match(/-/)
190
- }
191
- end
192
-
193
- describe '#male?' do
194
- context 'when poet is male' do
195
- before { @poet = HyakuninIssyu.new(1) }
196
- it {
197
- @poet.poet.male?.should be_true
198
- }
199
- end
200
-
201
- context 'when poet is female' do
202
- before { @poet = HyakuninIssyu.new(2) }
203
- it {
204
- @poet.poet.male?.should be_false
205
- }
206
- end
207
- end
208
-
209
- describe '#female?' do
210
- context 'when poet is male' do
211
- before { @poet = HyakuninIssyu.new(1) }
138
+ before { @poet = @data.poet }
212
139
  it {
213
- @poet.poet.female?.should be_false
214
- }
215
- end
216
-
217
- context 'when poet is female' do
218
- before { @poet = HyakuninIssyu.new(2) }
219
- it {
220
- @poet.poet.female?.should be_true
140
+ @poet.should be_false
221
141
  }
222
142
  end
223
143
  end
224
144
 
225
- describe '#monk?' do
226
- context 'when poet is monk' do
227
- before { @poet = HyakuninIssyu.new(8) }
228
- it {
229
- @poet.poet.monk?.should be_true
230
- }
231
- end
232
-
233
- context 'when poet is not monk' do
234
- before { @poet = HyakuninIssyu.new(1) }
235
- it {
236
- @poet.poet.monk?.should be_false
237
- }
238
- end
239
- end
240
-
241
- describe '#semimaru?' do
242
- context 'when poet is semimaru' do
243
- before { @poet = HyakuninIssyu.new(10) }
244
- it {
245
- @poet.poet.semimaru?.should be_true
246
- }
247
- end
248
-
249
- context 'when poet is not semimaru' do
250
- before { @poet = HyakuninIssyu.new(1) }
251
- it {
252
- @poet.poet.semimaru?.should be_false
253
- }
145
+ context 'with proper poet data' do
146
+ before { @poet = @data.poet(10) }
147
+
148
+ describe '#name' do
149
+ describe '#ja' do
150
+ it {
151
+ @poet.name.ja.should include_kanji
152
+ }
153
+ end
154
+
155
+ describe '#en' do
156
+ it {
157
+ @poet.name.en.should be_english
158
+ }
159
+ end
160
+ end
161
+
162
+ describe '#period' do
163
+ it {
164
+ @poet.period.should match(/-/)
165
+ }
166
+ end
167
+
168
+ describe '#male?' do
169
+ context 'when poet is male' do
170
+ before { @poet = @data.poet(1) }
171
+ it {
172
+ @poet.male?.should be_true
173
+ }
174
+ end
175
+
176
+ context 'when poet is female' do
177
+ before { @poet = @data.poet(2) }
178
+ it {
179
+ @poet.male?.should be_false
180
+ }
181
+ end
182
+ end
183
+
184
+ describe '#female?' do
185
+ context 'when poet is male' do
186
+ before { @poet = @data.poet(1) }
187
+ it {
188
+ @poet.female?.should be_false
189
+ }
190
+ end
191
+
192
+ context 'when poet is female' do
193
+ before { @poet = @data.poet(2) }
194
+ it {
195
+ @poet.female?.should be_true
196
+ }
197
+ end
198
+ end
199
+
200
+ describe '#monk?' do
201
+ context 'when poet is monk' do
202
+ before { @poet = @data.poet(8) }
203
+ it {
204
+ @poet.monk?.should be_true
205
+ }
206
+ end
207
+
208
+ context 'when poet is not monk' do
209
+ before { @poet = @data.poet(1) }
210
+ it {
211
+ @poet.monk?.should be_false
212
+ }
213
+ end
214
+ end
215
+
216
+ describe '#semimaru?' do
217
+ context 'when poet is semimaru' do
218
+ before { @poet = @data.poet(10) }
219
+ it {
220
+ @poet.semimaru?.should be_true
221
+ }
222
+ end
223
+
224
+ context 'when poet is not semimaru' do
225
+ before { @poet = @data.poet(1) }
226
+ it {
227
+ @poet.semimaru?.should be_false
228
+ }
229
+ end
254
230
  end
255
231
  end
256
232
  end
data/spec/spec_helper.rb CHANGED
@@ -2,8 +2,6 @@ require "rubygems"
2
2
  require "bundler/setup"
3
3
  require "HyakuninIssyu"
4
4
  require "moji"
5
- require 'coveralls'
6
- Coveralls.wear!
7
5
 
8
6
  RSpec.configure do |config|
9
7
  config.mock_framework = :rspec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HyakuninIssyu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomomichi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: coveralls
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  description: This Gem offer all the information about Hyakunin-issyu, the One Hundred
84
70
  Poems by One Hundred Poets.
85
71
  email:
@@ -96,10 +82,111 @@ files:
96
82
  - LICENSE.txt
97
83
  - README.md
98
84
  - Rakefile
85
+ - assets/data/poems.yml
86
+ - assets/data/poets.yml
87
+ - assets/img/001.jpg
88
+ - assets/img/002.jpg
89
+ - assets/img/003.jpg
90
+ - assets/img/004.jpg
91
+ - assets/img/005.jpg
92
+ - assets/img/006.jpg
93
+ - assets/img/007.jpg
94
+ - assets/img/008.jpg
95
+ - assets/img/009.jpg
96
+ - assets/img/010.jpg
97
+ - assets/img/011.jpg
98
+ - assets/img/012.jpg
99
+ - assets/img/013.jpg
100
+ - assets/img/014.jpg
101
+ - assets/img/015.jpg
102
+ - assets/img/016.jpg
103
+ - assets/img/017.jpg
104
+ - assets/img/018.jpg
105
+ - assets/img/019.jpg
106
+ - assets/img/020.jpg
107
+ - assets/img/021.jpg
108
+ - assets/img/022.jpg
109
+ - assets/img/023.jpg
110
+ - assets/img/024.jpg
111
+ - assets/img/025.jpg
112
+ - assets/img/026.jpg
113
+ - assets/img/027.jpg
114
+ - assets/img/028.jpg
115
+ - assets/img/029.jpg
116
+ - assets/img/030.jpg
117
+ - assets/img/031.jpg
118
+ - assets/img/032.jpg
119
+ - assets/img/033.jpg
120
+ - assets/img/034.jpg
121
+ - assets/img/035.jpg
122
+ - assets/img/036.jpg
123
+ - assets/img/037.jpg
124
+ - assets/img/038.jpg
125
+ - assets/img/039.jpg
126
+ - assets/img/040.jpg
127
+ - assets/img/041.jpg
128
+ - assets/img/042.jpg
129
+ - assets/img/043.jpg
130
+ - assets/img/044.jpg
131
+ - assets/img/045.jpg
132
+ - assets/img/046.jpg
133
+ - assets/img/047.jpg
134
+ - assets/img/048.jpg
135
+ - assets/img/049.jpg
136
+ - assets/img/050.jpg
137
+ - assets/img/051.jpg
138
+ - assets/img/052.jpg
139
+ - assets/img/053.jpg
140
+ - assets/img/054.jpg
141
+ - assets/img/055.jpg
142
+ - assets/img/056.jpg
143
+ - assets/img/057.jpg
144
+ - assets/img/058.jpg
145
+ - assets/img/059.jpg
146
+ - assets/img/060.jpg
147
+ - assets/img/061.jpg
148
+ - assets/img/062.jpg
149
+ - assets/img/063.jpg
150
+ - assets/img/064.jpg
151
+ - assets/img/065.jpg
152
+ - assets/img/066.jpg
153
+ - assets/img/067.jpg
154
+ - assets/img/068.jpg
155
+ - assets/img/069.jpg
156
+ - assets/img/070.jpg
157
+ - assets/img/071.jpg
158
+ - assets/img/072.jpg
159
+ - assets/img/073.jpg
160
+ - assets/img/074.jpg
161
+ - assets/img/075.jpg
162
+ - assets/img/076.jpg
163
+ - assets/img/077.jpg
164
+ - assets/img/078.jpg
165
+ - assets/img/079.jpg
166
+ - assets/img/080.jpg
167
+ - assets/img/081.jpg
168
+ - assets/img/082.jpg
169
+ - assets/img/083.jpg
170
+ - assets/img/084.jpg
171
+ - assets/img/085.jpg
172
+ - assets/img/086.jpg
173
+ - assets/img/087.jpg
174
+ - assets/img/088.jpg
175
+ - assets/img/089.jpg
176
+ - assets/img/090.jpg
177
+ - assets/img/091.jpg
178
+ - assets/img/092.jpg
179
+ - assets/img/093.jpg
180
+ - assets/img/094.jpg
181
+ - assets/img/095.jpg
182
+ - assets/img/096.jpg
183
+ - assets/img/097.jpg
184
+ - assets/img/098.jpg
185
+ - assets/img/099.jpg
186
+ - assets/img/100.jpg
99
187
  - lib/HyakuninIssyu.rb
100
188
  - lib/HyakuninIssyu/version.rb
101
- - lib/data/poems.yml
102
- - lib/data/poets.yml
189
+ - lib/tasks/install_asset.rake
103
190
  - spec/hyakuninissyu_spec.rb
104
191
  - spec/spec_helper.rb
105
192
  homepage: https://github.com/Tomomichi/HyakuninIssyu