kindler 0.3.4 → 0.3.5

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: cb1f5a09d4429c9c40b39178811f551f0c082a1d
4
- data.tar.gz: 93a6b8dc81f33a5c7380bfa51cf152fbbe341862
3
+ metadata.gz: 60d6fee5962ce242f6969ee0a723b6650a259980
4
+ data.tar.gz: d5e707ccd5da62e2a66d9d462390c7065c7c95fa
5
5
  SHA512:
6
- metadata.gz: d9f5a5f5fbb8bd60408df9f1ba7bda7f11c0280de858a0d36025198a3f04b9eea36a0705b75f5418c8aef85e13be39f52f74cc79addc553bd0899b4149c82538
7
- data.tar.gz: f708e4372bb77900edaf1f490744854ba1d2b9eda2475e37137d390d0b6a1214c9af39233c14cfb423a517bcde616ae0ad3f5e68ff1ab8d1bd0b9cb28c2520cd
6
+ metadata.gz: 4cdb75e81352a4bd899a14512b34253fd1a7a5980a34da8e82492fa718d671303209617c9d9ab29051117cd5a22a60e34cf0e9d08baa78aa79608ff79fb9aa7e
7
+ data.tar.gz: 5eddadea6a9b5da4a6efa45c5c4bfdea2b02a4b5f2d8bc8000f259ec86fc8f62199cd93fedff671a761000e65093554e64c303d72b58f3254eca82cf88429a56
data/Readme.md CHANGED
@@ -14,7 +14,8 @@ BTW, we share the same internal way to generating mobi book by [KindleGen 2](htt
14
14
 
15
15
  ## Prerequisite
16
16
  ### 1.kindlegen execute file from amazon
17
- ### 2.that's all
17
+ ### 2.imagemagick exist
18
+ ### 3.that's all
18
19
 
19
20
  ## Installation
20
21
  ```ruby
data/conver.gif ADDED
Binary file
@@ -1,3 +1,3 @@
1
1
  module Kindler
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
data/lib/kindler.rb CHANGED
@@ -203,8 +203,15 @@ module Kindler
203
203
  File.expand_path (@output_dir == '' ? "#{TMP_DIR_PREFIX}#{title}" : @output_dir)
204
204
  end
205
205
 
206
+ # 1. using imagemagick to crop a image to 600*800
207
+ # 2. set the image url to something
206
208
  def prepare_conver_img
207
- @cover_image = File.basename(@local_images.first) rescue ''
209
+ if @local_images.length > 0
210
+ image_file = @local_images.first
211
+ @cover_image = "#{File.dirname(image_file)}/cover-image.gif"
212
+ cmd = "convert #{image_file} -compose over -background white -flatten -resize '300x200>' -alpha off #{@cover_image}"
213
+ `#{cmd}` rescue ''
214
+ end
208
215
  end
209
216
 
210
217
  # create dirs of generated files
@@ -22,7 +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
+ <item href="cover-image.gif" id="cover-image" media-type="image/gif" />
26
26
  <item href='contents.html' media-type='application/xhtml+xml' id='contents'/>
27
27
  <item href='nav-contents.ncx' media-type='application/x-dtbncx+xml' id='nav-contents'/>
28
28
  </manifest>
@@ -58,7 +58,7 @@ describe "Mobi book file generator" do
58
58
  book = Kindler::Book.new :title=>title,:author=>'mike',:debug=>true
59
59
  book.add_page :title=>'page1',:author=>'mike1',:content=>'this is the page 1',:wrap=>true
60
60
  book.add_page :title=>'page2',:author=>'mike1',:content=>'this is the page 2',:wrap=>true
61
- book.add_page :title=>'page3',:author=>'mike1',:content=>'<img src="http://media2.glamour-sales.com.cn/media/catalog/category/Stroili_banner_02.jpg"/>this is the page 3',:wrap=>true
61
+ book.add_page :title=>'page3',:author=>'mike1',:content=>'<img src="http://images.fanpop.com/images/image_uploads/widescreen-season-4-wallpaper-lost-661159_1680_1050.jpg"/>this is the page 3',:wrap=>true
62
62
  book.generate
63
63
  book.should be_generated
64
64
  File.should be_exist("./#{Kindler::Book::TMP_DIR_PREFIX}#{title}/1.jpg")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongbin.li
@@ -36,6 +36,7 @@ files:
36
36
  - Guardfile
37
37
  - Rakefile
38
38
  - Readme.md
39
+ - conver.gif
39
40
  - features/basic.feature
40
41
  - features/dsl.feature
41
42
  - features/step_definitions/basic_step.rb