kindler 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12904bca50bbcfbfeeb932d93463a5e99b8267e2
4
- data.tar.gz: 1df9a19a14e13dae97c16efa94ea6b9ccf3a7603
3
+ metadata.gz: 4cbe607a78915ed4694db86aebec44e4df52ed67
4
+ data.tar.gz: 24225c4c41a29ab3589b7253727913a748d9413e
5
5
  SHA512:
6
- metadata.gz: d417b850fb222ab4f3f2cdf935d514526f8e98a32cae7fa9b2f4910f6f45688c2b242c8438f9134ed0529d582e87578e752f13e35bb1f2aaf7a1997a3d7dfa9e
7
- data.tar.gz: 8da66566b337ae6fa172c45fecf8f2711d615ca27c5d71d0822df9e563bcb2864a3d75f2f955da11ad49a610f5917989a2aaa3d58646a40d1c4b18db4b859296
6
+ metadata.gz: b77b704a3cfd0ebb3167dcd1b461a79597ef5992b031937318c0e57b9d41fcabf15adc849b0bc631294d2a1e14dd626e9463c3827fb02d52235a8819e482e670
7
+ data.tar.gz: c71af00a5c240d48703bef1dec20cc2a485ca7466f13540e3bf6e92a1d1bab3896305782ab1e14e67ea23ce4c3848a268ca6177ea5e8640c993f62316f949e4c
@@ -1,3 +1,3 @@
1
1
  module Kindler
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/kindler.rb CHANGED
@@ -14,7 +14,7 @@ module Kindler
14
14
  class Book
15
15
  class KindlerError < StandardError;end
16
16
 
17
- attr_accessor :title,:author,:pages,:pages_by_section,:local_images,:mobi_type,:style
17
+ attr_accessor :title,:author,:pages,:pages_by_section,:local_images,:mobi_type,:style,:cover_image
18
18
 
19
19
  TMP_DIR_PREFIX = '__km_'
20
20
  DEFAULT_SECTION = "All Pages"
@@ -65,6 +65,7 @@ module Kindler
65
65
  def generate
66
66
  make_generated_dirs
67
67
  localize_images if @keep_image
68
+ prepare_conver_img
68
69
  # reorder count index
69
70
  if magzine?
70
71
  sectionize_pages
@@ -73,7 +74,6 @@ module Kindler
73
74
  generate_opf
74
75
  generate_ncx
75
76
  write_to_disk
76
- prepare_conver_img
77
77
  kindlegen
78
78
  end
79
79
 
@@ -204,13 +204,7 @@ module Kindler
204
204
  end
205
205
 
206
206
  def prepare_conver_img
207
- return unless @cover != ""
208
- if @cover.start_with?("http")
209
- # download conver to conver
210
- # TODO find out a elegant way to do this
211
- else
212
- `cp #{@cover} #{tmp_dir}/` if File.exist?(@cover)
213
- end
207
+ @cover_image = File.basename(@local_images.first) rescue ''
214
208
  end
215
209
 
216
210
  # create dirs of generated files
@@ -22,6 +22,7 @@
22
22
  <% pages.each_with_index do |page,index|%>
23
23
  <item href='<%= (index+1).to_s.rjust(3,'0') %>.html' media-type='application/xhtml+xml' id='<%= (index+1).to_s.rjust(3,'0') %>'/>
24
24
  <% end %>
25
+ <item href="<%= cover_image %>" id="cover-image" media-type="image/jpeg" />
25
26
  <item href='contents.html' media-type='application/xhtml+xml' id='contents'/>
26
27
  <item href='nav-contents.ncx' media-type='application/x-dtbncx+xml' id='nav-contents'/>
27
28
  </manifest>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongbin.li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-03 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri