wycats-ufo 0.5.0

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Yehuda Katz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,5 @@
1
+ UFO
2
+ ===
3
+
4
+ A gem that provides a Ruby binding to the flying saucer Java library for creating PDFs out
5
+ of HTML and CSS.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rubygems/specification'
4
+ require 'date'
5
+
6
+ GEM = "ufo"
7
+ GEM_VERSION = "0.5.0"
8
+ AUTHOR = "Yehuda Katz"
9
+ EMAIL = "wycats@gmail.com"
10
+ HOMEPAGE = "http://yehudakatz.com"
11
+ SUMMARY = "A gem that provides a Ruby binding to the Java flying saucer library"
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = GEM
15
+ s.version = GEM_VERSION
16
+ s.platform = Gem::Platform::RUBY
17
+ s.has_rdoc = true
18
+ s.extra_rdoc_files = ["README.markdown", "LICENSE"]
19
+ s.summary = SUMMARY
20
+ s.description = s.summary
21
+ s.author = AUTHOR
22
+ s.email = EMAIL
23
+ s.homepage = HOMEPAGE
24
+
25
+ # Uncomment this to add a dependency
26
+ s.add_dependency "thor"
27
+
28
+ s.bindir = "bin"
29
+ s.executables = "make_pdf"
30
+
31
+ s.require_path = 'lib'
32
+ s.autorequire = GEM
33
+ s.files = %w(LICENSE README.markdown Rakefile) + Dir.glob("{lib,specs}/**/*")
34
+ end
35
+
36
+ Rake::GemPackageTask.new(spec) do |pkg|
37
+ pkg.gem_spec = spec
38
+ end
39
+
40
+ desc "install the gem locally"
41
+ task :install => [:package] do
42
+ sh %{sudo #{Gem.ruby} -S gem install pkg/#{GEM}-#{GEM_VERSION}}
43
+ end
44
+
45
+ desc "create a gemspec file"
46
+ task :make_spec do
47
+ File.open("#{GEM}.gemspec", "w") do |file|
48
+ file.puts spec.to_ruby
49
+ end
50
+ end
data/bin/make_pdf ADDED
@@ -0,0 +1,19 @@
1
+ require "rubygems"
2
+ require "thor"
3
+ require "flying_saucer"
4
+
5
+ class Saucer < Thor
6
+
7
+ desc "fly", "create a PDF"
8
+ def fly(input, output = "out.pdf")
9
+ puts "Rendering PDF..."
10
+ input_file = "#{File.expand_path(input)}"
11
+ File.open(output, 'w') do |file|
12
+ ITextRenderer.new.make_pdf(input, file)
13
+ end
14
+ puts "Done."
15
+ end
16
+
17
+ end
18
+
19
+ Saucer.start
@@ -0,0 +1,7 @@
1
+ require "java"
2
+ require "flying_saucer/core-renderer"
3
+ require "flying_saucer/itext_renderer"
4
+
5
+ import org.jruby.util.IOOutputStream
6
+
7
+ java.lang.System.set_property("java.awt.headless", "true")
Binary file
@@ -0,0 +1,10 @@
1
+ require "flying_saucer/itext-paulo-155"
2
+ import org.xhtmlrenderer.pdf.ITextRenderer
3
+
4
+ class ITextRenderer
5
+ def make_pdf(input, file)
6
+ self.document = "file:#{File.expand_path(input)}"
7
+ self.layout
8
+ self.create_pdf(IOOutputStream.new(file))
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wycats-ufo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Yehuda Katz
8
+ autorequire: ufo
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-14 00:00:00 -07:00
13
+ default_executable: make_pdf
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thor
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: A gem that provides a Ruby binding to the Java flying saucer library
26
+ email: wycats@gmail.com
27
+ executables:
28
+ - make_pdf
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.markdown
33
+ - LICENSE
34
+ files:
35
+ - LICENSE
36
+ - README.markdown
37
+ - Rakefile
38
+ - lib/flying_saucer
39
+ - lib/flying_saucer/core-renderer.jar
40
+ - lib/flying_saucer/itext-paulo-155.jar
41
+ - lib/flying_saucer/itext_renderer.rb
42
+ - lib/flying_saucer.rb
43
+ - bin/make_pdf
44
+ has_rdoc: false
45
+ homepage: http://yehudakatz.com
46
+ post_install_message:
47
+ rdoc_options: []
48
+
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.2.0
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: A gem that provides a Ruby binding to the Java flying saucer library
70
+ test_files: []
71
+