htmls_to_pdf 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -68,7 +68,7 @@ To use HtmlsToPdf, you create a new HtmlsToPdf object and pass in all your confi
68
68
 
69
69
  ## EXAMPLES
70
70
 
71
- You will find 17 example scripts in the /examples directory. Each creates a PDF from a website:
71
+ You will find 18 example scripts in the /examples directory. Each creates a PDF from a website:
72
72
 
73
73
  - [The 12 Factor App](http://www.12factor.net) (Adam Wiggins)
74
74
  - [Bash Guide](http://mywiki.wooledge.org/BashGuide) (Greg Wooledge)
@@ -81,6 +81,7 @@ You will find 17 example scripts in the /examples directory. Each creates a PDF
81
81
  - [Natural Language Processing for the Working Programmer](nlpwp.org/book/) (Daniël de Kok)
82
82
  - [Learn Python the Hard Way](http://learnpythonthehardway.org) (Zed A. Shaw)
83
83
  - [Practicing Ruby Vol 2](http://community.mendicantuniversity.org/articles/practicing-ruby-volume-2-now-freely-avai) (Gregory Brown)
84
+ - [The Python Tutorial](http://docs.python.org/tutorial/index.html)
84
85
  - Rails 3.1 release notes
85
86
  - [Ruby on Rails Guides](http://guides.rubyonrails.org)
86
87
  - [RSpec-Rails documentation](https://www.relishapp.com/rspec/rspec-rails/docs)
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'htmls_to_pdf'
3
+
4
+ # Get 'The Python Tutorial' as a single pdf file
5
+ # Source: 'http://docs.python.org/tutorial/index.html'
6
+
7
+ # To cut out unwanted cruft, I modified default.css.
8
+ # I added:
9
+ #
10
+ # div.sphinxsidebar {
11
+ # display: none;
12
+ # }
13
+ #
14
+ # div.related {
15
+ # display: none;
16
+ # }
17
+ #
18
+ # div.footer {
19
+ # display: none;
20
+ # }
21
+ #
22
+ # div.bodywrapper {
23
+ # margin: 0;
24
+ # }
25
+ #
26
+ # And I commented out:
27
+ #
28
+ # div.bodywrapper {
29
+ # /* margin: 0 0 0 230px; */
30
+ # }
31
+
32
+ config = {}
33
+ config[:urls] = [
34
+ 'http://docs.python.org/tutorial/index.html',
35
+ 'http://docs.python.org/tutorial/appetite.html',
36
+ 'http://docs.python.org/tutorial/interpreter.html',
37
+ 'http://docs.python.org/tutorial/introduction.html',
38
+ 'http://docs.python.org/tutorial/controlflow.html',
39
+ 'http://docs.python.org/tutorial/datastructures.html',
40
+ 'http://docs.python.org/tutorial/modules.html',
41
+ 'http://docs.python.org/tutorial/inputoutput.html',
42
+ 'http://docs.python.org/tutorial/errors.html',
43
+ 'http://docs.python.org/tutorial/classes.html',
44
+ 'http://docs.python.org/tutorial/stdlib.html',
45
+ 'http://docs.python.org/tutorial/stdlib2.html',
46
+ 'http://docs.python.org/tutorial/whatnow.html',
47
+ 'http://docs.python.org/tutorial/interactive.html',
48
+ 'http://docs.python.org/tutorial/floatingpoint.html',
49
+ 'http://docs.python.org/glossary.html'
50
+ ]
51
+ config[:savedir] = '~/Tech/Python/Python_Tutorial'
52
+ config[:savename] = 'The_Python_Tutorial.pdf'
53
+ config[:css] = ['http://docs.python.org/_static/default.css', 'http://docs.python.org/_static/pygments.css']
54
+ config[:remove_css_files] = false
55
+
56
+ HtmlsToPdf.new(config).create_pdf
data/htmls_to_pdf.gemspec CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['James Lavin']
9
9
  s.email = ['htmls_to_pdf@futureresearch.com']
10
+ s.homepage = "https://github.com/JamesLavin/HtmlsToPdf"
10
11
  s.summary = %q{Creates single PDF file from 1+ HTML pages}
11
12
  s.description = %q{Creates single PDF file from 1+ HTML pages using PDFKit}
12
13
  s.add_runtime_dependency 'pdfkit', '~> 0.5', '>= 0.5.2'
@@ -155,7 +155,7 @@ class HtmlsToPdf
155
155
  end
156
156
 
157
157
  def join_pdfs
158
- unless File.exists?(@savename)
158
+ unless File.exists?(@savename) && !overwrite_existing_pdf
159
159
  pdfs_string = @pdfarray.join(" ")
160
160
  `pdftk #{pdfs_string} output #{@savename}`
161
161
  end
@@ -1,3 +1,3 @@
1
1
  module HtmlsToPdf
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -120,6 +120,9 @@ describe "initialization" do
120
120
  subject.should_receive(:join_pdfs).once.and_return('PDF files joined')
121
121
  subject.create_pdf
122
122
  a_request(:get, "www.fakeurl.com/adfsdafds.html").should have_been_made
123
+ a_request(:get, "anotherfakedomain.com:443/blog/posts/143.htm").should have_been_made
124
+ a_request(:get, "fakeurl.com/assets/cssfile.css").should have_been_made
125
+ a_request(:get, "www.anotherfakedomain.com:443/public/css/CSS-file.css").should have_been_made
123
126
  end
124
127
 
125
128
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: htmls_to_pdf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Lavin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-28 00:00:00.000000000Z
12
+ date: 2012-03-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pdfkit
@@ -78,6 +78,7 @@ files:
78
78
  - examples/get_nlp_for_working_programmer.rb
79
79
  - examples/get_practicing_ruby_vol_2.rb
80
80
  - examples/get_python_book.rb
81
+ - examples/get_python_tutorial.rb
81
82
  - examples/get_rails_3_1_release_notes.rb
82
83
  - examples/get_ror_guides.rb
83
84
  - examples/get_rspec.rb
@@ -94,7 +95,7 @@ files:
94
95
  - spec/ensure_pdfkit_installed_spec.rb
95
96
  - spec/htmls_to_pdf_spec.rb
96
97
  - spec/spec_helper.rb
97
- homepage:
98
+ homepage: https://github.com/JamesLavin/HtmlsToPdf
98
99
  licenses: []
99
100
  post_install_message:
100
101
  rdoc_options: []