my_ebook_pub 0.1.1 → 0.2.1

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: a0ace64431505899e46b43330ab0dfdf2478f38c
4
- data.tar.gz: ff62f40f8561dcd98820863715b3d0bfc38e6733
3
+ metadata.gz: 6a06eb3ff127fd4efffdf46678175c82186e2068
4
+ data.tar.gz: 684132c3a4ced2b5463babc3f075f78f98e0d793
5
5
  SHA512:
6
- metadata.gz: fa664e5ce3ba84db5eb5aed8e66d89a128342185940fb4f22744bedb1f47ca2d9f08321b0eee8f40545290c2f447fb82b50bf274669f131803904a6f01bf3c6b
7
- data.tar.gz: 43969dbb7945c8a956896f10424562a987b120fff71b6f225f06d33621ed2f4a3bee67f7e96bf61ae7057ce9869876ad6c7783c79e7e13841bbb12228edbaa94
6
+ metadata.gz: 35c2acef8ac97e6858293e805e0d8fc7cd458512056909271689ce2d9264f99078ea1605155590884630d69bdc1da455848b722fac2546f78fb13a1e9b5c64af
7
+ data.tar.gz: 14fe780e1786fdabdad85fc9033e4340be7a7934baff9aac4b1b0d3b26bbad4753ed1552c79387c95d5ef2046481a988863d1b2ab6dca95f2a185ce290316199
data/README.md CHANGED
@@ -24,7 +24,11 @@ Or install it yourself as:
24
24
  > pub
25
25
  Usage:
26
26
  pub new
27
- pub generate
27
+ pub generate filetype
28
+
29
+ options:
30
+ If no filetype specified, pdf will be used
31
+ Available file types: pdf, epub, mobi
28
32
  ```
29
33
 
30
34
  ### New
@@ -69,6 +73,14 @@ Assets
69
73
  > pub generate
70
74
  Generating PDF to output directory...
71
75
  Your file is ready. See ./output/render.pdf
76
+
77
+ > pub generate epub
78
+ Generating PDF to output directory...
79
+ Your file is ready. See ./output/render.epub
80
+
81
+ > pub generate mobi
82
+ Generating PDF to output directory...
83
+ Your file is ready. See ./output/render.mobi
72
84
  ```
73
85
 
74
86
  ## Contributing
@@ -0,0 +1,57 @@
1
+ /* This defines styles and classes used in the book */
2
+ body { margin-left: 5%; margin-right: 5%; margin-top: 5%; margin-bottom: 5%; text-align: justify; font-size: medium; }
3
+ code { font-family: monospace; }
4
+ h1 { text-align: center; }
5
+ h2 { text-align: center; }
6
+ h3 { text-align: center; }
7
+ h4 { text-align: center; }
8
+ h5 { text-align: center; }
9
+ h6 { text-align: center; }
10
+ h1.title { }
11
+ h2.author { }
12
+ h3.date { }
13
+ /* For source-code highlighting */
14
+
15
+ h1, h2, h3, h4 {
16
+ -webkit-hyphens: none;
17
+ hyphens: none;
18
+ adobe-hyphenate: none;
19
+ }
20
+
21
+ pre.sourceCode {
22
+ white-space: pre-wrap;
23
+ font-family: monospace;
24
+ font-size: 85%;
25
+ display: block;
26
+ -webkit-hyphens: none;
27
+ hyphens: none;
28
+ adobe-hyphenate: none;
29
+ }
30
+
31
+ code.sourceCode {
32
+ white-space: pre-wrap;
33
+ font-family: monospace;
34
+ font-size: 85%;
35
+ display: block;
36
+ -webkit-hyphens: none;
37
+ hyphens: none;
38
+ adobe-hyphenate: none;
39
+ }
40
+
41
+ table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
42
+ { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
43
+ td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
44
+ td.sourceCode { padding-left: 5px; }
45
+ code.sourceCode span.kw { color: #007020; font-weight: bold; }
46
+ code.sourceCode span.dt { color: #902000; }
47
+ code.sourceCode span.dv { color: #40a070; }
48
+ code.sourceCode span.bn { color: #40a070; }
49
+ code.sourceCode span.fl { color: #40a070; }
50
+ code.sourceCode span.ch { color: #4070a0; }
51
+ code.sourceCode span.st { color: #4070a0; }
52
+ code.sourceCode span.co { color: #60a0b0; font-style: italic; }
53
+ code.sourceCode span.ot { color: #007020; }
54
+ code.sourceCode span.al { color: red; font-weight: bold; }
55
+ code.sourceCode span.fu { color: #06287e; }
56
+ code.sourceCode span.re { }
57
+ code.sourceCode span.er { color: red; font-weight: bold; }
@@ -0,0 +1,6 @@
1
+ <dc:title>The Selenium Guidebook Java Edition: How To Use Selenium, successfully</dc:title>
2
+ <dc:language>en-US</dc:language>
3
+ <dc:rights>Copyright (c) 2015 Dave Haeffner. All rights reserved.</dc:rights>
4
+ <dc:creator>Dave Haeffner</dc:creator>
5
+ <dc:author>Dave Haeffner</dc:author>
6
+ <dc:date>2015-02-10</dc:date>
data/bin/pub CHANGED
@@ -1,7 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'fileutils'
4
3
 
4
+ def parse_options
5
+ options = ''
6
+ if ARGV[1]
7
+ options = ARGV[1]
8
+ else
9
+ options = 'pdf'
10
+ end
11
+ options
12
+ end
13
+
5
14
  case ARGV[0]
6
15
  when 'new'
7
16
  STDOUT.puts 'Creating new pub directory structure...'
@@ -18,12 +27,16 @@ when 'new'
18
27
  when 'generate', 'gen'
19
28
  STDOUT.puts 'Generating PDF to output directory...'
20
29
  require 'my_ebook_pub'
21
- MyEbookPub.generate
22
- STDOUT.puts 'Your file is ready. See ./output/render.pdf'
30
+ MyEbookPub.generate parse_options
31
+ STDOUT.puts "Your file is ready. See ./output/render.#{parse_options}"
23
32
  else
24
33
  STDOUT.puts <<-EOF
25
34
  Usage:
26
35
  pub new
27
- pub generate
36
+ pub generate filetype
37
+
38
+ options:
39
+ If no filetype specified, pdf will be used
40
+ Available file types: pdf, epub, mobi
28
41
  EOF
29
42
  end
@@ -1,3 +1,3 @@
1
1
  module MyEbookPub
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.1'
3
3
  end
data/lib/my_ebook_pub.rb CHANGED
@@ -104,21 +104,50 @@ HERE
104
104
  @renderer_content.render(raw_content)
105
105
  end
106
106
 
107
- def generate # to PDF
107
+ def generate(file_type)
108
108
  @location = 'content'
109
109
  @content = cover + preface + toc + content
110
110
  html = ERB.new(@template).result(binding)
111
111
  product_name = 'render'
112
- File.open("output/#{product_name}.pdf", 'w+') do |f|
113
- f.write(Docverter::Conversion.run do |c|
114
- c.from = 'html'
115
- c.to = 'pdf'
116
- c.content = html
117
- Dir.glob('assets/*') do |asset|
118
- c.add_other_file asset
119
- end
120
- end)
112
+
113
+ case file_type
114
+ when 'pdf'
115
+ File.open("output/#{product_name}.pdf", 'w+') do |file|
116
+ file.write(Docverter::Conversion.run do |c|
117
+ c.from = 'html'
118
+ c.to = 'pdf'
119
+ c.content = html
120
+ Dir.glob('assets/*') do |asset|
121
+ c.add_other_file asset
122
+ end
123
+ end)
124
+ end
125
+ when 'epub'
126
+ File.open("output/#{product_name}.epub", 'w+') do |file|
127
+ file.write(Docverter::Conversion.run do |c|
128
+ c.from = 'markdown'
129
+ c.to = 'epub'
130
+ c.content = raw_content
131
+ c.epub_metadata = 'metadata.xml'
132
+ c.epub_stylesheet = 'epub.css'
133
+ c.add_other_file 'assets/epub.css'
134
+ c.add_other_file 'assets/metadata.xml'
135
+ end)
136
+ end
137
+ when 'mobi'
138
+ File.open("output/#{product_name}.mobi", 'w+') do |file|
139
+ file.write(Docverter::Conversion.run do |c|
140
+ c.from = 'markdown'
141
+ c.to = 'mobi'
142
+ c.content = raw_content
143
+ c.epub_metadata = 'metadata.xml'
144
+ c.epub_stylesheet = 'epub.css'
145
+ c.add_other_file 'assets/epub.css'
146
+ c.add_other_file 'assets/metadata.xml'
147
+ end)
148
+ end
121
149
  end
150
+
122
151
  end
123
152
 
124
153
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_ebook_pub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Haeffner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,6 +109,8 @@ files:
109
109
  - README.md
110
110
  - Rakefile
111
111
  - bin/assets/droid_sans.ttf
112
+ - bin/assets/epub.css
113
+ - bin/assets/metadata.xml
112
114
  - bin/assets/template.erb
113
115
  - bin/pub
114
116
  - lib/my_ebook_pub.rb