#!/usr/bin/env ruby lib = File.expand_path('../../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'rubygems' require 'fileutils' require 'open-uri' require 'jena_jruby/version.rb' LATEST_JENA="http://www-us.apache.org/dist/jena/binaries/apache-jena-#{Jena::JENA_VERSION}.zip" OUTPUT="downloads/jena-#{Jena::JENA_VERSION}.zip" FileUtils.mkdir_p "downloads" unless File.exist? OUTPUT puts "Downloading Jena #{Jena::JENA_VERSION}..." open( LATEST_JENA ) do |url| File.open( OUTPUT,"wb" ) do |file| file.puts url.read end end puts 'Download completed.' else puts 'Data file already exists, skipping download.' end raise 'Program `unzip\' is not present in the operation system.' if `unzip`.empty? `unzip -jo #{OUTPUT} **/lib/*.jar -d javalib` puts "Writing lib/jena_jruby/jars.rb ..." r = File.open( 'lib/jena_jruby/jars.rb', 'w' ) Dir.glob( 'javalib/*.jar' ).each do |f| f =~ /javalib\/(.*)\.jar/ r << "require '#{$1}'\n" end r.close