james-ruminant 0.9.3 → 0.9.5
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/README +3 -3
- data/lib/design.rb +27 -14
- data/spec/design_spec.rb +46 -0
- data/spec/product_spec.rb +14 -0
- metadata +4 -4
data/README
CHANGED
|
@@ -12,11 +12,10 @@ gem sources -a http://gems.github.com
|
|
|
12
12
|
Then you can install this like any other gem:
|
|
13
13
|
gem install james-ruminant
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
Usage
|
|
17
16
|
-----
|
|
18
17
|
|
|
19
|
-
All parameters are done in an ActiveRecord attributes style, i.e. they can be passed into new() as a hash, and are all attr-accessors
|
|
18
|
+
All parameters are done in an ActiveRecord attributes style, i.e. they can be passed into new() as a hash, and are all attr-accessors. Note that product objects do not have attributes that are not impossible for that product, and that a Sticker will raise an error if you try to give it text.
|
|
20
19
|
|
|
21
20
|
Making an order:
|
|
22
21
|
require 'rubygems'
|
|
@@ -48,7 +47,7 @@ end
|
|
|
48
47
|
Current Limitations
|
|
49
48
|
-------------------
|
|
50
49
|
|
|
51
|
-
Currently I only support MiniCards, but have made it incredibly easy to add the other supported products.
|
|
50
|
+
Currently I only support MiniCards and Stickers, but have made it incredibly easy to add the other supported products.
|
|
52
51
|
I haven't yet, as I do not have a personal need, so don't feel I can test it. If you have such a need, do let me know, as we can add it.
|
|
53
52
|
|
|
54
53
|
Manual Cropping is not currently supported for the same reason.
|
|
@@ -60,6 +59,7 @@ Contributors thus far
|
|
|
60
59
|
Xenia Kingsley - Naming powers
|
|
61
60
|
Chris Mear - Fixing stuff, and provides the wine
|
|
62
61
|
Dan Webb - Wisdom
|
|
62
|
+
Tom Armitage - adding Moo::Sticker
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
(__)
|
data/lib/design.rb
CHANGED
|
@@ -45,21 +45,22 @@ module Moo
|
|
|
45
45
|
xml.auto true
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
if !product_type.eql?("sticker")
|
|
49
|
+
xml.text_collection {
|
|
50
|
+
xml.tag! product_type {
|
|
51
|
+
lines.each_with_index do |line, index|
|
|
52
|
+
xml.text_line {
|
|
53
|
+
xml.id index+1
|
|
54
|
+
xml.string line.string
|
|
55
|
+
xml.bold line.bold
|
|
56
|
+
xml.align line.align
|
|
57
|
+
xml.font line.font
|
|
58
|
+
xml.colour line.colour
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
}
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
end
|
|
63
64
|
}
|
|
64
65
|
end
|
|
65
66
|
|
|
@@ -79,6 +80,18 @@ module Moo
|
|
|
79
80
|
end
|
|
80
81
|
end
|
|
81
82
|
|
|
83
|
+
class Sticker < Design
|
|
84
|
+
|
|
85
|
+
disable_attributes [:font, :font_size, :colour, :align, :bold, :string, :italic]
|
|
86
|
+
|
|
87
|
+
def product_type
|
|
88
|
+
"sticker"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
undef :text=
|
|
92
|
+
undef :line
|
|
93
|
+
end
|
|
94
|
+
|
|
82
95
|
class DisabledAttributeError < StandardError
|
|
83
96
|
end
|
|
84
97
|
end
|
data/spec/design_spec.rb
CHANGED
|
@@ -16,4 +16,50 @@ describe "a minicard" do
|
|
|
16
16
|
it "should not support italic" do
|
|
17
17
|
lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
|
|
18
18
|
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "a sticker" do
|
|
22
|
+
before(:each) do
|
|
23
|
+
@design = Moo::Sticker.new(:url => "")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should have sticker as the type" do
|
|
27
|
+
@design.product_type.should == "sticker"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should not support font size" do
|
|
31
|
+
lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should not support italic" do
|
|
35
|
+
lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should not support string" do
|
|
39
|
+
lambda{@design.string = "foo"}.should raise_error(Moo::DisabledAttributeError)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should not support bold" do
|
|
43
|
+
lambda{@design.bold = true}.should raise_error(Moo::DisabledAttributeError)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should not support align" do
|
|
47
|
+
lambda{@design.align = "centre"}.should raise_error(Moo::DisabledAttributeError)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should not support font" do
|
|
51
|
+
lambda{@design.font = "Normal"}.should raise_error(Moo::DisabledAttributeError)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "should not support colour" do
|
|
55
|
+
lambda{@design.colour = "#ccc"}.should raise_error(Moo::DisabledAttributeError)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should not support any text" do
|
|
59
|
+
lambda{@design.text = "testing!"}.should raise_error(NoMethodError)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should not support lines" do
|
|
63
|
+
lambda{@design.line(1)}.should raise_error(NoMethodError)
|
|
64
|
+
end
|
|
19
65
|
end
|
data/spec/product_spec.rb
CHANGED
|
@@ -26,4 +26,18 @@ describe "The Design base class" do
|
|
|
26
26
|
@design.line(1).bold.should == true
|
|
27
27
|
@design.line(2).bold.should == true
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
it "should have a text_collection element when converted to xml" do
|
|
31
|
+
@design.to_xml.should include("<text_collection>")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe "The Sticker subclass" do
|
|
36
|
+
before(:each) do
|
|
37
|
+
@design = Moo::Sticker.new(:url => "http://farm3.static.flickr.com/2300/2179038972_23d2a1ff40_o.jpg")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should not have a text_collection element when converted to xml" do
|
|
41
|
+
@design.to_xml.should_not include("<text_collection>")
|
|
42
|
+
end
|
|
29
43
|
end
|
metadata
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: james-ruminant
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Darling
|
|
8
|
+
- Tom Armitage
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain:
|
|
@@ -30,7 +31,7 @@ dependencies:
|
|
|
30
31
|
version: "0"
|
|
31
32
|
version:
|
|
32
33
|
description: A ruby library to regurgitate MOO products
|
|
33
|
-
email: james@abscond.org
|
|
34
|
+
email: james@abscond.org tom@infovore.org
|
|
34
35
|
executables: []
|
|
35
36
|
|
|
36
37
|
extensions: []
|
|
@@ -45,7 +46,7 @@ files:
|
|
|
45
46
|
- lib/core_ext/options_struct.rb
|
|
46
47
|
- README
|
|
47
48
|
has_rdoc: false
|
|
48
|
-
homepage: http://github.com/
|
|
49
|
+
homepage: http://github.com/infovore/ruminant/tree/master
|
|
49
50
|
post_install_message:
|
|
50
51
|
rdoc_options: []
|
|
51
52
|
|
|
@@ -71,7 +72,6 @@ signing_key:
|
|
|
71
72
|
specification_version: 2
|
|
72
73
|
summary: A ruby library to regurgitate MOO products
|
|
73
74
|
test_files:
|
|
74
|
-
- spec/all.rb
|
|
75
75
|
- spec/design_spec.rb
|
|
76
76
|
- spec/moo_spec.rb
|
|
77
77
|
- spec/product_spec.rb
|