rock_books 0.6.0 → 0.6.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
  SHA256:
3
- metadata.gz: 6a7c5d56c718ce58a0fdf060e25be5d3aaf5438ece48a76e02f912e09d203c39
4
- data.tar.gz: b467740538a5e89504fc7e2ac6b72190181519471f898a5c26ae7cfa29a53496
3
+ metadata.gz: 81be281ee187aa03b43808391235de30c85e05b7983e243a5df887ec6eb12b2b
4
+ data.tar.gz: 9069620c1ad95d22e35358caa4ed473899c7a897ad741f679047def6b6fee1e7
5
5
  SHA512:
6
- metadata.gz: b43529ffa215e13375538d173b939baf659b814dc07a85e7f6c9a695449a86a8dfe49d5134bca22b0c7a479d0707221c4d9bd87efdcef4ac9df95a815b148ca0
7
- data.tar.gz: 15776062f22eeb7ad746c303289512c9f81005f04f87518c1738d3923991d45a9ef32951b930946d2c746b6b7a6a52516892f4a8cbf5811ca2d58da4fadff2d5
6
+ metadata.gz: e67e7be616f654e5ed67e7f32836b03f56cdfc18821a7d0ee50570aadbb5cb65d0f288d0c4def2999ce2f32b150490e93aa0a6107a1995297b69d178e4ab9de9
7
+ data.tar.gz: 38819a0cfa909e3171705f11d3151bc2d128d0b946d6a31ff3cb1e6a7278e60670cb820c2fceb8e66be9891891a91dcd317079050675c1b2678b099d26b76676
data/README.md CHANGED
@@ -35,7 +35,7 @@ To simplify its implementation, RockBooks assumes some conventions:
35
35
 
36
36
  At this time, RockBooks is supported only on Mac OS and Linux. (It's really the external tools that is the issue, not the Ruby code.) It should probably work with Windows Subsystem for Linux (WSL) but it hasn't been tested. If you're unsuccessful trying to use RockBooks with WSL, give me as much information as possible and I'll try to resolve the issue.
37
37
 
38
- If you get an error message saying that an external command is missing, install that command using your system's package manager (e.g. `sudo apt install txt2html`).
38
+ If you get an error message saying that an external command is missing, install that command using your system's package manager (e.g. `sudo apt install txt2html`). For `wkhtmltopdf` on Linux, see [https://wkhtmltopdf.org/](https://wkhtmltopdf.org/).
39
39
 
40
40
  #### Text Files as Input
41
41
 
@@ -1,3 +1,7 @@
1
+ ### v0.6.1
2
+
3
+ * Linux PDF generation fixed by using wkhtmltopdf instead of cupsfilter.
4
+
1
5
  ### v0.6.0
2
6
 
3
7
  * Linux support added!
@@ -91,10 +91,10 @@ class BookSetReporter
91
91
 
92
92
  private def check_prequisite_executables
93
93
  raise "Report generation is not currently supported in Windows." if OS.windows?
94
- required_exes = OS.mac? ? %w(textutil cupsfilter) : %w(txt2html cupsfilter)
94
+ required_exes = OS.mac? ? %w(textutil cupsfilter) : %w(txt2html wkhtmltopdf)
95
95
  missing_exes = required_exes.reject { |exe| executable_exists?(exe) }
96
96
  if missing_exes.any?
97
- raise "Missing required report generation executable(s): #{missing_exes.join(', ')}"
97
+ raise "Missing required report generation executable(s): #{missing_exes.join(', ')}. Please install them with your system's package manager."
98
98
  end
99
99
  end
100
100
 
@@ -134,16 +134,15 @@ class BookSetReporter
134
134
 
135
135
  File.write(txt_filespec, report_text)
136
136
 
137
- # Linux & Mac OS
138
- cupsfilter = -> { run_command("cupsfilter #{txt_filespec} > #{pdf_filespec}") }
139
-
140
137
  # Mac OS
141
138
  textutil = ->(font_size) do
142
139
  run_command("textutil -convert html -font 'Courier New Bold' -fontsize #{font_size} #{txt_filespec} -output #{html_filespec}")
143
140
  end
141
+ cupsfilter = -> { run_command("cupsfilter #{txt_filespec} > #{pdf_filespec}") }
144
142
 
145
143
  # Linux
146
144
  txt2html = -> { run_command("txt2html --preformat_trigger_lines 0 #{txt_filespec} > #{html_filespec}") }
145
+ html2pdf = -> { run_command("wkhtmltopdf #{html_filespec} #{pdf_filespec}") }
147
146
 
148
147
  # Use smaller size for the PDF but larger size for the web pages:
149
148
  if OS.mac?
@@ -152,7 +151,7 @@ class BookSetReporter
152
151
  textutil.(14)
153
152
  else
154
153
  txt2html.()
155
- cupsfilter.()
154
+ html2pdf.()
156
155
  end
157
156
 
158
157
  hyperlinkized_text, replacements_made = HtmlHelper.convert_receipts_to_hyperlinks(File.read(html_filespec))
@@ -1,3 +1,3 @@
1
1
  module RockBooks
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print