rubipara 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +99 -0
- data/Rakefile +7 -0
- data/bin/rubipara +4 -0
- data/config/aa/kashikoma.txt +15 -0
- data/config/character.yml +41 -0
- data/config/episode.yml +63 -0
- data/lib/rubipara/aa.rb +21 -0
- data/lib/rubipara/character.rb +29 -0
- data/lib/rubipara/cli.rb +85 -0
- data/lib/rubipara/episode.rb +25 -0
- data/lib/rubipara/version.rb +3 -0
- data/lib/rubipara.rb +9 -0
- data/rubipara.gemspec +25 -0
- data/spec/aa/aa_spec.rb +11 -0
- data/spec/characters/character_spec.rb +44 -0
- data/spec/episodes/episode_spec.rb +44 -0
- data/spec/rubipara_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a06aa910870ece8b364838efc89a36bbf2fb0323
|
4
|
+
data.tar.gz: d1827f7f6c0288c1be71af39e8067c2a8a0ff8b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0fa70fadac27221b6a291e8b63049983578de93084de9cc3f567f142e47fb55b749ecf3779ec77ac715ac610056daf6c5346d0f05a2700f892ca6928d3f72b18
|
7
|
+
data.tar.gz: d724d793edd4cacbe11fe07f9bac7ed721afaa196965be8b770f9e71912c43742b74c32b7fd532645a2f6611f29057fc8acb8d9c93b53e5686a29db4f582ad6c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 hodaka
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# Rubipara
|
2
|
+
|
3
|
+
ポップ ステップ げっちゅー☆
|
4
|
+
プリパラの世界へようこそぷり
|
5
|
+
Rubipara はプリパラの世界を知るための gem なんだぷり
|
6
|
+
Rubipara を使い続けていれば、きっと君のところにもプリチケが届くぷり
|
7
|
+
|
8
|
+
まだまだ Rubipara ピカピカけんきゅうせい(v0.0.1)だけど、
|
9
|
+
これからも応援よろしくぷり♡
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
以下の行を、君の Gemfile に追記するぷり
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'rubipara'
|
18
|
+
```
|
19
|
+
|
20
|
+
できたら、以下のコマンドを実行するぷり
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ bundle
|
25
|
+
```
|
26
|
+
|
27
|
+
それか、以下のコマンドを実行してもインストールできるぷりよ
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
```
|
31
|
+
$ gem install rubipara
|
32
|
+
```
|
33
|
+
|
34
|
+
さあ、ここまでできたらコマンドラインで rubipara と打ってみるぷり
|
35
|
+
コマンドのヘルプがでたら、計算どおりぷり
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
Rubipara は CLI で機能を提供しているぷり
|
40
|
+
こんな使い方ができるから、よーく勉強しておくぷり
|
41
|
+
|
42
|
+
|
43
|
+
##### キャラクターを一覧で表示させるぷり
|
44
|
+
```
|
45
|
+
$ rubipara character
|
46
|
+
#=> lala : 真中らぁら
|
47
|
+
#=> mirei : 南みれぃ
|
48
|
+
#=> sophie : 北条そふぃ
|
49
|
+
#=> shion : 東堂シオン
|
50
|
+
#=> dorothy : ドロシー・ウェスト
|
51
|
+
#=> leona : レオナ・ウェスト
|
52
|
+
```
|
53
|
+
|
54
|
+
##### キャラクターのプロフィールを表示させるぷり
|
55
|
+
```
|
56
|
+
$ rubipara character lala
|
57
|
+
#=> 真中らぁら のプロフィール
|
58
|
+
#=> 名前 真中らぁら
|
59
|
+
#=> 声優 茜屋日海夏
|
60
|
+
#=> 誕生日 11月20日
|
61
|
+
#=> 学年 小学5年生
|
62
|
+
#=> チーム SoLaMi SMILE
|
63
|
+
#=> 口癖 かしこま!
|
64
|
+
```
|
65
|
+
|
66
|
+
##### アニメのエピソードを表示させるぷり
|
67
|
+
```
|
68
|
+
$ rubipara episode 1
|
69
|
+
#=> 第1話 アイドル始めちゃいました!
|
70
|
+
|
71
|
+
# 今までのエピソードをすべて表示させたい場合は、引数なしで実行するぷり
|
72
|
+
$ rubipara episode
|
73
|
+
```
|
74
|
+
|
75
|
+
##### らぁらとかしこま!するぷり
|
76
|
+
```
|
77
|
+
# らぁらがかしこま!してくれるぷり
|
78
|
+
$ rubipara kashikoma
|
79
|
+
|
80
|
+
# らぁらに言ってほしい言葉を教えてあげるぷり
|
81
|
+
$ rubipara kashikoma <word>
|
82
|
+
```
|
83
|
+
|
84
|
+
##### もっとくわしく知りたければ help を見るぷり
|
85
|
+
```
|
86
|
+
$ rubipara help [COMMAND]
|
87
|
+
```
|
88
|
+
|
89
|
+
## Version
|
90
|
+
|
91
|
+
0.0.1 (ピカピカけんきゅうせい)
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
1. Fork the project
|
96
|
+
2. Create your feature branch (`git checkout -b feature/hoge`)
|
97
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
98
|
+
4. Push to the branch (`git push origin feature/hoge`)
|
99
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/rubipara
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/^v \
|
4
|
+
_{ / |-.(`_ ̄}__
|
5
|
+
_人_ 〃⌒ ン'八{ `ノト、`ヽ
|
6
|
+
`Y´ {l/ / / / Vノ } ノ (#{word})
|
7
|
+
,-m彡-ァ Lメ、_彡イ } }<く O
|
8
|
+
/ _Uヽ⊂ニ{J:} '⌒V { l| o
|
9
|
+
/ r‐='V(「`¨, r=≪,/ { .ノノ
|
10
|
+
/ /_xヘ 人 丶- _彡イ ∧〉
|
11
|
+
( ノ¨フ’ `^> ‐ァァ <¨フイ
|
12
|
+
--=〉_丶/ノ { 彡' '| Everyone loves Pripara!
|
13
|
+
^ '7^ O〉|’ ,丿
|
14
|
+
____ ___ __ _{’O 乙,_r[_ __ ___ __________________________
|
15
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
lala:
|
2
|
+
name: 真中らぁら
|
3
|
+
cv: 茜屋日海夏
|
4
|
+
grade: 小学5年生
|
5
|
+
team: SoLaMi SMILE
|
6
|
+
fav_phrase: かしこま!
|
7
|
+
|
8
|
+
mirei:
|
9
|
+
name: 南みれぃ
|
10
|
+
cv: 芹澤優
|
11
|
+
grade: 中学1年生
|
12
|
+
team: SoLaMi SMILE
|
13
|
+
fav_phrase: 計算どおり
|
14
|
+
|
15
|
+
sophie:
|
16
|
+
name: 北条そふぃ
|
17
|
+
cv: 久保田未夢
|
18
|
+
grade: 中学2年生
|
19
|
+
team: SoLaMi SMILE
|
20
|
+
fav_phrase: ぷしゅー
|
21
|
+
|
22
|
+
shion:
|
23
|
+
name: 東堂シオン
|
24
|
+
cv: 山北早紀
|
25
|
+
grade: 中学1年生
|
26
|
+
team: Dressing Pafé
|
27
|
+
fav_phrase: いご
|
28
|
+
|
29
|
+
dorothy:
|
30
|
+
name: ドロシー・ウェスト
|
31
|
+
cv: 澁谷梓希
|
32
|
+
grade: 中学1年生
|
33
|
+
team: Dressing Pafé
|
34
|
+
fav_phrase: テンションマックス
|
35
|
+
|
36
|
+
leona:
|
37
|
+
name: レオナ・ウェスト
|
38
|
+
cv: 若井友希
|
39
|
+
grade: 中学1年生
|
40
|
+
team: Dressing Pafé
|
41
|
+
fav_phrase: ドロシーがそう言うなら
|
data/config/episode.yml
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
1:
|
2
|
+
title: アイドル始めちゃいました!
|
3
|
+
2:
|
4
|
+
title: 約束やぶっちゃダメぷりっ
|
5
|
+
3:
|
6
|
+
title: チーム解散?困るクマ~!
|
7
|
+
4:
|
8
|
+
title: かしこま!元気 For You
|
9
|
+
5:
|
10
|
+
title: あたし、そふぃさんと歌いたいワニ!
|
11
|
+
6:
|
12
|
+
title: 異議あり?らぁらがウチにやってきたっぷり!
|
13
|
+
7:
|
14
|
+
title: レッドフラッシュを探して…
|
15
|
+
8:
|
16
|
+
title: ドキドキ!夏だ!水着だ!プールでかしこまっ♪
|
17
|
+
9:
|
18
|
+
title: ときめきアイドル大集合!
|
19
|
+
10:
|
20
|
+
title: 秋色ラブリーライブ
|
21
|
+
11:
|
22
|
+
title: どうする?どうなる!?3人目!!!
|
23
|
+
12:
|
24
|
+
title: はばたけ、そふぃ!
|
25
|
+
13:
|
26
|
+
title: 空見て笑って♡チーム名発表!
|
27
|
+
14:
|
28
|
+
title: ライバル登場!イゴ、よろしく!!
|
29
|
+
15:
|
30
|
+
title: 一触即発?シオンVSみれぃぷりっ!
|
31
|
+
16:
|
32
|
+
title: 特ダネ!らぁらのヒミツばれちゃった!?
|
33
|
+
17:
|
34
|
+
title: 恐怖のハロウィン!ジャック・OH!蘭たん!?
|
35
|
+
18:
|
36
|
+
title: レオナ、全力ダッシュなの!
|
37
|
+
19:
|
38
|
+
title: みれぃとクマ、運命の出会いぷりクマ!
|
39
|
+
20:
|
40
|
+
title: パスタVS忍者!
|
41
|
+
21:
|
42
|
+
title: 解散!?そふぃ様親衛隊
|
43
|
+
22:
|
44
|
+
title: 学園祭でライブクマ~!
|
45
|
+
23:
|
46
|
+
title: 最後の日でっすわ!
|
47
|
+
24:
|
48
|
+
title: さよなら、プリパラ
|
49
|
+
25:
|
50
|
+
title: クリスマスプレゼントフォーユー!
|
51
|
+
26:
|
52
|
+
title: いよいよあの子がデビューでちゅ
|
53
|
+
27:
|
54
|
+
title: あけおめでかしこま!
|
55
|
+
28:
|
56
|
+
title: プリパラ囲碁パンダでございます
|
57
|
+
29:
|
58
|
+
title: EZ DO グロササイズ
|
59
|
+
30:
|
60
|
+
title: ドキドキ!パラダイスコーデは誰のもの!?
|
61
|
+
31:
|
62
|
+
title: スマイル!そらみ♡スマイル
|
63
|
+
|
data/lib/rubipara/aa.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Rubipara
|
2
|
+
class AA
|
3
|
+
|
4
|
+
attr_reader :aa_lines, :word, :max_length
|
5
|
+
|
6
|
+
def initialize(file_name, word: nil, max_length: 20)
|
7
|
+
@aa_lines = get_aa_lines(file_name.to_s)
|
8
|
+
@word = word
|
9
|
+
@max_length = max_length
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
# return an array whose elements contain each line in AA
|
15
|
+
# Ex. arr[0] contains the first line of AA, arr[1] contains the second line of AA.
|
16
|
+
def get_aa_lines(file_name)
|
17
|
+
File.open("#{File.dirname(__FILE__)}/../../config/aa/#{file_name}.txt") {|f| f.readlines }
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Rubipara
|
2
|
+
class Character
|
3
|
+
class NotFoundError < StandardError; end
|
4
|
+
|
5
|
+
attr_reader :en_name, :name, :cv, :grade, :team, :fav_phrase
|
6
|
+
|
7
|
+
@@config = YAML.load_file("#{File.dirname(__FILE__)}/../../config/character.yml")
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# return an array of character objects of all characters
|
12
|
+
def all
|
13
|
+
@@config.keys.map {|name| Character.new name }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(name)
|
19
|
+
raise NotFoundError.new('ERROR: No such a character') unless @@config.has_key?(name)
|
20
|
+
@en_name = name # English first name
|
21
|
+
@name = @@config[name]['name'] # Japanese full name
|
22
|
+
@cv = @@config[name]['cv']
|
23
|
+
@grade = @@config[name]['grade']
|
24
|
+
@team = @@config[name]['team']
|
25
|
+
@fav_phrase = @@config[name]['fav_phrase']
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/lib/rubipara/cli.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Rubipara
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
desc 'kashikoma [<word>]', "Let's say 'Kashikoma!' together! With an option <word>, Lala says the word!"
|
7
|
+
def kashikoma(word = 'Kashikoma!')
|
8
|
+
kashikoma = Rubipara::AA.new(:kashikoma, word: word)
|
9
|
+
puts_aa kashikoma
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'character [<name>]', "Show names of characters. With an option <name>, show the character's profile"
|
13
|
+
def character(name = nil)
|
14
|
+
if name
|
15
|
+
begin
|
16
|
+
character = Rubipara::Character.new(name)
|
17
|
+
puts_character_profile character
|
18
|
+
rescue Rubipara::Character::NotFoundError => e
|
19
|
+
puts e.message
|
20
|
+
end
|
21
|
+
else
|
22
|
+
Rubipara::Character.all.each {|character| puts_character_name character }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'profile', 'Show profiles of all characters'
|
27
|
+
def profile
|
28
|
+
Rubipara::Character.all.each {|character| puts_character_profile character }
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'epiqsode [<num>]', 'List pripara anime episodes. With an option <num>, show the No.<num> episode'
|
32
|
+
def episode(episode_num = nil)
|
33
|
+
if episode_num
|
34
|
+
begin
|
35
|
+
episode = Rubipara::Episode.new(episode_num)
|
36
|
+
puts_episode_info episode
|
37
|
+
rescue Rubipara::Episode::NotFoundError => e
|
38
|
+
puts e.message
|
39
|
+
end
|
40
|
+
else
|
41
|
+
Rubipara::Episode.all.each {|episode| puts_episode_info episode }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def puts_aa(aa)
|
48
|
+
aa.aa_lines.each do |line|
|
49
|
+
# substitute some words for #{word} in AA if necessary
|
50
|
+
if line.include?('#{word}') && aa.word
|
51
|
+
line.gsub!(/\#\{word\}/, adjust_word(aa.word, aa.max_length))
|
52
|
+
end
|
53
|
+
puts line
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def puts_character_profile(character)
|
58
|
+
puts "\n"
|
59
|
+
puts "#{character.name} プロフィール"
|
60
|
+
puts "名前\t: #{character.name}"
|
61
|
+
puts "声優\t: #{character.cv}"
|
62
|
+
puts "学年\t: #{character.grade}"
|
63
|
+
puts "チーム\t: #{character.team}"
|
64
|
+
puts "口癖\t: #{character.fav_phrase}"
|
65
|
+
puts "\n"
|
66
|
+
end
|
67
|
+
|
68
|
+
def puts_character_name(character)
|
69
|
+
puts "#{character.en_name}\t: #{character.name}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def puts_episode_info(episode)
|
73
|
+
puts "第#{sprintf("%02d", episode.episode_num)}話\t#{episode.title}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def adjust_word(word, max_length)
|
77
|
+
if (word.length > max_length)
|
78
|
+
word[0, max_length]
|
79
|
+
else
|
80
|
+
word.center(max_length, ' ')
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Rubipara
|
2
|
+
class Episode
|
3
|
+
class NotFoundError < StandardError; end
|
4
|
+
|
5
|
+
attr_reader :episode_num, :title
|
6
|
+
|
7
|
+
@@config = YAML.load_file("#{File.dirname(__FILE__)}/../../config/episode.yml")
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# return an array of episode objects of all episodes
|
12
|
+
def all
|
13
|
+
@@config.keys.map {|episode_num| Episode.new episode_num }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(episode_num)
|
19
|
+
@episode_num = episode_num.to_i
|
20
|
+
raise NotFoundError.new('ERROR: No such an episode') unless @@config.has_key?(@episode_num)
|
21
|
+
@title = @@config[@episode_num]['title']
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/rubipara.rb
ADDED
data/rubipara.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rubipara/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rubipara"
|
8
|
+
spec.version = Rubipara::VERSION
|
9
|
+
spec.authors = ["hodaka"]
|
10
|
+
spec.email = ["altitude3190@gmail.com"]
|
11
|
+
spec.summary = "Rubipara is a portmanteau of Ruby and Pripara. Here are all of Pripara everyone loves."
|
12
|
+
spec.description = "Pripara is an excellent Japanese idol anime. When you approve something, let's say 'Kashikoma!' instead of 'OK'."
|
13
|
+
spec.homepage = "https://github.com/altitude3190/rubipara"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "thor"
|
25
|
+
end
|
data/spec/aa/aa_spec.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rubipara::Character do
|
4
|
+
|
5
|
+
let(:characters) { Rubipara::Character.all }
|
6
|
+
|
7
|
+
describe '.new' do
|
8
|
+
context 'when the arg is a name of an exising character' do
|
9
|
+
it { expect(Rubipara::Character.new('lala').name).to eq('真中らぁら') }
|
10
|
+
end
|
11
|
+
context 'with invalid string args' do
|
12
|
+
it 'should throw an exception of Rubipara::Character::NotFoundError' do
|
13
|
+
expect{Rubipara::Character.new 'invalid'}.to raise_error(Rubipara::Character::NotFoundError, 'ERROR: No such a character')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
context 'with too big number args' do
|
17
|
+
it 'should throw an exception of Rubipara::Character::NotFoundError' do
|
18
|
+
expect{Rubipara::Character.new(9999999)}.to raise_error(Rubipara::Character::NotFoundError, 'ERROR: No such a character')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
context 'with negative number args' do
|
22
|
+
it 'should throw an exception of Rubipara::Character::NotFoundError' do
|
23
|
+
expect{Rubipara::Character.new(-3)}.to raise_error(Rubipara::Character::NotFoundError, 'ERROR: No such a character')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
context 'with number 0' do
|
27
|
+
it 'should throw an exception of Rubipara::Character::NotFoundError' do
|
28
|
+
expect{Rubipara::Character.new(0)}.to raise_error(Rubipara::Character::NotFoundError, 'ERROR: No such a character')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.all' do
|
34
|
+
context 'when it is called' do
|
35
|
+
before { characters = Rubipara::Character.all }
|
36
|
+
it { expect(characters.instance_of?(Array)).to be true }
|
37
|
+
it { expect(characters.length).to be > 0 }
|
38
|
+
it 'should return an array composed of character objects' do
|
39
|
+
expect(characters[0].instance_of?(Rubipara::Character)).to be true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rubipara::Episode do
|
4
|
+
|
5
|
+
let(:episodes) { Rubipara::Episode.all }
|
6
|
+
|
7
|
+
describe '.new' do
|
8
|
+
context 'when the arg is an episode number which has been already broadcast' do
|
9
|
+
it { expect(Rubipara::Episode.new(2).title).to eq('約束やぶっちゃダメぷりっ') }
|
10
|
+
end
|
11
|
+
context 'with invalid string args' do
|
12
|
+
it 'should throw an exception of Rubipara::Episode::NotFoundError' do
|
13
|
+
expect{Rubipara::Episode.new 'invalid'}.to raise_error(Rubipara::Episode::NotFoundError, 'ERROR: No such an episode')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
context 'with too big number args' do
|
17
|
+
it 'should throw an exception of Rubipara::Episode::NotFoundError' do
|
18
|
+
expect{Rubipara::Episode.new(9999999)}.to raise_error(Rubipara::Episode::NotFoundError, 'ERROR: No such an episode')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
context 'with negative number args' do
|
22
|
+
it 'should throw an exception of Rubipara::Episode::NotFoundError' do
|
23
|
+
expect{Rubipara::Episode.new(-3)}.to raise_error(Rubipara::Episode::NotFoundError, 'ERROR: No such an episode')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
context 'with number 0' do
|
27
|
+
it 'should throw an exception of Rubipara::Episode::NotFoundError' do
|
28
|
+
expect{Rubipara::Episode.new(0)}.to raise_error(Rubipara::Episode::NotFoundError, 'ERROR: No such an episode')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.all' do
|
34
|
+
context 'when it is called' do
|
35
|
+
before { episodes = Rubipara::Episode.all }
|
36
|
+
it { expect(episodes.instance_of?(Array)).to be true }
|
37
|
+
it { expect(episodes.length).to be > 0 }
|
38
|
+
it 'should return an array composed of episode objects' do
|
39
|
+
expect(episodes[0].instance_of?(Rubipara::Episode)).to be true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubipara
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- hodaka
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Pripara is an excellent Japanese idol anime. When you approve something,
|
70
|
+
let's say 'Kashikoma!' instead of 'OK'.
|
71
|
+
email:
|
72
|
+
- altitude3190@gmail.com
|
73
|
+
executables:
|
74
|
+
- rubipara
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .rspec
|
80
|
+
- .travis.yml
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/rubipara
|
86
|
+
- config/aa/kashikoma.txt
|
87
|
+
- config/character.yml
|
88
|
+
- config/episode.yml
|
89
|
+
- lib/rubipara.rb
|
90
|
+
- lib/rubipara/aa.rb
|
91
|
+
- lib/rubipara/character.rb
|
92
|
+
- lib/rubipara/cli.rb
|
93
|
+
- lib/rubipara/episode.rb
|
94
|
+
- lib/rubipara/version.rb
|
95
|
+
- rubipara.gemspec
|
96
|
+
- spec/aa/aa_spec.rb
|
97
|
+
- spec/characters/character_spec.rb
|
98
|
+
- spec/episodes/episode_spec.rb
|
99
|
+
- spec/rubipara_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
homepage: https://github.com/altitude3190/rubipara
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.4.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Rubipara is a portmanteau of Ruby and Pripara. Here are all of Pripara everyone
|
125
|
+
loves.
|
126
|
+
test_files:
|
127
|
+
- spec/aa/aa_spec.rb
|
128
|
+
- spec/characters/character_spec.rb
|
129
|
+
- spec/episodes/episode_spec.rb
|
130
|
+
- spec/rubipara_spec.rb
|
131
|
+
- spec/spec_helper.rb
|