CommandWrap 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/bin/wkhtmltopdf +0 -0
- data/lib/command_wrap.rb +6 -0
- data/tests/unit/command_wrap_test.rb +11 -1
- metadata +4 -3
data/README
CHANGED
data/bin/wkhtmltopdf
ADDED
Binary file
|
data/lib/command_wrap.rb
CHANGED
@@ -9,6 +9,12 @@ module CommandWrap
|
|
9
9
|
`#{command}`
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.htmltopdf (source, target)
|
13
|
+
command = CommandWrap::Config::Xvfb.command(File.dirname(__FILE__) + "/../bin/wkhtmltopdf --print-media-type #{source} #{target}")
|
14
|
+
puts command
|
15
|
+
`#{command}`
|
16
|
+
end
|
17
|
+
|
12
18
|
# Sources consists of paths followed by the filename that must be used in the zip
|
13
19
|
def self.zip (target, *sources)
|
14
20
|
targetdir = "#{CommandWrap::Config.tmp_dir}/zip"
|
@@ -85,10 +85,20 @@ class CommandWrapTest < Test::Unit::TestCase
|
|
85
85
|
def test_preview_mpg
|
86
86
|
source = File.dirname(__FILE__) + "/../helpers/test.mpg"
|
87
87
|
target = CommandWrap.temp('png')
|
88
|
-
File.delete(target) if File.exists?(target)
|
89
88
|
assert_nothing_raised do
|
90
89
|
assert_equal false, CommandWrap.preview(source, target, 160, 200)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
93
|
+
def test_htmltopdf
|
94
|
+
sleep 1
|
95
|
+
source = File.dirname(__FILE__) + "/../helpers/test.html"
|
96
|
+
target = CommandWrap.temp('pdf')
|
97
|
+
assert_nothing_raised do
|
98
|
+
CommandWrap.htmltopdf(source, target)
|
99
|
+
assert File.exists?(target)
|
100
|
+
File.delete(target)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
94
104
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CommandWrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Stefaan Colman
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- tests/helpers/pdf2.pdf
|
71
71
|
- tests/test_helper.rb
|
72
72
|
- README
|
73
|
+
- bin/wkhtmltopdf
|
73
74
|
- bin/CutyCapt
|
74
75
|
- bin/openoffice_server.rb
|
75
76
|
- bin/DocumentConverter.py
|