#!/usr/bin/env ratch # install package to site_ruby # # This tool installs the package to site_ruby # using Ruby's defualt configuration settings. # If you want to change these you can can supply # config settings for 'prefix' and/or 'sitedir'. main :install do system_prefix = Config::CONFIG['prefix'] system_libdir = Config::CONFIG['sitelibdir'] config = config_load('install') prefix = config['prefix'] || system_prefix libdir = config['libdir'] unless libdir if (prefix == system_prefix) then libdir = system_libdir else libdir = File.join(prefix, system_libdir[system_prefix.size..-1]) end end # TODO Probably should get files from manifest, if it exists. # files = projectinfo.filelist files = Dir.glob("{lib,ext,bin}/**/*").select{ |f| File.file?(f) } lib_files = files.grep(/^(lib|ext)/) bin_files = files.grep(/^bin/) # Copy files to proper locations. lib_files.each do |file| dest = File.dirname(file).sub('lib/', '') dest = File.join(libdir, dest) #dest.sub!(/(core|more)\//, '') # SPECIAL FOR FACETS !!!!! if noharm? puts "mkdir -p #{dest}" puts "install -m 0444 #{file} #{dest}" else mkdir_p dest unless File.directory?(dest) install file, dest, :mode => 0444 end end bin_files.each do |file| dest = File.dirname(file) dest = File.join(prefix, dest) if noharm? puts "mkdir -p #{dest}" puts "install -m 0555 #{file} #{dest}" else mkdir_p dest unless File.directory?(dest) install file, dest, :mode => 0555 end end end