eeepub 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "eeepub"
5
- s.version = "0.8.0"
5
+ s.version = "0.8.1"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["jugyo"]
8
8
  s.email = ["jugyo.org@gmail.com"]
@@ -73,7 +73,7 @@ module EeePub
73
73
  # @return [String] the media-type
74
74
  def guess_media_type(filename)
75
75
  case filename
76
- when /.*\.html?$/i
76
+ when /.*\.x?html?$/i
77
77
  'application/xhtml+xml'
78
78
  when /.*\.css$/i
79
79
  'text/css'
@@ -53,6 +53,7 @@ module EeePub
53
53
  :uid,
54
54
  :files,
55
55
  :nav,
56
+ :cover,
56
57
  :ncx_file,
57
58
  :opf_file
58
59
  ].each do |name|
@@ -130,6 +131,7 @@ module EeePub
130
131
  :subject => @subjects,
131
132
  :description => @descriptions,
132
133
  :rights => @rightss,
134
+ :cover => @cover,
133
135
  :relation => @relations,
134
136
  :manifest => @files.map{|file|
135
137
  case file
@@ -14,6 +14,7 @@ module EeePub
14
14
  :manifest,
15
15
  :spine,
16
16
  :guide,
17
+ :cover,
17
18
  :ncx,
18
19
  :toc
19
20
 
@@ -83,6 +84,7 @@ module EeePub
83
84
  end
84
85
  end
85
86
  end
87
+ builder.meta(:name => 'cover', :content => self.cover) if self.cover
86
88
  end
87
89
  end
88
90
 
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "EeePub::ContainerItem" do
4
+
5
+ context 'guess media type' do
6
+
7
+ before :each do
8
+ @container_item = EeePub::ContainerItem.new []
9
+ end
10
+
11
+ it 'should be application/xhtml+xml' do
12
+ media_type = 'application/xhtml+xml'
13
+ ['test.htm', 'test.html', 'test.xhtm', 'test.xhtml'].each do |file_name|
14
+ @container_item.send(:guess_media_type, file_name).should == media_type
15
+ end
16
+ @container_item.send(:guess_media_type, "test.xml").should_not == media_type
17
+ end
18
+ end
19
+
20
+ end
@@ -16,6 +16,7 @@ describe "EeePub::Maker" do
16
16
  uid 'http://example.com/book/foo'
17
17
  ncx_file 'toc.ncx'
18
18
  opf_file 'content.opf'
19
+ cover 'cover.jpg'
19
20
  files ['foo.html', 'bar.html']
20
21
  nav [
21
22
  {:label => '1. foo', :content => 'foo.html'},
@@ -32,6 +33,7 @@ describe "EeePub::Maker" do
32
33
  it { @maker.instance_variable_get(:@uid).should == 'http://example.com/book/foo' }
33
34
  it { @maker.instance_variable_get(:@ncx_file).should == 'toc.ncx' }
34
35
  it { @maker.instance_variable_get(:@opf_file).should == 'content.opf' }
36
+ it { @maker.instance_variable_get(:@cover).should == 'cover.jpg' }
35
37
  it { @maker.instance_variable_get(:@files).should == ['foo.html', 'bar.html'] }
36
38
  it {
37
39
  @maker.instance_variable_get(:@nav).should == [
@@ -61,6 +63,7 @@ describe "EeePub::Maker" do
61
63
  :rights => ['xxx'],
62
64
  :relation => ['xxx'],
63
65
  :ncx => "toc.ncx",
66
+ :cover => 'cover.jpg',
64
67
  :publisher => ["jugyo.org"],
65
68
  :unique_identifier=>"http://example.com/book/foo",
66
69
  :identifier => [{:value => "http://example.com/book/foo", :scheme => "URL", :id => "http://example.com/book/foo"}],
@@ -90,6 +93,7 @@ describe "EeePub::Maker" do
90
93
  uid 'http://example.com/book/foo'
91
94
  ncx_file 'toc.ncx'
92
95
  opf_file 'content.opf'
96
+ cover 'cover.jpg'
93
97
  files [{'foo.html' => 'foo/bar'}, {'bar.html' => 'foo/bar/baz'}]
94
98
  nav [
95
99
  {:label => '1. foo', :content => 'foo.html'},
@@ -113,6 +117,7 @@ describe "EeePub::Maker" do
113
117
  :rights => ['xxx'],
114
118
  :relation => ['xxx'],
115
119
  :ncx => "toc.ncx",
120
+ :cover => 'cover.jpg',
116
121
  :publisher => ["jugyo.org"],
117
122
  :unique_identifier=>"http://example.com/book/foo",
118
123
  :identifier => [{:value => "http://example.com/book/foo", :scheme => "URL", :id=>"http://example.com/book/foo"}],
@@ -118,7 +118,8 @@ describe "EeePub::OPF" do
118
118
  :relation => 'relation',
119
119
  :creator => 'creator',
120
120
  :publisher => 'publisher',
121
- :rights => 'rights'
121
+ :rights => 'rights',
122
+ :cover => 'cover.jpg'
122
123
  )
123
124
  end
124
125
 
@@ -144,6 +145,10 @@ describe "EeePub::OPF" do
144
145
  identifier.attribute('id').value.should == @opf.unique_identifier
145
146
  identifier.attribute('scheme').value.should == @opf.identifier[0][:scheme]
146
147
  identifier.inner_text.should == @opf.identifier[0][:value]
148
+
149
+ identifier = metadata.at('meta')
150
+ identifier.attribute('name').value.should == 'cover'
151
+ identifier.attribute('content').value.should == 'cover.jpg'
147
152
  end
148
153
  end
149
154
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eeepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-19 00:00:00.000000000Z
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &10621420 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10621420
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rubyzip
27
- requirement: &10620300 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *10620300
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &10619520 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *10619520
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: nokogiri
49
- requirement: &10618100 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *10618100
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rr
60
- requirement: &10617360 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *10617360
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: simplecov
71
- requirement: &10616540 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *10616540
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  description: EeePub is a Ruby ePub generator.
81
111
  email:
82
112
  - jugyo.org@gmail.com
@@ -100,6 +130,7 @@ files:
100
130
  - lib/eeepub/ncx.rb
101
131
  - lib/eeepub/ocf.rb
102
132
  - lib/eeepub/opf.rb
133
+ - spec/eeepub/container_item_spec.rb
103
134
  - spec/eeepub/easy_spec.rb
104
135
  - spec/eeepub/maker_spec.rb
105
136
  - spec/eeepub/ncx_spec.rb
@@ -127,8 +158,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
158
  version: '0'
128
159
  requirements: []
129
160
  rubyforge_project:
130
- rubygems_version: 1.8.10
161
+ rubygems_version: 1.8.24
131
162
  signing_key:
132
163
  specification_version: 3
133
164
  summary: ePub generator
134
- test_files: []
165
+ test_files:
166
+ - spec/eeepub/container_item_spec.rb
167
+ - spec/eeepub/easy_spec.rb
168
+ - spec/eeepub/maker_spec.rb
169
+ - spec/eeepub/ncx_spec.rb
170
+ - spec/eeepub/ocf_spec.rb
171
+ - spec/eeepub/opf_spec.rb
172
+ - spec/eeepub_spec.rb
173
+ - spec/spec_helper.rb
174
+ has_rdoc: