├── .rspec ├── .travis.yml ├── lib ├── rubipara │ ├── version.rb │ ├── aa.rb │ ├── episode.rb │ ├── character.rb │ └── cli.rb └── rubipara.rb ├── bin └── rubipara ├── spec ├── spec_helper.rb ├── rubipara_spec.rb ├── aa │ └── aa_spec.rb ├── episodes │ └── episode_spec.rb └── characters │ └── character_spec.rb ├── Gemfile ├── Rakefile ├── .gitignore ├── config ├── aa │ └── kashikoma.txt ├── character.yml └── episode.yml ├── LICENSE.txt ├── rubipara.gemspec └── README.md /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.0.0 4 | -------------------------------------------------------------------------------- /lib/rubipara/version.rb: -------------------------------------------------------------------------------- 1 | module Rubipara 2 | VERSION = "0.0.1" 3 | end 4 | -------------------------------------------------------------------------------- /bin/rubipara: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'rubipara' 4 | Rubipara::CLI.start(ARGV) 5 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 2 | require 'rubipara' 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in rubipara.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | 6 | task :default => :spec 7 | 8 | -------------------------------------------------------------------------------- /spec/rubipara_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Rubipara do 4 | it 'has a version number' do 5 | expect(Rubipara::VERSION).not_to be nil 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.bundle 11 | *.so 12 | *.o 13 | *.a 14 | *.swp 15 | .DS_Store 16 | mkmf.log 17 | -------------------------------------------------------------------------------- /lib/rubipara.rb: -------------------------------------------------------------------------------- 1 | require 'yaml' 2 | require 'rubipara/aa' 3 | require 'rubipara/character' 4 | require 'rubipara/episode' 5 | require 'rubipara/cli' 6 | require 'rubipara/version' 7 | 8 | module Rubipara 9 | end 10 | -------------------------------------------------------------------------------- /spec/aa/aa_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Rubipara::AA do 4 | 5 | describe '.new' do 6 | context 'when the arg is a name of an exising AA' do 7 | it { expect(Rubipara::AA.new(:kashikoma).aa_lines.length).to be > 0 } 8 | end 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /config/aa/kashikoma.txt: -------------------------------------------------------------------------------- 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 | 16 | -------------------------------------------------------------------------------- /lib/rubipara/aa.rb: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /lib/rubipara/episode.rb: -------------------------------------------------------------------------------- 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 26 | -------------------------------------------------------------------------------- /config/character.yml: -------------------------------------------------------------------------------- 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: ドロシーがそう言うなら 42 | -------------------------------------------------------------------------------- /lib/rubipara/character.rb: -------------------------------------------------------------------------------- 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 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 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. 23 | -------------------------------------------------------------------------------- /config/episode.yml: -------------------------------------------------------------------------------- 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 | 64 | -------------------------------------------------------------------------------- /rubipara.gemspec: -------------------------------------------------------------------------------- 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 26 | -------------------------------------------------------------------------------- /spec/episodes/episode_spec.rb: -------------------------------------------------------------------------------- 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 45 | -------------------------------------------------------------------------------- /spec/characters/character_spec.rb: -------------------------------------------------------------------------------- 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 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 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 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 100 | -------------------------------------------------------------------------------- /lib/rubipara/cli.rb: -------------------------------------------------------------------------------- 1 | require 'thor' 2 | 3 | module Rubipara 4 | class CLI < Thor 5 | 6 | desc 'kashikoma []', "Let's say 'Kashikoma!' together! With an option , 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 []', "Show names of characters. With an option , 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 []', 'List pripara anime episodes. With an option , show the No. 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 86 | --------------------------------------------------------------------------------