htmls_to_pdf 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.markdown +27 -5
- data/examples/get_12factor.rb +26 -0
- data/examples/get_bash_guide.rb +31 -0
- data/examples/get_coffeescript_cookbook.rb +101 -0
- data/examples/get_jumpstartlabs_advanced_rails.rb +70 -0
- data/examples/get_little_book_on_coffeescript.rb +20 -0
- data/examples/get_nlp_for_working_programmer.rb +26 -0
- data/examples/get_practicing_ruby_vol_2.rb +42 -0
- data/examples/get_ror_guides.rb +48 -0
- data/examples/get_rspec.rb +115 -0
- data/examples/get_rspec_rails.rb +51 -0
- data/examples/get_ruby_core_docs.rb +120 -0
- data/lib/htmls_to_pdf/htmls_to_pdf.rb +54 -18
- data/lib/htmls_to_pdf/version.rb +1 -1
- data/spec/ensure_pdfkit_installed_spec.rb +13 -0
- data/spec/spec_helper.rb +2 -0
- metadata +58 -75
data/.gitignore
CHANGED
data/README.markdown
CHANGED
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
HtmlsToPdf enables you to package one or more (ordered) HTML pages as a PDF.
|
6
6
|
|
7
|
+
## USEFULNESS
|
8
|
+
|
9
|
+
I created HtmlsToPdf because I often see multi-page websites with content I would rather have in a single PDF file, so I can view it offline and search through it. The Ruby on Rails Guides is one example. RSpec documentation is another.
|
10
|
+
|
7
11
|
## REQUIREMENTS
|
8
12
|
|
9
13
|
HtmlsToPdf uses the PDFKit gem, which itself uses the [wkhtmltopdf](http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html) program, which uses qtwebkit.
|
@@ -20,21 +24,39 @@ For information on qtwebkit:
|
|
20
24
|
|
21
25
|
For information on wkhtmltopdf:
|
22
26
|
|
23
|
-
- [Installation guide from PDFKit author](https://github.com/
|
27
|
+
- [Installation guide from PDFKit author](https://github.com/pdfkit/PDFKit/wiki/Installing-WKHTMLTOPDF)
|
24
28
|
|
25
29
|
- [code.google.com](http://code.google.com/p/wkhtmltopdf/)
|
26
30
|
|
27
31
|
For information on PDFKit:
|
28
32
|
|
29
|
-
- [Github](https://github.com/
|
33
|
+
- [Github](https://github.com/pdfkit/PDFKit)
|
30
34
|
|
31
35
|
- [Railscasts](http://railscasts.com/episodes/220-pdfkit)
|
32
36
|
|
33
37
|
## BASIC USAGE
|
34
38
|
|
35
|
-
You will find
|
36
|
-
|
37
|
-
|
39
|
+
You will find 16 example scripts in the /examples directory. Each creates a PDF from a website:
|
40
|
+
|
41
|
+
- The 12 Factor App (Adam Wiggins)
|
42
|
+
- Bash Guide (Greg Wooledge)
|
43
|
+
- Coffeescript Meet Backbone.js (Adam J. Spooner)
|
44
|
+
- Coffeescript Cookbook ([Various authors](http://coffeescriptcookbook.com/authors))
|
45
|
+
- Coffeescript official documentation
|
46
|
+
- Exploring Coffeescript (ElegantCode.com)
|
47
|
+
- Advanced Rails (Jumpstart Labs)
|
48
|
+
- The Little Book on Coffeescript (Alex MacCaw)
|
49
|
+
- Natural Language Processing for the Working Programmer (Daniël de Kok)
|
50
|
+
- Learn Python the Hard Way (Zed A. Shaw)
|
51
|
+
- Practicing Ruby Vol 2 (Gregory Brown)
|
52
|
+
- Rails 3.1 release notes
|
53
|
+
- Ruby on Rails Guides
|
54
|
+
- RSpec-Rails documentation
|
55
|
+
- RSpec documentation
|
56
|
+
- Learn Ruby the Hard Way (Zed A. Shaw)
|
57
|
+
- RubyGems User Guide
|
58
|
+
|
59
|
+
After you install HtmlsToPdf and its dependencies, you can write an ordinary Ruby script to save multiple ordered HTML pages as a single PDF.
|
38
60
|
|
39
61
|
### EXAMPLE 1
|
40
62
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get '12factor.net' as pdf file
|
5
|
+
# Source: '12factor.net'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = ['http://www.12factor.net',
|
9
|
+
'http://www.12factor.net/codebase',
|
10
|
+
'http://www.12factor.net/dependencies',
|
11
|
+
'http://www.12factor.net/config',
|
12
|
+
'http://www.12factor.net/backing-services',
|
13
|
+
'http://www.12factor.net/build-release-run',
|
14
|
+
'http://www.12factor.net/processes',
|
15
|
+
'http://www.12factor.net/port-binding',
|
16
|
+
'http://www.12factor.net/concurrency',
|
17
|
+
'http://www.12factor.net/disposability',
|
18
|
+
'http://www.12factor.net/dev-prod-parity',
|
19
|
+
'http://www.12factor.net/logs',
|
20
|
+
'http://www.12factor.net/admin-processes'
|
21
|
+
]
|
22
|
+
config[:savedir] = '~/Tech/Programming'
|
23
|
+
config[:savename] = 'The_12_Factor_App.pdf'
|
24
|
+
config[:css] = ['http://www.12factor.net/style.css']
|
25
|
+
|
26
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'BashGuide' as a pdf
|
5
|
+
# Source: 'http://mywiki.wooledge.org/BashGuide'
|
6
|
+
|
7
|
+
def bash_guide_urls
|
8
|
+
urls = ['http://mywiki.wooledge.org/BashGuide',
|
9
|
+
'http://mywiki.wooledge.org/BashGuide/CommandsAndArguments',
|
10
|
+
'http://mywiki.wooledge.org/BashGuide/SpecialCharacters',
|
11
|
+
'http://mywiki.wooledge.org/BashGuide/Parameters',
|
12
|
+
'http://mywiki.wooledge.org/BashGuide/Patterns',
|
13
|
+
'http://mywiki.wooledge.org/BashGuide/TestsAndConditionals',
|
14
|
+
'http://mywiki.wooledge.org/BashGuide/Arrays',
|
15
|
+
'http://mywiki.wooledge.org/BashGuide/InputAndOutput',
|
16
|
+
'http://mywiki.wooledge.org/BashGuide/CompoundCommands',
|
17
|
+
'http://mywiki.wooledge.org/BashGuide/Sourcing',
|
18
|
+
'http://mywiki.wooledge.org/BashGuide/JobControl',
|
19
|
+
'http://mywiki.wooledge.org/BashGuide/Practices'
|
20
|
+
]
|
21
|
+
urls
|
22
|
+
end
|
23
|
+
|
24
|
+
config = {}
|
25
|
+
config[:savedir] = '~/Tech/Linux/SHELL SCRIPTING'
|
26
|
+
config[:savename] = 'WooledgeBashGuide.pdf'
|
27
|
+
config[:urls] = bash_guide_urls
|
28
|
+
#config[:css] = ['http://ruby.learncodethehardway.org/book/css/syntax.css']
|
29
|
+
config[:remove_temp_files] = true
|
30
|
+
|
31
|
+
html_files = HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'CoffeeScript Cookbook' as pdf file
|
5
|
+
# Source: 'http://coffeescriptcookbook.com/'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = [
|
9
|
+
'http://coffeescriptcookbook.com/',
|
10
|
+
'http://coffeescriptcookbook.com/chapters/syntax',
|
11
|
+
'http://coffeescriptcookbook.com/chapters/syntax/embedding_javascript',
|
12
|
+
'http://coffeescriptcookbook.com/chapters/syntax/comparing_ranges',
|
13
|
+
'http://coffeescriptcookbook.com/chapters/syntax/for_loops',
|
14
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects',
|
15
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/class-methods-and-instance-methods',
|
16
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/cloning',
|
17
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/object-literal',
|
18
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/type-function',
|
19
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/class-variables',
|
20
|
+
'http://coffeescriptcookbook.com/chapters/classes_and_objects/chaining',
|
21
|
+
'http://coffeescriptcookbook.com/chapters/strings',
|
22
|
+
'http://coffeescriptcookbook.com/chapters/strings/repeating',
|
23
|
+
'http://coffeescriptcookbook.com/chapters/strings/lowercasing-a-string',
|
24
|
+
'http://coffeescriptcookbook.com/chapters/strings/uppercasing-a-string',
|
25
|
+
'http://coffeescriptcookbook.com/chapters/strings/finding-substrings',
|
26
|
+
'http://coffeescriptcookbook.com/chapters/strings/trimming-whitespace-from-a-string',
|
27
|
+
'http://coffeescriptcookbook.com/chapters/strings/capitalizing-words',
|
28
|
+
'http://coffeescriptcookbook.com/chapters/strings/splitting-a-string',
|
29
|
+
'http://coffeescriptcookbook.com/chapters/strings/interpolation',
|
30
|
+
'http://coffeescriptcookbook.com/chapters/strings/matching-strings',
|
31
|
+
'http://coffeescriptcookbook.com/chapters/strings/generating-a-unique-id',
|
32
|
+
'http://coffeescriptcookbook.com/chapters/arrays',
|
33
|
+
'http://coffeescriptcookbook.com/chapters/arrays/creating-a-string-from-an-array',
|
34
|
+
'http://coffeescriptcookbook.com/chapters/arrays/zip-function',
|
35
|
+
'http://coffeescriptcookbook.com/chapters/arrays/max-array-value',
|
36
|
+
'http://coffeescriptcookbook.com/chapters/arrays/using-arrays-to-swap-variables',
|
37
|
+
'http://coffeescriptcookbook.com/chapters/arrays/define-ranges',
|
38
|
+
'http://coffeescriptcookbook.com/chapters/arrays/shuffling-array-elements',
|
39
|
+
'http://coffeescriptcookbook.com/chapters/arrays/mapping-arrays',
|
40
|
+
'http://coffeescriptcookbook.com/chapters/arrays/reducing-arrays',
|
41
|
+
'http://coffeescriptcookbook.com/chapters/arrays/filtering-arrays',
|
42
|
+
'http://coffeescriptcookbook.com/chapters/arrays/reversing-arrays',
|
43
|
+
'http://coffeescriptcookbook.com/chapters/arrays/concatenating-arrays',
|
44
|
+
'http://coffeescriptcookbook.com/chapters/arrays/testing-every-element',
|
45
|
+
'http://coffeescriptcookbook.com/chapters/arrays/list-comprehensions',
|
46
|
+
'http://coffeescriptcookbook.com/chapters/arrays/removing-duplicate-elements-from-arrays',
|
47
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times',
|
48
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times/date-of-easter',
|
49
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times/date-of-thanksgiving',
|
50
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times/finding-last-day-of-the-month',
|
51
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times/days-between-two-dates',
|
52
|
+
'http://coffeescriptcookbook.com/chapters/dates_and_times/finding-last-or-next-month',
|
53
|
+
'http://coffeescriptcookbook.com/chapters/math',
|
54
|
+
'http://coffeescriptcookbook.com/chapters/math/fast-fibonacci',
|
55
|
+
'http://coffeescriptcookbook.com/chapters/math/random-integer',
|
56
|
+
'http://coffeescriptcookbook.com/chapters/math/generating-random-numbers',
|
57
|
+
'http://coffeescriptcookbook.com/chapters/math/constants',
|
58
|
+
'http://coffeescriptcookbook.com/chapters/math/generating-predictable-random-numbers',
|
59
|
+
'http://coffeescriptcookbook.com/chapters/math/fast-inv-square',
|
60
|
+
'http://coffeescriptcookbook.com/chapters/math/radians-degrees',
|
61
|
+
'http://coffeescriptcookbook.com/chapters/functions',
|
62
|
+
'http://coffeescriptcookbook.com/chapters/functions/recursion',
|
63
|
+
'http://coffeescriptcookbook.com/chapters/functions/parentheses',
|
64
|
+
'http://coffeescriptcookbook.com/chapters/functions/splat_arguments',
|
65
|
+
'http://coffeescriptcookbook.com/chapters/metaprogramming',
|
66
|
+
'http://coffeescriptcookbook.com/chapters/metaprogramming/detecting-and-replacing-functions',
|
67
|
+
'http://coffeescriptcookbook.com/chapters/metaprogramming/extending-built-in-objects',
|
68
|
+
'http://coffeescriptcookbook.com/chapters/jquery',
|
69
|
+
'http://coffeescriptcookbook.com/chapters/jquery/ajax',
|
70
|
+
'http://coffeescriptcookbook.com/chapters/jquery/plugin',
|
71
|
+
'http://coffeescriptcookbook.com/chapters/jquery/callback-bindings-jquery',
|
72
|
+
'http://coffeescriptcookbook.com/chapters/regular_expressions',
|
73
|
+
'http://coffeescriptcookbook.com/chapters/regular_expressions/replacing-substrings',
|
74
|
+
'http://coffeescriptcookbook.com/chapters/regular_expressions/replacing-html-tags-with-html-named-entities',
|
75
|
+
'http://coffeescriptcookbook.com/chapters/regular_expressions/heregexes',
|
76
|
+
'http://coffeescriptcookbook.com/chapters/regular_expressions/searching-for-substrings',
|
77
|
+
'http://coffeescriptcookbook.com/chapters/networking',
|
78
|
+
'http://coffeescriptcookbook.com/chapters/networking/bi-directional-server',
|
79
|
+
'http://coffeescriptcookbook.com/chapters/networking/bi-directional-client',
|
80
|
+
'http://coffeescriptcookbook.com/chapters/networking/basic-client',
|
81
|
+
'http://coffeescriptcookbook.com/chapters/networking/basic-http-client',
|
82
|
+
'http://coffeescriptcookbook.com/chapters/networking/basic-server',
|
83
|
+
'http://coffeescriptcookbook.com/chapters/networking/basic-http-server',
|
84
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns',
|
85
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/builder',
|
86
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/bridge',
|
87
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/decorator',
|
88
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/interpreter',
|
89
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/command',
|
90
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/factory_method',
|
91
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/strategy',
|
92
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/memento',
|
93
|
+
'http://coffeescriptcookbook.com/chapters/design_patterns/singleton',
|
94
|
+
'http://coffeescriptcookbook.com/chapters/databases',
|
95
|
+
'http://coffeescriptcookbook.com/chapters/databases/mongodb',
|
96
|
+
'http://coffeescriptcookbook.com/chapters/databases/sqlite']
|
97
|
+
config[:savedir] = '~/Tech/Javascript/COFFEESCRIPT/DOCUMENTATION'
|
98
|
+
config[:savename] = 'CoffeeScript_Cookbook.pdf'
|
99
|
+
config[:css] = ['http://coffeescriptcookbook.com/css/default.css']
|
100
|
+
|
101
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'Jumpstart Labs Advanced Rails' as pdf file
|
5
|
+
# Source: 'http://tutorials.jumpstartlab.com/paths/advanced_rails_five_day.html'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = [
|
9
|
+
'http://tutorials.jumpstartlab.com/paths/advanced_rails_five_day.html',
|
10
|
+
'http://tutorials.jumpstartlab.com/topics/environment/environment.html',
|
11
|
+
'http://tutorials.jumpstartlab.com/topics/environment/rvm.html',
|
12
|
+
'http://tutorials.jumpstartlab.com/topics/environment/bundler.html',
|
13
|
+
'http://tutorials.jumpstartlab.com/topics/environment/git_strategy.html',
|
14
|
+
'http://tutorials.jumpstartlab.com/topics/environment/heroku.html',
|
15
|
+
'http://tutorials.jumpstartlab.com/topics/routes/request_cycle.html',
|
16
|
+
'http://tutorials.jumpstartlab.com/topics/routes/router.html',
|
17
|
+
'http://tutorials.jumpstartlab.com/topics/internal_testing/rspec_and_bdd.html',
|
18
|
+
'http://tutorials.jumpstartlab.com/topics/internal_testing/rspec_practices.html',
|
19
|
+
'http://tutorials.jumpstartlab.com/topics/internal_testing/factories.html',
|
20
|
+
'http://tutorials.jumpstartlab.com/topics/internal_testing/code_coverage.html',
|
21
|
+
'http://tutorials.jumpstartlab.com/topics/capybara/capybara_with_rack_test.html',
|
22
|
+
'http://tutorials.jumpstartlab.com/topics/capybara/capybara_with_selenium_and_webkit.html',
|
23
|
+
'http://tutorials.jumpstartlab.com/topics/capybara/capybara_practice.html',
|
24
|
+
'http://tutorials.jumpstartlab.com/topics/debugging/outputting_text.html',
|
25
|
+
'http://tutorials.jumpstartlab.com/topics/debugging/debugger.html',
|
26
|
+
'http://tutorials.jumpstartlab.com/topics/debugging/error_services.html',
|
27
|
+
'http://tutorials.jumpstartlab.com/topics/models/relationships.html',
|
28
|
+
'http://tutorials.jumpstartlab.com/topics/models/polymorphism.html',
|
29
|
+
'http://tutorials.jumpstartlab.com/topics/models/legacy_databases.html',
|
30
|
+
'http://tutorials.jumpstartlab.com/topics/models/validations.html',
|
31
|
+
'http://tutorials.jumpstartlab.com/topics/models/transactions.html',
|
32
|
+
'http://tutorials.jumpstartlab.com/topics/models/processor_models.html',
|
33
|
+
'http://tutorials.jumpstartlab.com/topics/models/modules.html',
|
34
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/parameters.html',
|
35
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/filters.html',
|
36
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/friendly-urls.html',
|
37
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/flash.html',
|
38
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/render_and_redirect.html',
|
39
|
+
'http://tutorials.jumpstartlab.com/topics/controllers/sessions_and_conversations.html',
|
40
|
+
'http://tutorials.jumpstartlab.com/topics/better_views/understanding_views.html',
|
41
|
+
'http://tutorials.jumpstartlab.com/topics/better_views/erb_and_haml.html',
|
42
|
+
'http://tutorials.jumpstartlab.com/topics/better_views/view_partials.html',
|
43
|
+
'http://tutorials.jumpstartlab.com/topics/better_views/pagination.html',
|
44
|
+
'http://tutorials.jumpstartlab.com/topics/javascript/rails_and_javascript.html',
|
45
|
+
'http://tutorials.jumpstartlab.com/topics/javascript/jquery.html',
|
46
|
+
'http://tutorials.jumpstartlab.com/topics/javascript/coffeescript.html',
|
47
|
+
'http://tutorials.jumpstartlab.com/topics/web_services/api.html',
|
48
|
+
'http://tutorials.jumpstartlab.com/topics/web_services/encoding_and_filtering.html',
|
49
|
+
'http://tutorials.jumpstartlab.com/topics/web_services/active_resource.html',
|
50
|
+
'http://tutorials.jumpstartlab.com/topics/web_services/soap.html',
|
51
|
+
'http://tutorials.jumpstartlab.com/topics/performance/measuring.html',
|
52
|
+
'http://tutorials.jumpstartlab.com/topics/performance/queries.html',
|
53
|
+
'http://tutorials.jumpstartlab.com/topics/performance/caching.html',
|
54
|
+
'http://tutorials.jumpstartlab.com/topics/performance/background_jobs.html',
|
55
|
+
'http://tutorials.jumpstartlab.com/topics/systems/credentials_and_configuration.html',
|
56
|
+
'http://tutorials.jumpstartlab.com/topics/systems/automation.html',
|
57
|
+
'http://tutorials.jumpstartlab.com/topics/auth/local_authentication.html',
|
58
|
+
'http://tutorials.jumpstartlab.com/topics/auth/remote_authentication.html',
|
59
|
+
'http://tutorials.jumpstartlab.com/topics/auth/authorization.html',
|
60
|
+
'http://tutorials.jumpstartlab.com/topics/search.html',
|
61
|
+
'http://tutorials.jumpstartlab.com/topics/heroku.html',
|
62
|
+
'http://tutorials.jumpstartlab.com/topics/continuous_integration.html',
|
63
|
+
'http://tutorials.jumpstartlab.com/topics/sample_project.html'
|
64
|
+
]
|
65
|
+
config[:savedir] = '~/Tech/Rails/BOOKS'
|
66
|
+
config[:savename] = 'JumpstartLabs_Advanced_Rails.pdf'
|
67
|
+
config[:css] = ['http://tutorials.jumpstartlab.com/stylesheets/screen.css']
|
68
|
+
config[:remove_temp_files] = true
|
69
|
+
|
70
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'Little Book on CoffeeScript' as pdf file
|
5
|
+
# Source: 'http://arcturo.github.com/library/coffeescript/index.html'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = []
|
9
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/01_introduction.html'
|
10
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/02_syntax.html'
|
11
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/03_classes.html'
|
12
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/04_idioms.html'
|
13
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/05_compiling.html'
|
14
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/06_applications.html'
|
15
|
+
config[:urls] << 'http://arcturo.github.com/library/coffeescript/07_the_bad_parts.html'
|
16
|
+
config[:savedir] = '~/Tech/Javascript/COFFEESCRIPT/THE LITTLE BOOK ON COFFEESCRIPT'
|
17
|
+
config[:savename] = 'Little_Book_on_CoffeeScript.pdf'
|
18
|
+
config[:css] = ['http://arcturo.github.com/library/coffeescript/site/site.css']
|
19
|
+
|
20
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'Natural Language Processing for the Working Programmer' as pdf file
|
5
|
+
# Source: 'http://nlpwp.org/book/'
|
6
|
+
# With appreciation to author Daniël de Kok
|
7
|
+
|
8
|
+
config = {}
|
9
|
+
config[:urls] = ['http://nlpwp.org/book/',
|
10
|
+
'http://nlpwp.org/book/preface.xhtml',
|
11
|
+
'http://nlpwp.org/book/chap-intro.xhtml',
|
12
|
+
'http://nlpwp.org/book/chap-words.xhtml',
|
13
|
+
'http://nlpwp.org/book/chap-ngrams.xhtml',
|
14
|
+
'http://nlpwp.org/book/chap-similarity.xhtml',
|
15
|
+
'http://nlpwp.org/book/chap-classification.xhtml',
|
16
|
+
'http://nlpwp.org/book/chap-ir.xhtml',
|
17
|
+
'http://nlpwp.org/book/chap-tagging.xhtml',
|
18
|
+
'http://nlpwp.org/book/chap-reglang.xhtml',
|
19
|
+
'http://nlpwp.org/book/chap-cfg.xhtml',
|
20
|
+
'http://nlpwp.org/book/chap-performance.xhtml'
|
21
|
+
]
|
22
|
+
config[:savedir] = '~/Tech/Natural Language Processing/NLP_for_Working_Programmers'
|
23
|
+
config[:savename] = 'Natural_Language_Processing_for_Working_Programmers.pdf'
|
24
|
+
config[:css] = ['http://nlpwp.org/book/screen.css']
|
25
|
+
|
26
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get all 'Practicing Ruby Volume 2' as a single pdf file
|
5
|
+
# Source: 'http://community.mendicantuniversity.org/articles/practicing-ruby-volume-2-now-freely-avai'
|
6
|
+
|
7
|
+
# Note: Author Gregory Brown generously provides these files for free
|
8
|
+
# but encourages those who can to support his work. He writes:
|
9
|
+
# "Practicing Ruby is a subscriber-supported service, and
|
10
|
+
# is literally how I pay my bills. If you like these
|
11
|
+
# articles and want to help make sure I can keep writing
|
12
|
+
# more of them, please become a subscriber. There is lots
|
13
|
+
# of content available to members that has not been publicly
|
14
|
+
# released yet, and I'm adding more articles regularly.
|
15
|
+
# PS: Anyone who can't pay the full $8/month fee for ANY
|
16
|
+
# reason is welcome to contact gregory.t.brown@gmail.com
|
17
|
+
# for a free account."
|
18
|
+
|
19
|
+
config = {}
|
20
|
+
config[:urls] = [
|
21
|
+
'http://practicingruby.com/articles/shared/tmxmprhfrpwq',
|
22
|
+
'http://practicingruby.com/articles/shared/bhftubljbomqpmifbibmzmptlxhoin',
|
23
|
+
'http://practicingruby.com/articles/shared/mvzhovpjbghr',
|
24
|
+
'http://practicingruby.com/articles/shared/ggcwduoyfqmz',
|
25
|
+
'http://practicingruby.com/articles/shared/afshdqdholth',
|
26
|
+
'http://practicingruby.com/articles/shared/vbmlgkdtahzd',
|
27
|
+
'http://practicingruby.com/articles/shared/ozkzbsdmagcm',
|
28
|
+
'http://practicingruby.com/articles/shared/jleygxejeopq',
|
29
|
+
'http://practicingruby.com/articles/shared/qyxvmrgmhuln',
|
30
|
+
'http://practicingruby.com/articles/shared/nlhxgszkgenq',
|
31
|
+
'http://practicingruby.com/articles/shared/iptocucwujtj',
|
32
|
+
'http://practicingruby.com/articles/shared/oelhlibhtlkx',
|
33
|
+
'http://practicingruby.com/articles/shared/gthgvfebjvyn',
|
34
|
+
'http://practicingruby.com/articles/shared/vpxpovppchww',
|
35
|
+
'http://practicingruby.com/articles/shared/wdykkrmdfjvf'
|
36
|
+
]
|
37
|
+
config[:savedir] = '~/Tech/Ruby/DOCUMENTATION'
|
38
|
+
config[:savename] = 'Practicing_Ruby_Vol_2.pdf'
|
39
|
+
config[:css] = ['http://practicingruby.com/assets/application-4fd26c9107c02ce07a20eb2d35d08230.css']
|
40
|
+
config[:remove_temp_files] = true
|
41
|
+
|
42
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get all 'Ruby on Rails Guides' as a single pdf file
|
5
|
+
# Source: 'http://guides.rubyonrails.org/index.html'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = [
|
9
|
+
'http://guides.rubyonrails.org/index.html',
|
10
|
+
'http://guides.rubyonrails.org/getting_started.html',
|
11
|
+
'http://guides.rubyonrails.org/migrations.html',
|
12
|
+
'http://guides.rubyonrails.org/active_record_validations_callbacks.html',
|
13
|
+
'http://guides.rubyonrails.org/association_basics.html',
|
14
|
+
'http://guides.rubyonrails.org/active_record_querying.html',
|
15
|
+
'http://guides.rubyonrails.org/layouts_and_rendering.html',
|
16
|
+
'http://guides.rubyonrails.org/form_helpers.html',
|
17
|
+
'http://guides.rubyonrails.org/action_controller_overview.html',
|
18
|
+
'http://guides.rubyonrails.org/routing.html',
|
19
|
+
'http://guides.rubyonrails.org/active_support_core_extensions.html',
|
20
|
+
'http://guides.rubyonrails.org/i18n.html',
|
21
|
+
'http://guides.rubyonrails.org/action_mailer_basics.html',
|
22
|
+
'http://guides.rubyonrails.org/testing.html',
|
23
|
+
'http://guides.rubyonrails.org/security.html',
|
24
|
+
'http://guides.rubyonrails.org/debugging_rails_applications.html',
|
25
|
+
'http://guides.rubyonrails.org/performance_testing.html',
|
26
|
+
'http://guides.rubyonrails.org/configuring.html',
|
27
|
+
'http://guides.rubyonrails.org/command_line.html',
|
28
|
+
'http://guides.rubyonrails.org/caching_with_rails.html',
|
29
|
+
'http://guides.rubyonrails.org/asset_pipeline.html',
|
30
|
+
'http://guides.rubyonrails.org/initialization.html',
|
31
|
+
'http://guides.rubyonrails.org/plugins.html',
|
32
|
+
'http://guides.rubyonrails.org/rails_on_rack.html',
|
33
|
+
'http://guides.rubyonrails.org/generators.html',
|
34
|
+
'http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html',
|
35
|
+
'http://guides.rubyonrails.org/api_documentation_guidelines.html',
|
36
|
+
'http://guides.rubyonrails.org/ruby_on_rails_guides_guidelines.html',
|
37
|
+
'http://guides.rubyonrails.org/3_2_release_notes.html',
|
38
|
+
'http://guides.rubyonrails.org/3_1_release_notes.htmlhttp://guides.rubyonrails.org/3_0_release_notes.html',
|
39
|
+
'http://guides.rubyonrails.org/2_3_release_notes.html',
|
40
|
+
'http://guides.rubyonrails.org/2_2_release_notes.html'
|
41
|
+
]
|
42
|
+
config[:savedir] = '~/Tech/Rails/RAILS_GUIDES'
|
43
|
+
config[:savename] = 'Ruby_on_Rails_Guides.pdf'
|
44
|
+
config[:css] = [
|
45
|
+
'http://guides.rubyonrails.org/stylesheets/print.css']
|
46
|
+
config[:remove_temp_files] = true
|
47
|
+
|
48
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'RSpec documentation' as pdf file
|
5
|
+
# Source: 'https://www.relishapp.com/rspec'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = [
|
9
|
+
'https://www.relishapp.com/rspec/rspec-core/docs',
|
10
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/autotest',
|
11
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/example-groups',
|
12
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/example-groups/basic-structure-describe-it',
|
13
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/example-groups/shared-examples',
|
14
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/example-groups/shared-context',
|
15
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line',
|
16
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/example-option',
|
17
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/format-option',
|
18
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/line-number-option',
|
19
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/tag-option',
|
20
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/line-number-appended-to-file-path',
|
21
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/exit-status',
|
22
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/rake-task',
|
23
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/init-option',
|
24
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/order-new-in-rspec-core-2-8',
|
25
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/pattern-option',
|
26
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/command-line/run-with-ruby-command',
|
27
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/pending/pending-examples',
|
28
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/hooks/before-and-after-hooks',
|
29
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/hooks/around-hooks',
|
30
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/hooks/filters',
|
31
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/subject/implicitly-defined-subject',
|
32
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/subject/explicit-subject',
|
33
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/subject/attribute-of-subject',
|
34
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/subject/implicit-receiver',
|
35
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/helper-methods/let-and-let',
|
36
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/helper-methods/arbitrary-helper-methods',
|
37
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/helper-methods/define-helper-methods-in-a-module',
|
38
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/metadata/current-example',
|
39
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/metadata/described-class',
|
40
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/metadata/user-defined-metadata',
|
41
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/filtering/inclusion-filters',
|
42
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/filtering/exclusion-filters',
|
43
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/filtering/if-and-unless',
|
44
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/filtering/run-all-when-everything-filtered',
|
45
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/configuration/read-command-line-configuration-options-from-files',
|
46
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/configuration/fail-fast',
|
47
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/configuration/custom-settings',
|
48
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/configuration/alias-example-to',
|
49
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/configuration/default-path',
|
50
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/expectation-framework-integration/configure-expectation-framework',
|
51
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/mock-framework-integration/mock-with-rspec',
|
52
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/mock-framework-integration/mock-with-flexmock',
|
53
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/mock-framework-integration/mock-with-mocha',
|
54
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/mock-framework-integration/mock-with-rr',
|
55
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/mock-framework-integration/mock-with-an-alternative-framework',
|
56
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/formatters/custom-formatters',
|
57
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/formatters/text-formatter',
|
58
|
+
'https://www.relishapp.com/rspec/rspec-core/v/2-8/docs/spec-files/arbitrary-file-suffix',
|
59
|
+
'https://www.relishapp.com/rspec/rspec-expectations/docs',
|
60
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/customized-message',
|
61
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/diffing',
|
62
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/implicit-docstrings',
|
63
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers',
|
64
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/be-matchers',
|
65
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/be-within-matcher',
|
66
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/equality-matchers',
|
67
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/exist-matcher',
|
68
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/expect-change',
|
69
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/raise-error-matcher',
|
70
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/have-n-items-matcher',
|
71
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/include-matcher',
|
72
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/match-matcher',
|
73
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/operator-matchers',
|
74
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/predicate-matchers',
|
75
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/respond-to-matcher',
|
76
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/satisfy-matcher',
|
77
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/throw-symbol-matcher',
|
78
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/specify-types-of-objects',
|
79
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/built-in-matchers/cover-matcher',
|
80
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers',
|
81
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers/define-matcher',
|
82
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers/define-diffable-matcher',
|
83
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers/define-matcher-with-fluent-interface',
|
84
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers/access-running-example',
|
85
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/custom-matchers/define-matcher-outside-rspec',
|
86
|
+
'https://www.relishapp.com/rspec/rspec-expectations/v/2-8/docs/test-frameworks/test-unit-integration',
|
87
|
+
'https://www.relishapp.com/rspec/rspec-mocks/docs',
|
88
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs',
|
89
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/stub-with-a-simple-return-value',
|
90
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/stub-with-substitute-implementation',
|
91
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/stub-a-chain-of-methods',
|
92
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/stub-on-any-instance-of-a-class',
|
93
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/as-null-object',
|
94
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/method-stubs/double-handling-to-ary',
|
95
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/message-expectations',
|
96
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/message-expectations/expect-a-message',
|
97
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/message-expectations/expect-a-message-on-any-instance-of-a-class',
|
98
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/message-expectations/warn-when-expectation-is-set-on-nil',
|
99
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/message-expectations/receive-counts',
|
100
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/argument-matchers',
|
101
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/argument-matchers/explicit-arguments',
|
102
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/argument-matchers/general-matchers',
|
103
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/argument-matchers/stub-with-argument-constraints',
|
104
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/outside-rspec/configure-any-test-framework-to-use-rspec-mocks',
|
105
|
+
'https://www.relishapp.com/rspec/rspec-mocks/v/2-8/docs/outside-rspec/standalone'
|
106
|
+
]
|
107
|
+
config[:savedir] = '~/Tech/Ruby/TESTING/RSPEC'
|
108
|
+
config[:savename] = 'RSpec_documentation.pdf'
|
109
|
+
config[:css] = [
|
110
|
+
'https://www.relishapp.com/stylesheets/global.css',
|
111
|
+
#'https://www.relishapp.com/stylesheets/application.css',
|
112
|
+
'https://www.relishapp.com/stylesheets/print.css']
|
113
|
+
config[:remove_temp_files] = true
|
114
|
+
|
115
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'RSpec Rails documentation' as pdf file
|
5
|
+
# Source: 'https://www.relishapp.com/rspec/rspec-rails/docs'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
config[:urls] = [
|
9
|
+
'https://www.relishapp.com/rspec/rspec-rails/docs',
|
10
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/gettingstarted',
|
11
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/generators',
|
12
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/transactions',
|
13
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/autotest',
|
14
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/railsversions',
|
15
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/request-specs/request-spec',
|
16
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/model-specs',
|
17
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/model-specs/errors-on',
|
18
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/model-specs/transactional-examples',
|
19
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs',
|
20
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/cookies',
|
21
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/controller-spec',
|
22
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/views-are-stubbed-by-default',
|
23
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/render-views',
|
24
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/anonymous-controller',
|
25
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/controller-specs/bypass-rescue',
|
26
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/helper-specs/helper-spec',
|
27
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/mailer-specs/url-helpers-in-mailer-examples',
|
28
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/routing-specs',
|
29
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/routing-specs/route-to-matcher',
|
30
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/routing-specs/be-routable-matcher',
|
31
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/routing-specs/named-routes',
|
32
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/view-specs/view-spec',
|
33
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/view-specs/stub-template',
|
34
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/view-specs/view-spec-infers-controller-path-and-action',
|
35
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/matchers',
|
36
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/matchers/be-a-new-matcher',
|
37
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/matchers/render-template-matcher',
|
38
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/matchers/redirect-to-matcher',
|
39
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/matchers/activerecord-relation-match-array',
|
40
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/mocks/mock-model',
|
41
|
+
'https://www.relishapp.com/rspec/rspec-rails/v/2-8/docs/mocks/stub-model'
|
42
|
+
]
|
43
|
+
config[:savedir] = '~/Tech/Rails/TESTING/RSPEC'
|
44
|
+
config[:savename] = 'RSpec_Rails_documentation.pdf'
|
45
|
+
config[:css] = [
|
46
|
+
'https://www.relishapp.com/stylesheets/global.css',
|
47
|
+
#'https://www.relishapp.com/stylesheets/application.css',
|
48
|
+
'https://www.relishapp.com/stylesheets/print.css']
|
49
|
+
config[:remove_temp_files] = true
|
50
|
+
|
51
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'htmls_to_pdf'
|
3
|
+
|
4
|
+
# Get 'Ruby Core documentation' as pdf file
|
5
|
+
# Source: 'http://www.ruby-doc.org/core-1.9.3/'
|
6
|
+
|
7
|
+
config = {}
|
8
|
+
|
9
|
+
config[:urls] = %w(
|
10
|
+
ARGF.html
|
11
|
+
ArgumentError.html
|
12
|
+
Array.html
|
13
|
+
BasicObject.html
|
14
|
+
Bignum.html
|
15
|
+
Binding.html
|
16
|
+
Class.html
|
17
|
+
Comparable.html
|
18
|
+
Complex.html
|
19
|
+
Continuation.html
|
20
|
+
Data.html
|
21
|
+
Dir.html
|
22
|
+
ENV.html
|
23
|
+
EOFError.html
|
24
|
+
Encoding.html
|
25
|
+
Encoding/CompatibilityError.html
|
26
|
+
Encoding/Converter.html
|
27
|
+
Encoding/ConverterNotFoundError.html
|
28
|
+
Encoding/InvalidByteSequenceError.html
|
29
|
+
Encoding/UndefinedConversionError.html
|
30
|
+
EncodingError.html
|
31
|
+
Enumerable.html
|
32
|
+
Enumerator.html
|
33
|
+
Enumerator/Generator.html
|
34
|
+
Enumerator/Yielder.html
|
35
|
+
Errno.html
|
36
|
+
Exception.html
|
37
|
+
FalseClass.html
|
38
|
+
Fiber.html
|
39
|
+
FiberError.html
|
40
|
+
File.html
|
41
|
+
File/Constants.html
|
42
|
+
File/Stat.html
|
43
|
+
FileTest.html
|
44
|
+
Fixnum.html
|
45
|
+
Float.html
|
46
|
+
FloatDomainError.html
|
47
|
+
GC.html
|
48
|
+
GC/Profiler.html
|
49
|
+
Hash.html
|
50
|
+
IO.html
|
51
|
+
IO/WaitReadable.html
|
52
|
+
IO/WaitWritable.html
|
53
|
+
IOError.html
|
54
|
+
IndexError.html
|
55
|
+
Integer.html
|
56
|
+
Interrupt.html
|
57
|
+
Kernel.html
|
58
|
+
KeyError.html
|
59
|
+
LoadError.html
|
60
|
+
LocalJumpError.html
|
61
|
+
Marshal.html
|
62
|
+
MatchData.html
|
63
|
+
Math.html
|
64
|
+
Math/DomainError.html
|
65
|
+
Method.html
|
66
|
+
Module.html
|
67
|
+
Mutex.html
|
68
|
+
NameError.html
|
69
|
+
NilClass.html
|
70
|
+
NoMemoryError.html
|
71
|
+
NoMethodError.html
|
72
|
+
NotImplementedError.html
|
73
|
+
Numeric.html
|
74
|
+
Object.html
|
75
|
+
ObjectSpace.html
|
76
|
+
Proc.html
|
77
|
+
Process.html
|
78
|
+
Process/GID.html
|
79
|
+
Process/Status.html
|
80
|
+
Process/Sys.html
|
81
|
+
Process/UID.html
|
82
|
+
Random.html
|
83
|
+
Range.html
|
84
|
+
RangeError.html
|
85
|
+
Rational.html
|
86
|
+
Regexp.html
|
87
|
+
RegexpError.html
|
88
|
+
RubyVM.html
|
89
|
+
RubyVM/Env.html
|
90
|
+
RubyVM/InstructionSequence.html
|
91
|
+
RuntimeError.html
|
92
|
+
ScriptError.html
|
93
|
+
SecurityError.html
|
94
|
+
Signal.html
|
95
|
+
SignalException.html
|
96
|
+
StandardError.html
|
97
|
+
StopIteration.html
|
98
|
+
String.html
|
99
|
+
Struct.html
|
100
|
+
Symbol.html
|
101
|
+
SyntaxError.html
|
102
|
+
SystemCallError.html
|
103
|
+
SystemExit.html
|
104
|
+
SystemStackError.html
|
105
|
+
Thread.html
|
106
|
+
ThreadError.html
|
107
|
+
ThreadGroup.html
|
108
|
+
Time.html
|
109
|
+
TrueClass.html
|
110
|
+
TypeError.html
|
111
|
+
UnboundMethod.html
|
112
|
+
ZeroDivisionError.html
|
113
|
+
fatal.html)
|
114
|
+
config[:urls] = config[:urls].map { |u| 'http://www.ruby-doc.org/core-1.9.3/' + u }
|
115
|
+
config[:savedir] = '~/Tech/Ruby/DOCUMENTATION'
|
116
|
+
config[:css] = 'http://www.ruby-doc.org/core-1.9.3/css/obf.css'
|
117
|
+
config[:remove_css_files] = false
|
118
|
+
config[:savename] = 'Ruby_Core_docs.pdf'
|
119
|
+
|
120
|
+
HtmlsToPdf.new(config).create_pdf
|
@@ -2,11 +2,12 @@ require 'rubygems'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pdfkit'
|
4
4
|
require 'uri'
|
5
|
-
include URI
|
5
|
+
#include URI
|
6
|
+
require 'net/http'
|
6
7
|
|
7
8
|
class HtmlsToPdf
|
8
9
|
|
9
|
-
attr_reader :htmlarray, :pdfarray, :cssarray, :urls, :savedir, :savename, :
|
10
|
+
attr_reader :htmlarray, :pdfarray, :cssarray, :urls, :savedir, :savename, :remove_html_files, :remove_css_files, :remove_tmp_pdf_files
|
10
11
|
|
11
12
|
TMP_HTML_PREFIX = 'tmp_html_file_'
|
12
13
|
TMP_PDF_PREFIX = 'tmp_pdf_file_'
|
@@ -14,19 +15,44 @@ class HtmlsToPdf
|
|
14
15
|
def initialize(in_config = {})
|
15
16
|
config = {
|
16
17
|
:css => [],
|
17
|
-
:
|
18
|
-
:
|
18
|
+
:remove_css_files => true,
|
19
|
+
:remove_html_files => true,
|
20
|
+
:remove_tmp_pdf_files => true,
|
21
|
+
:overwrite_existing_pdf => false,
|
22
|
+
:options => {},
|
23
|
+
:savedir => File.expand_path("~"),
|
24
|
+
:savename => 'htmls_to_pdf.pdf'
|
19
25
|
}.merge(in_config)
|
20
26
|
set_dir(config[:savedir])
|
21
27
|
@savename = config[:savename]
|
22
|
-
|
28
|
+
@overwrite_existing_pdf = config[:overwrite_existing_pdf]
|
29
|
+
exit_if_pdf_exists unless @overwrite_existing_pdf
|
23
30
|
@urls = clean_urls(config[:urls])
|
24
31
|
@pdfarray = create_pdfarray
|
25
|
-
@cssarray = config[:css]
|
26
|
-
@
|
32
|
+
@cssarray = config[:css].kind_of?(Array) ? config[:css] : Array[ config[:css] ]
|
33
|
+
@remove_css_files = config[:remove_css_files]
|
34
|
+
@remove_html_files = config[:remove_html_files]
|
35
|
+
@remove_tmp_pdf_files = config[:remove_tmp_pdf_files]
|
36
|
+
@remove_css_files = @remove_html_files = @remove_tmp_pdf_files = true if in_config[:remove_temp_files]
|
27
37
|
@options = config[:options]
|
28
38
|
end
|
29
39
|
|
40
|
+
def create_pdf
|
41
|
+
clean_temp_files
|
42
|
+
download_files
|
43
|
+
generate_pdfs
|
44
|
+
join_pdfs
|
45
|
+
clean_temp_files
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def clean_temp_files
|
51
|
+
delete_html_files if @remove_html_files
|
52
|
+
delete_css_files if @remove_css_files
|
53
|
+
delete_tmp_pdf_files if @remove_tmp_pdf_files
|
54
|
+
end
|
55
|
+
|
30
56
|
def get_htmlarray
|
31
57
|
everything_after_last_slash(@urls)
|
32
58
|
end
|
@@ -83,13 +109,20 @@ class HtmlsToPdf
|
|
83
109
|
download_css_files
|
84
110
|
end
|
85
111
|
|
112
|
+
def save_url_to_savename(url, savename)
|
113
|
+
uri = URI.parse(url)
|
114
|
+
file_content = Net::HTTP.get_response(uri).body
|
115
|
+
File.open(savename, 'w') { |f| f.write(file_content) }
|
116
|
+
end
|
117
|
+
|
86
118
|
def download_html_files
|
87
119
|
existing_files = Dir.entries(".")
|
88
120
|
@htmlarray = []
|
89
121
|
@urls.each_with_index do |url,idx|
|
90
122
|
savename = TMP_HTML_PREFIX + idx.to_s
|
91
123
|
unless existing_files.include?(savename)
|
92
|
-
|
124
|
+
save_url_to_savename(url, savename)
|
125
|
+
#`wget #{url} -O #{savename}`
|
93
126
|
end
|
94
127
|
@htmlarray << savename
|
95
128
|
end
|
@@ -98,7 +131,10 @@ class HtmlsToPdf
|
|
98
131
|
def download_css_files
|
99
132
|
existing_files = Dir.entries(".")
|
100
133
|
@cssarray.each do |css_url|
|
101
|
-
|
134
|
+
savename = File.basename(css_url)
|
135
|
+
next if existing_files.include?(savename)
|
136
|
+
save_url_to_savename(css_url, savename)
|
137
|
+
#`wget #{css_url}` unless existing_files.include?(File.basename(css_url))
|
102
138
|
end
|
103
139
|
end
|
104
140
|
|
@@ -125,17 +161,17 @@ class HtmlsToPdf
|
|
125
161
|
end
|
126
162
|
end
|
127
163
|
|
128
|
-
def
|
129
|
-
@pdfarray.each { |pdffile| File.delete(pdffile) }
|
130
|
-
@htmlarray.each { |htmlfile| File.delete(htmlfile) }
|
131
|
-
@cssarray.each { |cssfile| File.delete(File.basename(cssfile)) }
|
164
|
+
def delete_tmp_pdf_files
|
165
|
+
@pdfarray.each { |pdffile| File.delete(pdffile) if File.exist?(File.basename(pdffile)) } unless @pdfarray.empty?
|
132
166
|
end
|
133
167
|
|
134
|
-
def
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
168
|
+
def delete_html_files
|
169
|
+
to_delete = Dir.glob("#{TMP_HTML_PREFIX}*")
|
170
|
+
to_delete.each { |f| File.delete(f) }
|
171
|
+
end
|
172
|
+
|
173
|
+
def delete_css_files
|
174
|
+
@cssarray.each { |cssfile| File.delete(File.basename(cssfile)) if File.exist?(File.basename(cssfile)) } unless @cssarray.empty?
|
139
175
|
end
|
140
176
|
|
141
177
|
end
|
data/lib/htmls_to_pdf/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "PDFKit configuration" do
|
4
|
+
it "has a binary at '/usr/bin/wkhtmltopdf'" do
|
5
|
+
File.exists?('/usr/bin/wkhtmltopdf').should be_true
|
6
|
+
end
|
7
|
+
it "its binary at '/usr/bin/wkhtmltopdf' is runnable by current user" do
|
8
|
+
File.executable?('/usr/bin/wkhtmltopdf').should be_true
|
9
|
+
end
|
10
|
+
it "has installed the 'pdfkit' gem" do
|
11
|
+
expect { require 'pdfkit' }.to_not raise_error
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,77 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmls_to_pdf
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- James Lavin
|
14
|
-
autorequire:
|
9
|
+
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-03-27 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: pdfkit
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
16
|
+
version_requirements: &2056 !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
26
18
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- 5
|
32
|
-
version: "0.5"
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
hash: 15
|
36
|
-
segments:
|
37
|
-
- 0
|
38
|
-
- 5
|
39
|
-
- 2
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.5'
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
40
23
|
version: 0.5.2
|
24
|
+
none: false
|
25
|
+
requirement: *2056
|
26
|
+
prerelease: false
|
41
27
|
type: :runtime
|
42
|
-
|
43
|
-
- !ruby/object:Gem::Dependency
|
28
|
+
- !ruby/object:Gem::Dependency
|
44
29
|
name: rspec
|
45
|
-
|
46
|
-
|
30
|
+
version_requirements: &2082 !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
47
35
|
none: false
|
48
|
-
|
49
|
-
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
hash: 3
|
52
|
-
segments:
|
53
|
-
- 0
|
54
|
-
version: "0"
|
36
|
+
requirement: *2082
|
37
|
+
prerelease: false
|
55
38
|
type: :development
|
56
|
-
version_requirements: *id002
|
57
39
|
description: Creates single PDF file from 1+ HTML pages using PDFKit
|
58
|
-
email:
|
40
|
+
email:
|
59
41
|
- htmls_to_pdf@futureresearch.com
|
60
42
|
executables: []
|
61
|
-
|
62
43
|
extensions: []
|
63
|
-
|
64
44
|
extra_rdoc_files: []
|
65
|
-
|
66
|
-
files:
|
45
|
+
files:
|
67
46
|
- .gitignore
|
68
47
|
- README.markdown
|
48
|
+
- examples/get_12factor.rb
|
49
|
+
- examples/get_bash_guide.rb
|
69
50
|
- examples/get_coffeescript.rb
|
51
|
+
- examples/get_coffeescript_cookbook.rb
|
70
52
|
- examples/get_coffeescript_meet_backbone.rb
|
71
53
|
- examples/get_exploring_coffeescript.rb
|
54
|
+
- examples/get_jumpstartlabs_advanced_rails.rb
|
55
|
+
- examples/get_little_book_on_coffeescript.rb
|
56
|
+
- examples/get_nlp_for_working_programmer.rb
|
57
|
+
- examples/get_practicing_ruby_vol_2.rb
|
72
58
|
- examples/get_python_book.rb
|
73
59
|
- examples/get_rails_3_1_release_notes.rb
|
60
|
+
- examples/get_ror_guides.rb
|
61
|
+
- examples/get_rspec.rb
|
62
|
+
- examples/get_rspec_rails.rb
|
74
63
|
- examples/get_ruby_book.rb
|
64
|
+
- examples/get_ruby_core_docs.rb
|
75
65
|
- examples/get_rubygems_user_guide.rb
|
76
66
|
- htmls_to_pdf.gemspec
|
77
67
|
- lib/htmls_to_pdf.rb
|
@@ -79,38 +69,31 @@ files:
|
|
79
69
|
- lib/htmls_to_pdf/pdfkit_config.rb
|
80
70
|
- lib/htmls_to_pdf/version.rb
|
81
71
|
- license.txt
|
82
|
-
|
72
|
+
- spec/ensure_pdfkit_installed_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage:
|
83
75
|
licenses: []
|
84
|
-
|
85
|
-
post_install_message:
|
76
|
+
post_install_message:
|
86
77
|
rdoc_options: []
|
87
|
-
|
88
|
-
require_paths:
|
78
|
+
require_paths:
|
89
79
|
- lib
|
90
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
91
85
|
none: false
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
- 0
|
98
|
-
version: "0"
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
100
91
|
none: false
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
hash: 3
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
version: "0"
|
108
92
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.8.15
|
95
|
+
signing_key:
|
113
96
|
specification_version: 3
|
114
97
|
summary: Creates single PDF file from 1+ HTML pages
|
115
98
|
test_files: []
|
116
|
-
|
99
|
+
...
|