html2pdf 0.1.4 → 0.1.5

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: 335aeb69b88513c0a02f400ee06d51f9029122a4
4
- data.tar.gz: e220337ebb73e4f8a1f1e128c0063291fd3a43c0
3
+ metadata.gz: 522905634a26ce2a180d99732a475a059f65d467
4
+ data.tar.gz: 5f360241a7dfdea808e8b54d7bb019e1bb648ce9
5
5
  SHA512:
6
- metadata.gz: a8ab0bd17f2a051be0cd955ed2e607c18ce5e9cf0477def12835a8ba7709fd529a43e76a3fe90364bb1356680f414bd66d115d3f2b0c1cb88e2d5171e3028769
7
- data.tar.gz: 7554df1c05e6819296494e9c6034354763b03b50153357ff8b2c76dad0818a9aabd3f97e495c7089114d62ea604006da5f9d3f157261a8b012c9f01d86569bcf
6
+ metadata.gz: 0971a4bda8d572df5cf6dc6242a53beeab584e3f025ea307290114d908ccfeda9dfeb5a029f10239d271ca8608cc1618409b2bdc55528059e976c9c7c932bdec
7
+ data.tar.gz: 7b78f1851660d073aa7672a0871795b2fba53286e9002be1b69d503be156fc02968d6260429d6ae47299da525a34472e7b92456f0029e605cdccb7a5ec068753
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ### Html2Pdf - Changelogs
1
+ ### Changelogs for html2pdf
2
+
3
+ #### 0.1.5
4
+
5
+ - Minor code cleanup
2
6
 
3
7
  #### 0.1.4
4
8
 
data/Rakefile CHANGED
@@ -1,8 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
-
4
3
  project_name = "html2pdf"
5
-
6
4
  Rake::TestTask.new do |t|
7
5
  t.libs << "lib/#{project_name}"
8
6
  t.test_files = FileList["test/lib/#{project_name}/test_*.rb"]
data/lib/html2pdf/cli.rb CHANGED
@@ -32,7 +32,7 @@ module Html2Pdf
32
32
  Html2Pdf.to_pdfs(input_files)
33
33
  end
34
34
 
35
- generated_files = AgileUtils::FileUtil.add_suffix(input_files, "pdf")
35
+ generated_files = add_suffix(input_files, "pdf")
36
36
  AgileUtils::FileUtil.tar_gzip_files(generated_files, "html2pdf-output.tar.gz")
37
37
  AgileUtils::FileUtil.delete(generated_files)
38
38
 
@@ -50,7 +50,7 @@ Options:
50
50
  -b, [--base-dir=BASE_DIR] # Base directory
51
51
  # Default: . (current directory)
52
52
  -r, [--recursive], [--no-recursive] # Search for files recursively
53
- # Default: true
53
+ # Default: --recursive
54
54
  -v, [--version], [--no-version] # Display version information
55
55
 
56
56
  export multiple html files to pdfs
@@ -58,5 +58,17 @@ export multiple html files to pdfs
58
58
  end
59
59
 
60
60
  default_task :usage
61
+
62
+ private
63
+
64
+ # Add suffix to each extensions
65
+ #
66
+ # @param [Array<String>] extensions list of extension
67
+ # @param [String] suffix the suffix string
68
+ #
69
+ # @return [Array<String>] new list with the suffix added to each element
70
+ def add_suffix(extensions = [], suffix)
71
+ extensions.map { |e| "#{e}.#{suffix}" }
72
+ end
61
73
  end
62
74
  end
@@ -1,7 +1,6 @@
1
1
  require "open3"
2
2
  require "fileutils"
3
3
  require_relative "../html2pdf"
4
-
5
4
  module Html2Pdf
6
5
  class << self
7
6
  # Batch convert to pdf using `wkhtmltopdf` tool
@@ -20,6 +19,7 @@ module Html2Pdf
20
19
  # @param filename input filename
21
20
  def to_pdf(filename)
22
21
  fail "Invalid input file #{filename}" unless File.exist?(filename)
22
+ # TODO: allow custom configuration
23
23
  command = [
24
24
  "wkhtmltopdf",
25
25
  "--margin-top 4",
@@ -40,8 +40,7 @@ module Html2Pdf
40
40
  fail "Problem processing #{filename}" unless status.success?
41
41
  end
42
42
 
43
- # Check and verify that the proper softwares are available.
44
- #
43
+ # Check and return if the 'wkhtmltopdf' is available
45
44
  def softwares_installed?
46
45
  AgileUtils::Helper.which("wkhtmltopdf")
47
46
  end
@@ -1,3 +1,3 @@
1
1
  module Html2Pdf
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor