amida 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/amida +8 -2
- data/lib/amida.rb +16 -0
- data/lib/amida/version.rb +1 -1
- data/spec/amida/amida_spec.rb +33 -0
- data/spec/amida_spec.rb +15 -27
- metadata +7 -5
data/bin/amida
CHANGED
@@ -2,12 +2,18 @@
|
|
2
2
|
require 'slop'
|
3
3
|
require File.expand_path('../../lib/amida', __FILE__)
|
4
4
|
|
5
|
-
opts = Slop.parse
|
5
|
+
opts = Slop.parse do
|
6
6
|
banner "amida [options]\n"
|
7
7
|
on :w, :width, 'Width of Amida. Default is 5', :argument => true
|
8
8
|
on :h, :height, 'Height of Amida Default is 10', :argument => true
|
9
|
+
on :namu, 'NAMEAMIDABUTSU'
|
10
|
+
on :help, 'Display this help message.', :tail => true do
|
11
|
+
$stderr.puts help
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
|
-
|
15
|
+
if opts.namu?
|
16
|
+
Amida.namu
|
17
|
+
elsif !opts.help?
|
12
18
|
Amida::Amida.new(:width => opts[:width] && opts[:width].to_i, :height => opts[:height] && opts[:height].to_i).render
|
13
19
|
end
|
data/lib/amida.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
%w{
|
2
3
|
version
|
3
4
|
label
|
@@ -24,4 +25,19 @@ module Amida
|
|
24
25
|
@prize.render
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
def namu
|
31
|
+
puts <<-AA
|
32
|
+
/ ̄ ̄ ̄\
|
33
|
+
| |
|
34
|
+
| | _
|
35
|
+
| ^ ^ ) ///ト、
|
36
|
+
( >ノ(_)Y ////)|
|
37
|
+
∧丶i-=ニ=|| ||
|
38
|
+
/\\\  ̄ノ| ノノ
|
39
|
+
/ \\  ̄ / / |
|
40
|
+
AA
|
41
|
+
end
|
42
|
+
end
|
27
43
|
end
|
data/lib/amida/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Amida::Amida do
|
4
|
+
context 'raise ArgumentError' do
|
5
|
+
context 'too small width' do
|
6
|
+
it { expect{ Amida::Amida.new(:width => 1, :height => 10) }.to raise_error ArgumentError }
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'too small height' do
|
10
|
+
it { expect{ Amida::Amida.new(:width => 5, :height => 0) }.to raise_error ArgumentError }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'width, height == 5, 10' do
|
15
|
+
describe '#render' do
|
16
|
+
let(:amida) { Amida::Amida.new }
|
17
|
+
|
18
|
+
after do
|
19
|
+
to_dev_null{ amida.render }
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'call @label.render' do
|
23
|
+
Amida::Label.any_instance.should_receive(:render)
|
24
|
+
end
|
25
|
+
it 'call @route.render' do
|
26
|
+
Amida::Route.any_instance.should_receive(:render)
|
27
|
+
end
|
28
|
+
it 'call @prize.render' do
|
29
|
+
Amida::Prize.any_instance.should_receive(:render)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/amida_spec.rb
CHANGED
@@ -1,33 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
|
-
describe Amida
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
let(:amida) { Amida::Amida.new }
|
17
|
-
|
18
|
-
after do
|
19
|
-
to_dev_null{ amida.render }
|
20
|
-
end
|
4
|
+
describe Amida do
|
5
|
+
describe 'Amida.namu' do
|
6
|
+
it do
|
7
|
+
aa = <<-AA
|
8
|
+
/ ̄ ̄ ̄\
|
9
|
+
| |
|
10
|
+
| | _
|
11
|
+
| ^ ^ ) ///ト、
|
12
|
+
( >ノ(_)Y ////)|
|
13
|
+
∧丶i-=ニ=|| ||
|
14
|
+
/\\\  ̄ノ| ノノ
|
15
|
+
/ \\  ̄ / / |
|
16
|
+
AA
|
21
17
|
|
22
|
-
|
23
|
-
Amida::Label.any_instance.should_receive(:render)
|
24
|
-
end
|
25
|
-
it 'call @route.render' do
|
26
|
-
Amida::Route.any_instance.should_receive(:render)
|
27
|
-
end
|
28
|
-
it 'call @prize.render' do
|
29
|
-
Amida::Prize.any_instance.should_receive(:render)
|
30
|
-
end
|
18
|
+
capture(:stdout){ Amida.namu }.should == aa
|
31
19
|
end
|
32
20
|
end
|
33
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amida
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70100343298260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70100343298260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70100343297440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70100343297440
|
36
36
|
description: Amida drawing
|
37
37
|
email:
|
38
38
|
- yuki@gnnk.net
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/amida/prize.rb
|
56
56
|
- lib/amida/route.rb
|
57
57
|
- lib/amida/version.rb
|
58
|
+
- spec/amida/amida_spec.rb
|
58
59
|
- spec/amida/label_spec.rb
|
59
60
|
- spec/amida/prize_spec.rb
|
60
61
|
- spec/amida/route_spec.rb
|
@@ -85,6 +86,7 @@ signing_key:
|
|
85
86
|
specification_version: 3
|
86
87
|
summary: Amida drawing
|
87
88
|
test_files:
|
89
|
+
- spec/amida/amida_spec.rb
|
88
90
|
- spec/amida/label_spec.rb
|
89
91
|
- spec/amida/prize_spec.rb
|
90
92
|
- spec/amida/route_spec.rb
|