kindler 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -13,8 +13,7 @@ group :development, :test do
13
13
  end
14
14
  end
15
15
 
16
- gem "ruby-readability",:git=>'https://github.com/iterationlabs/ruby-readability.git', :require => 'readability'
17
- gem 'mini_magick'
16
+ gem "nokogiri"
18
17
 
19
18
  # Specify your gem's dependencies in kindler.gemspec
20
19
  gemspec
data/Readme.md CHANGED
@@ -1,5 +1,6 @@
1
- ### Todo
2
- support magzine like format
1
+ ### Prerequisite
2
+ #### 1.kindlegen execute file from amazon
3
+ #### 2.that's all
3
4
 
4
5
 
5
6
  ### Installation
@@ -15,22 +16,21 @@ gem 'kindler',:git=>'git@github.com:29decibel/kindler.git'
15
16
  ### A kindle mobi book generator
16
17
  which receive a couple of urls then output one mobi file
17
18
 
18
- ### Command Line Use [Todo]
19
- kindler url1 url2 url3 url4 -t my_book
20
-
21
- outputs : my_book.mobi
22
-
23
- ### Api use
19
+ ### Usage
24
20
  ```ruby
25
- # generate my book
26
- book = Kindler::Book.new ({:urls=>["http://blog.farmostwood.net/643.html",
27
- "http://www.ifanr.com/69878","http://www.oneplus.info/archives/455"],
28
- :title=>'Test_book',:author=>'mike'})
29
- # you will get my_book.mobi file
30
- book.generate 'my_book'
21
+ title = 'my_first_mobi_book'
22
+ book = Kindler::Book.new :title=>title,:author=>'mike'
23
+ book.add_page :title=>'page1',:author=>'mike1',:content=>'this is the page 1',:wrap=>true,:section => 'love'
24
+ book.add_page :title=>'page2',:author=>'mike1',:content=>'this is the page 2',:wrap=>true,:section => 'hate'
25
+ book.add_page :title=>'page_with_image',:author=>'mike1',:content=>'<img src="http://media2.glamour-sales.com.cn/media/catalog/category/Stroili_banner_02.jpg"></img>this is the page 3',:wrap=>true,:section=>'hate'
26
+ # you will get my_first_mobi_book.mobi file
27
+ book.generate
28
+
29
+ #or you can just generate simple mobi book
30
+ book.mobi_type = :flat
31
+ book.generate
31
32
  ```
32
33
 
33
-
34
34
  Hope you love it !
35
35
 
36
36
 
data/kindler.gemspec CHANGED
@@ -4,13 +4,13 @@ require File.expand_path('../lib/kindler/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["dongbin.li"]
6
6
  gem.email = ["mike.d.1984@gmail.com"]
7
- gem.description = %q{kindler is a rubygem allow you to generate kindle mobi book from urls very easily}
8
- gem.summary = %q{kindler is a rubygem allow you to generate kindle mobi book from urls very easily}
7
+ gem.description = %q{kindler is a rubygem allow you to generate kindle mobi book very easily}
8
+ gem.summary = %q{kindler is a rubygem allow you to generate kindle mobi book very easily}
9
9
  gem.homepage = "https://github.com/29decibel/kindler"
10
10
 
11
11
  gem.rubyforge_project = "kindler"
12
- gem.add_dependency 'mini_magick'
13
- gem.add_dependency 'ruby-readability'
12
+
13
+ gem.add_dependency 'nokogiri'
14
14
 
15
15
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  gem.files = `git ls-files`.split("\n")
@@ -1,3 +1,3 @@
1
1
  module Kindler
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/kindler.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: utf-8
2
2
  require 'rubygems'
3
- require "readability"
4
3
  require "open-uri"
4
+ require "nokogiri"
5
5
  # require 'mini_magick'
6
6
  require_relative 'kindler/railtie' if defined?(Rails)
7
7
  require_relative "kindler/version"
@@ -9,52 +9,48 @@ require_relative "kindler/version"
9
9
  module Kindler
10
10
  class Book
11
11
  class KindlerError < StandardError;end
12
- attr_accessor :urls,:title,:author,:doc_infos
12
+ attr_accessor :title,:author,:pages,:local_images,:mobi_type
13
13
  TMP_DIR = 'kindler_generated_mobi'
14
+ DEFAULT_SECTION = "All Pages"
15
+ PAGE_ATTRIBUTES = %w(wrap title author content section)
14
16
 
15
17
  # availabel options
16
18
  # @param options [Hash]
17
- # @option urls [Array] urls to generate
18
19
  # @option title [String] book title
19
20
  # @option output_dir [String] directory want to generate
20
21
  # @option debug [Boolean] whether puts debug infos
21
22
  # @option keep_image [Boolean] whether keep images, default to true
22
23
  def initialize(options={})
23
- @urls = options[:urls] || {}
24
- @title = options[:title] || ''
25
24
  @output_dir = options[:output_dir] || './'
26
25
  @keep_image = options[:keep_image] || true
27
26
  @debug = options[:debug]
28
- raise KindlerError.new("urls option could not be empty") if @urls.empty?
27
+ @title = options[:title] || ''
29
28
  @author = options[:author] || ''
30
- @images = []
31
- @doc_infos = {}
32
- # init doc infos by url
33
- @urls.each {|url| @doc_infos[url]= {} }
29
+ @mobi_type = options[:mobi_type] || :magzine
30
+ @pages = []
31
+ @local_images = []
32
+ raise KindlerError.new("must provide the book title ") unless title
34
33
  end
35
34
 
36
- # add url to book
37
- # @param url [String] url to add to book
38
- # @param options [Hash]
39
- # @option section [Symbol] indicate which section the url belongs to,if not empty the book will be generated with magzine style
40
- def add_url(url,options={})
41
- return if @doc_infos[url]
42
- @urls << url
43
- @doc_infos[url] = {}
35
+ def add_page(options={})
36
+ raise KindlerError.new('must provide title when add page') unless options[:title]
37
+ page = options.reject{|k,v| PAGE_ATTRIBUTES.include?(k)}
38
+ page[:wrap] ||= true
39
+ page[:section] ||= DEFAULT_SECTION
40
+ page[:count] = pages.count + 1
41
+ page[:file_name] = "#{page[:count].to_s.rjust(3,'0')}.html"
42
+ pages << page
43
+ debug pages
44
44
  end
45
45
 
46
- # generate books by given urls
47
- def generate(title='')
46
+ def generate
48
47
  make_generated_dirs
49
- # generate
50
- generate_html
51
- localize_images
48
+ localize_images if @keep_image
52
49
  generate_toc
53
50
  generate_opf
54
51
  generate_ncx
55
52
  write_to_disk
56
53
  kindlegen
57
- # clear
58
54
  end
59
55
 
60
56
  # check mobi file is generated already
@@ -83,8 +79,8 @@ module Kindler
83
79
  <ul>
84
80
  CODE
85
81
  files_count = 1
86
- @doc_infos.each do |url,infos|
87
- contents << "<li><a href='#{files_count.to_s.rjust(3,'0')}.html'>#{infos[:title]}</a></li>"
82
+ pages.each do |page|
83
+ contents << "<li><a href='#{files_count.to_s.rjust(3,'0')}.html'>#{page[:title]}</a></li>"
88
84
  files_count += 1
89
85
  end
90
86
  # append footer
@@ -100,60 +96,124 @@ module Kindler
100
96
  <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
101
97
  <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en-US">
102
98
  <head>
103
- <meta name="dtb:uid" content="#{@title}"/>
99
+ <meta name="dtb:uid" content="#{title}"/>
104
100
  <meta name="dtb:depth" content="1"/>
105
101
  <meta name="dtb:totalPageCount" content="0"/>
106
102
  <meta name="dtb:maxPageNumber" content="0"/>
107
103
  </head>
108
104
  <docTitle>
109
- <text>#{@title}</text>
105
+ <text>#{title}</text>
110
106
  </docTitle>
111
107
  <docAuthor>
112
- <text>#{@author}</text>
108
+ <text>#{author}</text>
113
109
  </docAuthor>
114
110
  <navMap>
115
111
  NCX
112
+ contents << (magzine? ? magzine_ncx : flat_ncx)
113
+ contents << "</navMap></ncx>"
114
+ @ncx = contents
115
+ end
116
+
117
+ def flat_ncx
118
+ contents = ''
116
119
  files_count = 2
117
- @doc_infos.each do |url,infos|
120
+ pages.each do |page|
118
121
  nav_point = <<-NAV
119
122
  <navPoint id="navpoint-#{files_count}" playOrder="#{files_count}">
120
- <navLabel><text>#{infos[:title]}</text></navLabel>
123
+ <navLabel><text>#{page[:title]}</text></navLabel>
121
124
  <content src="#{(files_count-1).to_s.rjust(3,'0')}.html"/>
122
125
  </navPoint>
123
126
  NAV
124
127
  contents << nav_point
125
128
  files_count += 1
126
129
  end
127
- contents << "</navMap></ncx>"
128
- @ncx = contents
130
+ contents
131
+ end
132
+
133
+ def magzine_ncx
134
+ contents = ''
135
+ pages_by_section = {}
136
+ pages.each do |page|
137
+ pages_by_section[page[:title]] ||= []
138
+ pages_by_section[page[:title]] << page
139
+ end
140
+ contents << <<-MAG
141
+ <navPoint playOrder="0" class="periodical" id="periodical">
142
+ <navLabel>
143
+ <text>Table of Contents</text>
144
+ </navLabel>
145
+ <content src="contents.html"/>
146
+
147
+ MAG
148
+
149
+ play_order = 1
150
+ pages_by_section.each do |section,pages|
151
+ next if pages.count==0
152
+ # add section header
153
+ contents << <<-SECHEADER
154
+ <navPoint playOrder="#{play_order}" class="section" id="#{section}">
155
+ <navLabel>
156
+ <text>#{section}</text>
157
+ </navLabel>
158
+ <content src="#{pages.first[:file_name]}"/>
159
+ SECHEADER
160
+
161
+ play_order += 1
162
+ # add pages nav
163
+ pages.each do |page|
164
+ contents << <<-PAGE
165
+ <navPoint playOrder="#{play_order}" class="article" id="item-#{page[:count].to_s.rjust(3,'0')}">
166
+ <navLabel>
167
+ <text>#{page[:title]}</text>
168
+ </navLabel>
169
+ <content src="#{page[:file_name]}"/>
170
+ <mbp:meta name="description">#{page[:title]}</mbp:meta>
171
+ <mbp:meta name="author">#{page[:author]}</mbp:meta>
172
+ </navPoint>
173
+ PAGE
174
+ play_order += 1
175
+ end
176
+ # add section footer
177
+ contents << "</navPoint>"
178
+ end
179
+ contents << "</navPoint>"
180
+ end
181
+
182
+ def magzine_meta
183
+ <<-META
184
+ <x-metadata>
185
+ <output content-type="application/x-mobipocket-subscription-magazine" encoding="utf-8"/>
186
+ </x-metadata>
187
+ META
188
+ end
189
+
190
+ def magzine?
191
+ @mobi_type == :magzine
129
192
  end
130
193
 
131
194
  # generate the opf, manifest of book,including all articles and images and css
132
195
  def generate_opf
133
- # mark mobi as magzine format
134
- # <x-metadata>
135
- # <output content-type="application/x-mobipocket-subscription-magazine" encoding="utf-8"/>
136
- # </x-metadata>
137
196
  contents = <<-HTML
138
197
  <?xml version='1.0' encoding='utf-8'?>
139
- <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="#{@title}">
198
+ <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="#{title}">
140
199
  <metadata>
141
200
  <dc-metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
142
- <dc:title>#{@title}</dc:title>
201
+ <dc:title>#{title}</dc:title>
143
202
  <dc:language>en-gb</dc:language>
144
203
  <meta content="cover-image" name="cover"/>
145
204
  <dc:creator>Kindler- 29decibel</dc:creator>
146
205
  <dc:publisher>Kindler- 29decibel</dc:publisher>
147
206
  <dc:subject>News</dc:subject>
148
- <dc:identifier id="#{@title}">#{@title}</dc:identifier>
207
+ <dc:identifier id="#{title}">#{title}</dc:identifier>
149
208
  <dc:date>#{Time.now.to_date}/dc:date>
150
209
  <dc:description>Kindler generated book</dc:description>
151
210
  </dc-metadata>
211
+ #{magzine? ? magzine_meta : ''}
152
212
  </metadata>
153
213
  <manifest>
154
214
  HTML
155
215
  files_count = 1
156
- @doc_infos.each do |url,infos|
216
+ pages.each do |page|
157
217
  doc_id = files_count.to_s.rjust(3,'0')
158
218
  contents << "<item href='#{doc_id}.html' media-type='application/xhtml+xml' id='#{doc_id}'/>"
159
219
  files_count += 1
@@ -164,7 +224,7 @@ module Kindler
164
224
  contents << "<spine toc='nav-contents'>"
165
225
  contents << "<itemref idref='contents'/>"
166
226
  files_count = 1
167
- @doc_infos.each do |url,infos|
227
+ pages.each do |page|
168
228
  contents << "<itemref idref='#{files_count.to_s.rjust(3,'0')}'/>"
169
229
  files_count += 1
170
230
  end
@@ -172,27 +232,10 @@ module Kindler
172
232
  @opf = contents
173
233
  end
174
234
 
175
- # generate every url to article in readable format
176
- def generate_html
177
- @doc_infos.each do |url,infos|
178
- article = readable_article(url)
179
- if article
180
- begin
181
- # puts article.images
182
- infos[:content] = html_wrap(article.title,article.content)
183
- infos[:title] = article.title
184
- rescue Exception => e
185
- debug "error when get contents from article, #{e}"
186
- end
187
- end
188
- end
189
- @doc_infos = @doc_infos.reject{|url,infos| infos[:content]==nil or infos[:title]==nil }
190
- end
191
-
192
235
  def localize_images
193
236
  images_count = 1
194
- @doc_infos.each do |url,infos|
195
- article = Nokogiri::HTML(infos[:content])
237
+ pages.each do |page|
238
+ article = Nokogiri::HTML(page[:content])
196
239
  article.css('img').each do |img|
197
240
  begin
198
241
  image_remote_address = img.attr('src')
@@ -209,9 +252,9 @@ module Kindler
209
252
  debug 'Image saved'
210
253
  # replace local url address
211
254
  img.attributes['src'].value = "#{images_count}#{File.extname(image_remote_address)}"
212
- infos[:content] = article.inner_html
255
+ page[:content] = article.inner_html
213
256
  # add to manifest
214
- @images << "#{images_count}#{File.extname(image_remote_address)}"
257
+ local_images << "#{images_count}#{File.extname(image_remote_address)}"
215
258
  images_count += 1
216
259
  rescue Exception => e
217
260
  debug "got error when fetch and save image: #{e}"
@@ -236,22 +279,6 @@ module Kindler
236
279
  result << '</body></html>'
237
280
  end
238
281
 
239
- # get readable document by url, using ruby-readability here
240
- def readable_article(url)
241
- debug "begin fetch url : #{url}"
242
- begin
243
- source = open(url).read
244
- rescue Exception => e
245
- debug "got some erros,#{e}"
246
- return nil
247
- end
248
- if @keep_image
249
- Readability::Document.new(source,:tags=>%w(div p img a),:attributes => %w[src href],:remove_empty_nodes => false)
250
- else
251
- Readability::Document.new(source)
252
- end
253
- end
254
-
255
282
  # the dir path to generated files
256
283
  def tmp_dir
257
284
  File.join @output_dir,"#{TMP_DIR}_#{@title.gsub(' ','_')}"
@@ -266,24 +293,21 @@ module Kindler
266
293
  def write_to_disk
267
294
  File.open("#{tmp_dir}/nav-contents.ncx",'wb') { |f| f.write @ncx }
268
295
  File.open(file_path('contents'),'wb') {|f| f.write @toc }
269
- File.open("#{tmp_dir}/#{@title}.opf",'wb') {|f| f.write @opf}
296
+ File.open("#{tmp_dir}/#{title}.opf",'wb') {|f| f.write @opf}
270
297
  # make html files
271
298
  files_count = 1
272
- @doc_infos.each do |url,infos|
299
+ pages.each do |page|
273
300
  File.open(file_path(files_count.to_s.rjust(3,'0')),'wb') do |f|
274
- f.write infos[:content]
301
+ content_to_write = page[:wrap] ? html_wrap(page[:title],page[:content]) : page[:content]
302
+ debug "here is the page #{page[:title]} need to write"
303
+ debug content_to_write
304
+ f.write content_to_write
275
305
  end
276
306
  files_count += 1
277
307
  end
278
308
 
279
309
  end
280
310
 
281
- # exist to clear tmp files such as ncx,opf or html other than mobi file
282
- # keep them right now
283
- def clear_tmp_dirs
284
-
285
- end
286
-
287
311
  def debug(str)
288
312
  return unless @debug
289
313
  Rails.logger.info(str) if defined?(Rails)
@@ -1,47 +1,32 @@
1
1
  require 'spec_helper'
2
2
  describe "Mobi html file generator" do
3
3
 
4
- # it "should generate html files by urls" do
5
- # title = "Test_book"
6
- # book = Kindler::Book.new ({:urls=>["http://blog.farmostwood.net/643.html",
7
- # "http://www.ifanr.com/69878","http://www.oneplus.info/archives/455"],
8
- # :title=>title,:author=>'mike',:debug=>true})
9
- # book.generate
10
- # File.exist?(mobi_book_path(title)).should == true
11
- # end
12
-
13
-
14
- # it "should generate hacker news book" do
15
- # title = 'haker_news'
16
- # urls = []
17
- # urls << "http://jseliger.com/2010/09/26/how-universities-work-or-what-i-wish-i%E2%80%99d-known-freshman-year-a-guide-to-american-university-life-for-the-uninitiated/"
18
- # urls << "http://randykepple.com/photoblog/2010/10/8-bad-habits-that-crush-your-creativity-and-stifle-your-success/"
19
- # urls << "http://nathanmarz.com/blog/how-to-get-a-job-at-a-kick-ass-startup-for-programmers.html"
20
- # urls << "http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux"
21
- # urls << "http://antirez.com/post/what-is-wrong-with-2006-programming.html"
22
- # urls << "http://fak3r.com/2009/09/14/howto-build-your-own-open-source-dropbox-clone/"
23
- # book = Kindler::Book.new :urls=>urls,:title=>title,:author=>'mike',:debug=>true
24
- # book.generate
25
- # File.exist?(mobi_book_path(title)).should == true
26
- # end
4
+ it "should not generate a mobi book" do
5
+ title = 'good_book'
6
+ book = Kindler::Book.new :title=>title,:author=>'mike',:debug=>true
7
+ book.add_page :title=>'page1',:author=>'mike1',:content=>'this is the page 1',:wrap=>true
8
+ book.add_page :title=>'page2',:author=>'mike1',:content=>'this is the page 2',:wrap=>true
9
+ book.add_page :title=>'page3',:author=>'mike1',:content=>'this is the page 3',:wrap=>true
10
+ book.generate
11
+ File.exist?(mobi_book_path(title)).should == true
12
+ end
27
13
 
28
- # it "should generate book and infos on output_dir" do
29
- # title = 'my_dir_book'
30
- # urls = []
31
- # urls << "http://www.wowsai.com/home/space.php?uid=1&do=blog&id=4362&classid=2"
32
- # urls << "http://www.honeykennedy.com/2012/01/miss-moss-love-letters/"
33
- # urls << "http://www.mysenz.com/?p=3692"
34
- # book = Kindler::Book.new :urls=>urls,:title=>title,:author=>'mike',:output_dir=>'/Users/lidongbin/projects',:debug=>true
35
- # book.generate
36
- # File.exist?(mobi_book_path(title,'/Users/lidongbin/projects')).should == true
37
- # end
14
+ it "should generate book contains images" do
15
+ title = 'book_with_image'
16
+ book = Kindler::Book.new :title=>title,:author=>'mike',:debug=>true
17
+ book.add_page :title=>'page1',:author=>'mike1',:content=>'this is the page 1',:wrap=>true
18
+ book.add_page :title=>'page2',:author=>'mike1',:content=>'this is the page 2',:wrap=>true
19
+ book.add_page :title=>'page3',:author=>'mike1',:content=>'<img src="http://media2.glamour-sales.com.cn/media/catalog/category/Stroili_banner_02.jpg"></img>this is the page 3',:wrap=>true
20
+ book.generate
21
+ File.exist?(mobi_book_path(title)).should == true
22
+ end
38
23
 
39
- it "should not say error when got redirect page" do
40
- title = 'good_book'
41
- urls = []
42
- urls << "http://droplr.com"
43
- urls << "http://www.mysenz.com/?p=3692"
44
- book = Kindler::Book.new :urls=>urls,:title=>title,:author=>'mike',:debug=>true
24
+ it "should generate book with sections" do
25
+ title = 'first_section_book'
26
+ book = Kindler::Book.new :title=>title,:author=>'mike',:debug=>true
27
+ book.add_page :title=>'page1',:author=>'mike1',:content=>'this is the page 1',:wrap=>true,:section => 'love'
28
+ book.add_page :title=>'page2',:author=>'mike1',:content=>'this is the page 2',:wrap=>true,:section => 'hate'
29
+ book.add_page :title=>'page3',:author=>'mike1',:content=>'<img src="http://media2.glamour-sales.com.cn/media/catalog/category/Stroili_banner_02.jpg"></img>this is the page 3',:wrap=>true,:section=>'hate'
45
30
  book.generate
46
31
  File.exist?(mobi_book_path(title)).should == true
47
32
  end
@@ -50,35 +35,4 @@ describe "Mobi html file generator" do
50
35
  File.join(output_dir,"kindler_generated_mobi_#{title}/#{title}.mobi")
51
36
  end
52
37
 
53
-
54
- # this navPoint seems not useful
55
- # contents << <<-NAV
56
- # <navPoint id="navpoint-1" playOrder="1">
57
- # <navLabel><text>Table Of Contents</text></navLabel>
58
- # <content src="contents.html"/>
59
- # </navPoint>
60
- # NAV
61
- ####################### periodocal , magzine like format #########################
62
- # <navPoint playOrder="0" class="periodical" id="periodical">
63
- # <mbp:meta-img src="masthead.gif" name="mastheadImage"/>
64
- # <navLabel>
65
- # <text>Table of Contents</text>
66
- # </navLabel>
67
- # <content src="contents.html"/>
68
- # <navPoint playOrder="1" class="section" id="Main-section">
69
- # <navLabel>
70
- # <text>Main section</text>
71
- # </navLabel>
72
- # <content src="001.html"/>
73
- # <navPoint playOrder="2" class="article" id="item-001">
74
- # <navLabel>
75
- # <text>Nick Clegg and David Cameron agree key changes on NHS plans</text>
76
- # </navLabel>
77
- # <content src="001.html"/>
78
- # <mbp:meta name="description">Deputy PM tells Andrew Marr show that GPs should not be forced to sign up to new commissioning consortiums</mbp:meta>
79
- # <mbp:meta name="author">Nicholas Watt and Denis Campbell</mbp:meta>
80
- # </navPoint>
81
- # ####################################################################################
82
-
83
-
84
38
  end
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.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,8 +12,8 @@ cert_chain: []
12
12
  date: 2012-02-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: mini_magick
16
- requirement: &2155014640 !ruby/object:Gem::Requirement
15
+ name: nokogiri
16
+ requirement: &2156313120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,24 +21,11 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2155014640
25
- - !ruby/object:Gem::Dependency
26
- name: ruby-readability
27
- requirement: &2155014220 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *2155014220
36
- description: kindler is a rubygem allow you to generate kindle mobi book from urls
37
- very easily
24
+ version_requirements: *2156313120
25
+ description: kindler is a rubygem allow you to generate kindle mobi book very easily
38
26
  email:
39
27
  - mike.d.1984@gmail.com
40
- executables:
41
- - kindler
28
+ executables: []
42
29
  extensions: []
43
30
  extra_rdoc_files: []
44
31
  files:
@@ -47,7 +34,6 @@ files:
47
34
  - Guardfile
48
35
  - Rakefile
49
36
  - Readme.md
50
- - bin/kindler
51
37
  - kindler.gemspec
52
38
  - lib/kindler.rb
53
39
  - lib/kindler/railtie.rb
@@ -77,8 +63,7 @@ rubyforge_project: kindler
77
63
  rubygems_version: 1.8.11
78
64
  signing_key:
79
65
  specification_version: 3
80
- summary: kindler is a rubygem allow you to generate kindle mobi book from urls very
81
- easily
66
+ summary: kindler is a rubygem allow you to generate kindle mobi book very easily
82
67
  test_files:
83
68
  - spec/cases/generator_spec.rb
84
69
  - spec/spec_helper.rb
data/bin/kindler DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'optparse'
4
- require 'open-uri'
5
- require File.dirname(__FILE__) + "/../lib/kindler"
6
- # get options
7
- options = {:title=>'kindler_ebook',:urls=>ARGV}
8
- option_parser = OptionParser.new do |opts|
9
- opts.banner = "Usage kindler url1 url2 url3 [-t my_book] [-d]"
10
-
11
- opts.on("-d",'--debug','show debug infos') do |d|
12
- options[:debug] = d
13
- end
14
-
15
- opts.on("-t",'--title','title of book') do |t|
16
- options[:title] = t
17
- end
18
-
19
- opts.on_tail('-h','--help','show this message') do
20
- puts opts
21
- exit
22
- end
23
-
24
- end
25
-
26
- exit unless ARGV.length > 0
27
- book = Kindler::Book.new(options)
28
- book.generate
29
-