CommandWrap 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -3,7 +3,7 @@ A set of utility classes to extract meta data from different file types
3
3
  INSTALL
4
4
  -------
5
5
 
6
- gem install fileutils
6
+ gem install CommandWrap
7
7
 
8
8
  REQUIREMENTS
9
9
  ------------
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: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
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