Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge develop-1.0.0 to master #132

Merged
merged 32 commits into from
Jan 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2b7caa7
Allow branch build develop-1.0.0
sue445 Dec 8, 2016
aeb8325
Remove Girl#humanize
sue445 Dec 8, 2016
1a67d08
Merge pull request #124 from sue445/feature/remove_deprecated_method
sue445 Dec 8, 2016
29e2884
Apply block style of yaml to the transform messages.
greymd Dec 14, 2016
cf763e4
Merge pull request #125 from greymd/feature/enable_line_breaks
sue445 Dec 14, 2016
796ab3a
Merge remote-tracking branch 'origin/master' into develop-1.0.0
sue445 Dec 25, 2016
94e4acc
Merge remote-tracking branch 'origin/master' into develop-1.0.0
sue445 Dec 27, 2016
1c94a70
Drop support ruby 2.0 and 2.1
sue445 Nov 20, 2016
6574873
Refacator with table syntax
sue445 Dec 25, 2016
c584762
Merge pull request #122 from sue445/feature/drop_ruby_2_2
sue445 Dec 27, 2016
0cff9b9
Update changelog
sue445 Dec 27, 2016
8f65d65
Bump up to 1.0.0.pre1
sue445 Dec 27, 2016
f5708a2
Rename: human name of cure princess
sue445 Jan 10, 2017
36d0260
Merge pull request #133 from sue445/feature/shinayuki_hime
sue445 Jan 10, 2017
e9aa699
Update changelog [ci skip]
sue445 Jan 10, 2017
c1cc4f6
Add human_full_name to hime and towa-sama
sue445 Jan 10, 2017
090fbee
Impl Girl#full_name
sue445 Jan 10, 2017
1d776b4
cosmetic change
sue445 Jan 10, 2017
d51e742
Add human_full_name to example
sue445 Jan 10, 2017
7301fb7
[ci skip] Tweak doc
sue445 Jan 10, 2017
f560e96
Merge pull request #135 from sue445/feature/full_name
sue445 Jan 10, 2017
0148bf0
Update changelog
sue445 Jan 10, 2017
5310c39
Bump version
sue445 Jan 10, 2017
ff0286f
Refactor: extract to #all_girls
sue445 Jan 16, 2017
7d743eb
Rename: @all_stars -> @all_girls
sue445 Jan 16, 2017
8f57f47
all_girls returns Cure echo
sue445 Jan 16, 2017
26d49a7
Wrire doc
sue445 Jan 16, 2017
e88f630
Merge pull request #138 from sue445/feature/all_girls
sue445 Jan 16, 2017
b1bea20
Update changelog
sue445 Jan 16, 2017
d6140c1
Bump version
sue445 Jan 16, 2017
fb56497
Merge remote-tracking branch 'origin/master' into develop-1.0.0
sue445 Jan 26, 2017
510014d
Merge remote-tracking branch 'origin/master' into develop-1.0.0
sue445 Jan 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: ruby
rvm:
- 2.0
- 2.1
- 2.2
- 2.2.2
- 2.3.3
- 2.4.0
- ruby-head
Expand All @@ -21,6 +19,7 @@ script:
branches:
only:
- master
- develop-1.0.0
notifications:
email: false
slack:
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
## master
[full changelog](http://github.com/sue445/rubicure/compare/v0.4.13...master)

## v1.0.0

### Breaking changes :bomb:
* Remove `Girl#humanize`
* https://github.com/sue445/rubicure/pull/124
* Drop support ruby 2.0 and 2.1
* https://github.com/sue445/rubicure/pull/122
* Rename: human name of cure princess
* https://github.com/sue445/rubicure/pull/133
* `Precure.all_stars` returns only from "Futari wa Pretty Cure" to "Maho Girls PreCure"
* https://github.com/sue445/rubicure/pull/138
* https://github.com/sue445/rubicure/issues/136
* i.e. "Kirakira Precure Alamode" is not included
* If necessary, please rewrite as follows.
* `Precure.all_stars` -> `Precure.all_girls`

### Enhancements
* Impl `Girl#full_name`
* https://github.com/sue445/rubicure/pull/135
* Impl `Precure.all_girls` (a.k.a. `Precure.all`)
* https://github.com/sue445/rubicure/pull/138
* https://github.com/sue445/rubicure/issues/136

### Others
* Exclude examples/ from gem file
* https://github.com/sue445/rubicure/pull/140

Expand Down
16 changes: 0 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ source "https://rubygems.org"
# Specify your gem's dependencies in rubicure.gemspec
gemspec

if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.1.0")
# NOTE: build is failed when use ruby 2.0 and rspec-parameterized 0.3.0+
# https://travis-ci.org/sue445/rubicure/jobs/114266855
gem "rspec-parameterized", "< 0.3.0", group: :test
end

if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.1.0")
# NOTE: unparser v0.2.5 drop support ruby < 2.1
gem "unparser", "< 0.2.5", group: :test
end

if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
# NOTE: activesupport 5.x supports only ruby 2.2.2+
gem "activesupport", ">= 4.0.0", "< 5.0.0"
end

if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
gem "backport_dig"
end
51 changes: 46 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Inspired by [Acme::PrettyCure](http://perl-users.jp/articles/advent-calendar/201

## Requirements

* ruby >= 2.0.0
* ruby >= 2.2.2
* more: [.travis.yml](.travis.yml)

## Installation
Expand All @@ -32,7 +32,7 @@ Add this line to your application's Gemfile:
```ruby
gem 'rubicure'

# for ruby 2.0, 2.1, 2.2
# for ruby 2.2
gem 'backport_dig'
```

Expand Down Expand Up @@ -390,13 +390,38 @@ mirai.attack!
プリキュア!ルビーパッショナーレ!
```

### full_name
When `Rubicure::Girl` has `human_full_name` (i.e. another `human_name`), she returns as `#full_name`

```ruby
Cure.princess.human_name
# => "白雪ひめ"
Cure.princess.full_name
# => "ヒメルダ・ウインドウ・キュアクイーン・オブ・ザ・ブルースカイ"

Cure.scarlet.human_name
# => "紅城トワ"
Cure.scarlet.full_name
# => "プリンセス・ホープ・ディライト・トワ"
```

`#full_name` returns `#human_name` when she doe's not have `human_full_name`

```ruby
Cure.miracle.human_name
# => "朝日奈みらい"
Cure.miracle.full_name
# => "朝日奈みらい"
```

### Precure allstars
```ruby
Precure.all_stars.count
#=> 36

Precure.all_stars.map(&:precure_name)
#=> ["キュアブラック", "キュアホワイト", "シャイニールミナス", "キュアブルーム", "キュアイーグレット", "キュアドリーム", "キュアルージュ", "キュアレモネード", "キュアミント", "キュアアクア", "ミルキィローズ", "キュアピーチ", "キュアベリー", "キュアパイン", "キュアパッション", "キュアブロッサム", "キュアマリン", "キュアサンシャイン", "キュアムーンライト", "キュアメロディ", "キュアリズム", "キュアビート", "キュアミューズ", "キュアハッピー", "キュアサニー", "キュアピース", "キュアマーチ", "キュアビューティ", "キュアハート", "キュアダイヤモンド", "キュアロゼッタ", "キュアソード", "キュアエース", "キュアラブリー", "キュアプリンセス", "キュアハニー"]
# returns current precure count and names

Precure.all_stars.include?(Cure.echo)
#=> false

Precure.all_stars("2013-10-26").count
#=> 33
Expand Down Expand Up @@ -434,6 +459,22 @@ Precure.all_stars(:sing_together_miracle_magic).include?(Cure.echo)

and [more aliases!](config/movies.yml)

### `Precure.all_girls` (a.k.a. `Precure.all`)
```ruby
Precure.all_girls.count
Precure.all_girls.map(&:precure_name)
# returns current precure count and names

Precure.all_girls("2013-10-26").count
#=> 33

Precure.all_girls.include?(Cure.echo)
#=> true
```

#### `Precure.all_girls` vs `Precure.all_stars`
* `Precure.all_girls` returns all precure. (includes "Kirakira Precure Alamode")
* `Precure.all_stars` returns only from "Futari wa Pretty Cure" to "Maho Girls PreCure"

### Equivalence
```ruby
Expand Down
13 changes: 7 additions & 6 deletions config/girls/011_happiness_charge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ cure_lovely: &cure_lovely
transform_calls:
- kururin_mirror_change
cure_princess: &cure_princess
girl_name: cure_princess
human_name: 白雪ひめ(ヒメルダ・ウインドウ・キュアクイーン・オブ・ザ・ブルースカイ)
precure_name: キュアプリンセス
cast_name: 潘めぐみ
created_date: 2014-02-02 # episode 1
color: blue
girl_name: cure_princess
human_name: 白雪ひめ
human_full_name: ヒメルダ・ウインドウ・キュアクイーン・オブ・ザ・ブルースカイ
precure_name: キュアプリンセス
cast_name: 潘めぐみ
created_date: 2014-02-02 # episode 1
color: blue
transform_message: |-
(かわルンルン!)
プリキュアくるりんミラーチェンジ!
Expand Down
15 changes: 8 additions & 7 deletions config/girls/012_go_princess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ cure_twinkle: &cure_twinkle
transform_calls:
- princess_engage
cure_scarlet: &cure_scarlet
girl_name: cure_scarlet
human_name: 紅城トワ
precure_name: キュアスカーレット
cast_name: 沢城みゆき
color: red
created_date: 2015-07-05 # episode 22
birthday: 12/15
girl_name: cure_scarlet
human_name: 紅城トワ
human_full_name: プリンセス・ホープ・ディライト・トワ
precure_name: キュアスカーレット
cast_name: 沢城みゆき
color: red
created_date: 2015-07-05 # episode 22
birthday: 12/15
transform_message: |-
プリキュア!プリンセスエンゲージ!
深紅の炎のプリンセス!キュアスカーレット!
Expand Down
2 changes: 1 addition & 1 deletion config/girls/movie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cure_echo: &cure_echo
human_name: 坂上あゆみ
precure_name: キュアエコー
cast_name: 能登麻美子
created_date:
created_date: 2012-03-17
color: white
transform_message: |-
みんなの思いを守るために
Expand Down
13 changes: 7 additions & 6 deletions examples/all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
series.girls.each do |girl|
puts <<EOS
------------------------
human_name: #{girl.human_name}
precure_name: #{girl.precure_name}
cast_name: #{girl.cast_name}
color: #{girl.color}
extra_names: #{girl[:extra_names]}
state_names: #{girl.state_names}
human_name: #{girl.human_name}
human_full_name: #{girl.human_full_name}
precure_name: #{girl.precure_name}
cast_name: #{girl.cast_name}
color: #{girl.color}
extra_names: #{girl[:extra_names]}
state_names: #{girl.state_names}
attack_messages: #{girl.attack_messages}
transform_message:
#{girl.transform_message}
Expand Down
31 changes: 20 additions & 11 deletions lib/rubicure/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ def now
# @param [Time,Date,String,Symbol] arg Time, Date or date like String (ex. "2013-12-16")
# @return [Array<Rubicure::Girl>]
def all_stars(arg = Time.current)
unless @all_stars
@all_stars = []
Rubicure::Girl.names.each do |girl_name|
@all_stars << Rubicure::Girl.find(girl_name)
end

@all_stars.uniq!(&:human_name)
end

extra_girls = []

# args is Time or Date
Expand All @@ -58,10 +49,28 @@ def all_stars(arg = Time.current)
end
end

girls = @all_stars.select { |girl| girl.created_date && girl.created_date <= date }
girls + extra_girls
all_girls(date) - [Cure.echo] + extra_girls
end

# @param [Time,Date] arg Time, Date or date like String (ex. "2013-12-16")
# @return [Array<Rubicure::Girl>]
def all_girls(arg = Time.current)
date = to_date(arg)

unless @all_girls
@all_girls = []
Rubicure::Girl.names.each do |girl_name|
@all_girls << Rubicure::Girl.find(girl_name)
end

@all_girls.uniq!(&:human_name)
end

@all_girls.select { |girl| girl.created_date && girl.created_date <= date }
end

alias_method :all, :all_girls

# iterate with :unmarked, :max_heart, ...
#
# @yield series
Expand Down
7 changes: 5 additions & 2 deletions lib/rubicure/girl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Girl < Hash
ATTRIBUTES = [
:girl_name,
:human_name,
:human_full_name,
:precure_name,
:cast_name,
:color,
Expand Down Expand Up @@ -62,8 +63,6 @@ def humanize!
@current_transform_style = nil
self
end
alias_method :humanize, :humanize!
deprecate humanize: "Use #humanize! instead of #humanize"

def attack!
raise RequireTransformError, "require transform" if current_attack_message.blank?
Expand All @@ -89,6 +88,10 @@ def have_birthday? # rubocop:disable Style/PredicateName
end
alias_method :has_birthday?, :have_birthday?

def full_name
human_full_name.presence || human_name
end

ATTRIBUTES.each do |attribute|
define_method attribute do
if @current_transform_style
Expand Down
2 changes: 1 addition & 1 deletion lib/rubicure/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Rubicure
VERSION = "0.4.13"
VERSION = "1.0.0.pre3"
end
4 changes: 2 additions & 2 deletions rubicure.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/sue445/rubicure"
spec.license = "MIT"

spec.required_ruby_version = ">= 2.0.0"
spec.required_ruby_version = ">= 2.2.2"

spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)

Expand All @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "activesupport", ">= 4.0.0"
spec.add_dependency "activesupport", ">= 5.0.0"
spec.add_dependency "hashie", ">= 2.0.5"
spec.add_dependency "sengiri_yaml", ">= 0.0.2"

Expand Down
Loading