Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rake tasks for building standalone tabula

  • Loading branch information...
commit ee0482da3ec4dfdeffc0535e996279701f25d2bb 1 parent aee18ae
@mtigas mtigas authored
View
3  .gitignore
@@ -7,8 +7,9 @@ tabula.war
TEST_PDFS
.DS_Store
-build/tabula.jar
build/Tabula.app
+build/tabula.jar
+build/tabula-*.zip
build/mac
build/windows
launch4j/
View
6 Gemfile
@@ -1,9 +1,15 @@
+#since war/jar bundle requires gem package; use gem-in-a-box for testing
+#or execute tabula via "rackup".
+#source "http://127.0.0.1:9292"
+
source "https://rubygems.org"
platform :jruby do
gem "cuba"
gem "rack"
gem "tilt"
gem "tabula-extractor", '~>0.5.1', :require => "tabula"
+ #gem "tabula-extractor", '~>0.6.0', :path => "../tabula-extractor"
+ #gem "tabula-extractor", '~>0.6.0', :require => "tabula", :git => 'git://github.com/mtigas/tabula-extractor.git', :ref => 'e1d3e9a'
group :development do
gem "rake"
View
18 LICENSE.md
@@ -1,7 +1,19 @@
Copyright (C) 2012-2013 Manuel Aristarán <jazzido@jazzido.com>
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
30 README.md
@@ -75,19 +75,10 @@ Tabula into a standalone application:
**Mac OS X**
- rake war
- ant macbundle
-
-Then, you will find a "Tabula.app" file in the `build/mac` directory. You can
-double-click this to run a hidden Tabula server that is viewble at http://127.0.0.1:8080/ .
-You will notice the Tabula server running in your Dock -- simply Quit that application to end
-the Tabula server. You can create a .zip archive of this by doing:
+ rake macosx
- # (from the root directory of the repo)
- cd build/mac
- zip -r9 tabula_mac.zip Tabula.app
-
-This will result in a portable "tabula_mac.zip" archive for Mac OS X users.
+This will result in a portable "tabula_mac.zip" archive (inside the `build` directory)
+for Mac OS X users.
**Windows**
@@ -98,7 +89,18 @@ Download a [3.1.X (beta) copy of Launch4J][1].
Unzip it into the Tabula repo so that "launch4j" (with subdirectories "bin", etc.)
is in the repository root.
-Then (these commands are for OS X/Linux and may need to be adjusted for Windows users):
+
+Then:
+
+ rake windows
+
+This will result in a portable "tabula_mac.zip" archive (inside the `build` directory)
+for Mac OS X users.
+
+---
+
+If you have issues, you can try building manually. (These commands are for
+OS X/Linux and may need to be adjusted for Windows users.)
# (from the root directory of the repo)
rake war
@@ -117,8 +119,6 @@ needs "tabula.jar" (contained in "build") in the same directory. You can create
zip -r9 tabula_win.zip tabula
rm -fr tabula
-This will result in a portable "tabula_win.zip" archive for Windows users.
-
[1]: http://sourceforge.net/projects/launch4j/files/launch4j-3/3.1.0-beta1/
## Contributing
View
137 Rakefile
@@ -1,11 +1,130 @@
+require 'fileutils'
require 'warbler'
+
+########## java jar compilation ##########
+
Warbler::Task.new("war",
- Warbler::Config.new { |config|
- config.features = %w(executable)
- config.jar_name = 'build/tabula'
- config.jar_extension = 'jar'
- config.webserver = "jetty"
- config.webxml.jruby.compat.version = "1.9"
- config.webxml.jruby.rack.logging = "stderr"
- config.dirs = ['lib', 'webapp']
- })
+ Warbler::Config.new { |config|
+ config.features = %w(executable)
+ config.jar_name = 'build/tabula'
+ config.jar_extension = 'jar'
+ config.webserver = "jetty"
+ config.webxml.jruby.compat.version = "1.9"
+ config.webxml.jruby.rack.logging = "stderr"
+ config.dirs = ['lib', 'webapp']
+ }
+)
+
+########## distribution bundles ##########
+
+
+task :macosx => [:war] do |t|
+ tabula_dir = File.expand_path(File.dirname(__FILE__))
+ build_dir = File.join(tabula_dir, "build")
+ dist_dir = File.join(build_dir, "mac", "tabula")
+
+ if File.exist?(File.join(build_dir, "mac"))
+ FileUtils.rm_rf(File.join(build_dir, "mac"))
+ end
+
+ puts "\n======================================================"
+ puts "Building Mac OS X app..."
+ puts "======================================================\n\n"
+ IO.popen("ant -v macbundle") { |f|
+ f.each { |line| puts line }
+ }
+
+ puts "\n======================================================"
+ puts "Creating zip file bundle..."
+ puts "======================================================\n\n"
+
+ Dir.mkdir(dist_dir)
+
+ app_src = File.join(build_dir, "mac", "Tabula.app")
+ app_dst = File.join(dist_dir, "Tabula.app")
+ FileUtils.mv(app_src, app_dst)
+
+ readme_src = File.join(build_dir, "dist-README.txt")
+ readme_dst = File.join(dist_dir, "README.txt")
+ FileUtils.cp(readme_src, readme_dst)
+
+ lic_src = File.join(build_dir, "dist-LICENSE.txt")
+ lic_dst = File.join(dist_dir, "LICENSE.txt")
+ FileUtils.cp(lic_src, lic_dst)
+
+ authors_src = File.join(tabula_dir, "AUTHORS.md")
+ authors_dst = File.join(dist_dir, "AUTHORS.txt")
+ FileUtils.cp(authors_src, authors_dst)
+
+ cd File.join(build_dir, "mac")
+ output = File.join(build_dir, "tabula-mac.zip")
+ if File.exists?(output)
+ File.delete(output)
+ end
+
+ IO.popen("zip -r9 #{output} tabula") { |f|
+ f.each { |line| puts line }
+ }
+ FileUtils.rm_rf(dist_dir)
+ puts "\n======================================================"
+ puts "Zip file saved to #{output}"
+ puts "======================================================\n\n"
+end
+
+
+task :windows => [:war] do |t|
+ tabula_dir = File.expand_path(File.dirname(__FILE__))
+ build_dir = File.join(tabula_dir, "build")
+ dist_dir = File.join(build_dir, "windows", "tabula")
+
+ if File.exist?(File.join(build_dir, "windows"))
+ FileUtils.rm_rf(File.join(build_dir, "windows"))
+ end
+
+ puts "\n======================================================"
+ puts "Building Windows executable..."
+ puts "======================================================\n\n"
+ cd File.join(File.expand_path(File.dirname(__FILE__)), "launch4j")
+ IO.popen("ant -f ../build.xml windows") { |f|
+ f.each { |line| puts line }
+ }
+ puts "\n======================================================"
+ puts "Creating zip file bundle..."
+ puts "======================================================\n\n"
+
+ Dir.mkdir(dist_dir)
+
+ app_src = File.join(build_dir, "windows", "tabula.exe")
+ app_dst = File.join(dist_dir, "tabula.exe")
+ FileUtils.mv(app_src, app_dst)
+
+ jar_src = File.join(build_dir, "tabula.jar")
+ jar_dst = File.join(dist_dir, "tabula.jar")
+ FileUtils.cp(jar_src, jar_dst)
+
+ readme_src = File.join(build_dir, "dist-README.txt")
+ readme_dst = File.join(dist_dir, "README.txt")
+ FileUtils.cp(readme_src, readme_dst)
+
+ lic_src = File.join(build_dir, "dist-LICENSE.txt")
+ lic_dst = File.join(dist_dir, "LICENSE.txt")
+ FileUtils.cp(lic_src, lic_dst)
+
+ authors_src = File.join(tabula_dir, "AUTHORS.md")
+ authors_dst = File.join(dist_dir, "AUTHORS.txt")
+ FileUtils.cp(authors_src, authors_dst)
+
+ cd File.join(build_dir, "windows")
+ output = File.join(build_dir, "tabula-win.zip")
+ if File.exists?(output)
+ File.delete(output)
+ end
+
+ IO.popen("zip -r9 #{output} tabula") { |f|
+ f.each { |line| puts line }
+ }
+ FileUtils.rm_rf(dist_dir)
+ puts "\n======================================================"
+ puts "Zip file saved to #{output}"
+ puts "======================================================\n\n"
+end
View
66 build/dist-LICENSE.txt
@@ -0,0 +1,66 @@
+tabula and tabula-extractor
+
+Copyright (C) 2012-2013 Manuel Aristarán <jazzido@jazzido.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+/*****************************************************************************/
+tabula-extractor -> pdfbox
+
+This product includes software (target/pdfbox-app-1.8.0.jar) developed at
+The Apache Software Foundation (http://www.apache.org/). Licensed under the
+Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).
+
+/*****************************************************************************/
+tabula-extractor -> ext/lsd.c
+
+ LSD - Line Segment Detector on digital images
+
+ This code is part of the following publication and was subject
+ to peer review:
+
+ "LSD: a Line Segment Detector" by Rafael Grompone von Gioi,
+ Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall,
+ Image Processing On Line, 2012. DOI:10.5201/ipol.2012.gjmr-lsd
+ http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd
+
+ Copyright (c) 2007-2011 rafael grompone von gioi <grompone@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Additional permission under GNU GPL version 3 section 7
+
+ If you modify this Program, or any covered work, by linking or
+ combining it with Tabula (or a modified version of that library),
+ containing parts covered by the terms of "MIT License", the
+ licensors of this Program grant you additional permission to convey
+ the resulting work. Corresponding Source for a non-source form of
+ such a combination shall include the source code for the parts of
+ Tabula used as well as that of the covered work.
View
12 build/dist-README.txt
@@ -0,0 +1,12 @@
+# Tabula
+
+Tabula helps you liberate data tables trapped inside PDF files.
+
+* Read more about Tabula on OpenNews Source:
+ https://source.mozillaopennews.org/en-US/articles/introducing-tabula/
+
+* See the GitHub project for source code, bug reports, and more:
+ https://github.com/jazzido/tabula
+
+© 2012-2013 Manuel Aristarán. Available under MIT License.
+See `AUTHORS.txt` and `LICENSE.txt`.
Please sign in to comment.
Something went wrong with that request. Please try again.