kindlerb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +8 -6
  2. data/lib/kindlerb.rb +4 -9
  3. metadata +5 -5
data/README.markdown CHANGED
@@ -48,14 +48,15 @@ the *.html files .
48
48
  The _document.yml is a YAML document. It should look like something like this:
49
49
 
50
50
  ---
51
- doc_uuid: kindlefeeder.21395-2011-12-19
52
- title: kindlefeeder
53
- author: kindlefeeder
54
- publisher: kindlefeeder.com
51
+ doc_uuid: kindlerb.21395-2011-12-19
52
+ title: my-ebook
53
+ author: my-ebook
54
+ publisher: me
55
55
  subject: News
56
56
  date: "2011-12-19"
57
57
  masthead: /home/choi/Desktop/masthead.gif
58
58
  cover: /home/choi/Desktop/cover.gif
59
+ mobi_outfile: my-ebook.mobi
59
60
 
60
61
  kindlerb uses the the file tree and _document.yml to construct these additional
61
62
  resource required by Amazon's `kindlegen` program:
@@ -64,8 +65,9 @@ resource required by Amazon's `kindlegen` program:
64
65
  * contents.html
65
66
  * kindlerb.opf
66
67
 
67
- After that, kindlerb will exec the `kindlegen` program to generate your mobi document.
68
- The document will be named after `title` in your _document.yml.
68
+ After that, kindlerb will exec the kindlegen program to generate your mobi
69
+ document. The filename the output document is specified by the 'mobi_outfile'
70
+ value in _document.yml.
69
71
 
70
72
  ## Images
71
73
 
data/lib/kindlerb.rb CHANGED
@@ -19,7 +19,7 @@ end
19
19
 
20
20
 
21
21
  module Kindlerb
22
- VERSION = '0.0.1'
22
+ VERSION = '0.0.2'
23
23
 
24
24
  def self.run
25
25
 
@@ -32,9 +32,6 @@ module Kindlerb
32
32
  masthead_gif = File.join(File.dirname(__FILE__), '..', "templates/masthead.gif")
33
33
  cover_gif = File.join(File.dirname(__FILE__), '..', "templates/cover-image.gif")
34
34
 
35
- `cp #{masthead_gif} #{target_dir}/masthead.gif`
36
- `cp #{cover_gif} #{target_dir}/cover-image.gif`
37
-
38
35
  Dir.chdir target_dir do
39
36
  playorder = 1
40
37
 
@@ -108,10 +105,8 @@ module Kindlerb
108
105
 
109
106
  }
110
107
 
111
- document['masthead'] ||= "masthead.gif"
112
- document['cover'] ||= "cover.gif"
113
108
  document[:first_article] = sections[0][:articles][0]
114
- document[:sections] = sections
109
+ document['sections'] = sections
115
110
 
116
111
 
117
112
  document[:manifest_items] = manifest_items + images.map.with_index {|img, idx|
@@ -136,8 +131,8 @@ module Kindlerb
136
131
  File.open("contents.html", "w") {|f| f.puts contents}
137
132
  puts "Wrote #{target_dir}/contents.html"
138
133
 
139
- outfile = "%s.mobi" % document['title'].gsub(/\W/, '_')
140
-
134
+ outfile = document['mobi_outfile']
135
+ puts "Writing #{outfile}"
141
136
  exec "kindlegen -verbose -c2 -o #{outfile} kindlerb.opf && echo 'Wrote MOBI to #{outfile}'"
142
137
  end
143
138
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindlerb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &16020420 !ruby/object:Gem::Requirement
16
+ requirement: &6068640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16020420
24
+ version_requirements: *6068640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mustache
27
- requirement: &16019460 !ruby/object:Gem::Requirement
27
+ requirement: &6066260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16019460
35
+ version_requirements: *6066260
36
36
  description: Kindle eperiodical generator
37
37
  email:
38
38
  - dhchoi@gmail.com