# Magic Rollerball Installer # # PROJECT_NAME = 'multiton' PROJECT_VERSION = '2.1.0' ################## require 'fileutils' require 'rbconfig' include FileUtils::DryRun rubyprefix = Config::CONFIG['prefix'] sitelibdir = Config::CONFIG['sitelibdir'] PREFIX = ENV['PREFIX'] || rubyprefix RUBYLIB = if PREFIX == rubyprefix then sitelibdir else File.join(PREFIX, sitelibdir[rubyprefix.size..-1]) end ROLLLIB = File.join(File.dirname(RUBYLIB), "rolls", File.basename(RUBYLIB)) RUBY_DEBUG = ENV['RUBY_DEBUG'] RUBY_FLAGS = ENV['RUBY_FLAGS'] || "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" + (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '') p PREFIX p RUBYLIB p ROLLLIB #p RUBY_DEBUG #p RUBY_FLAGS HERE = File.expand_path(File.dirname(__FILE__)) DEST = File.join(ROLLLIB, PROJECT_NAME, PROJECT_VERSION) files = Dir.glob("**/*") files -= Dir.glob("INSTALL") files -= Dir.glob("pkg/**/*") + ['pkg'] p HERE p DEST p files mkdir_p DEST unless test ?d, DEST # Install libs def project_install(files) bin_files = files.grep(/^bin/) (files - bin_files).each do |file| install file, DEST, :mode => 0444 end bin_files.each do |file| install file, DEST, :mode => 0555 end end # Change modes def project_chmod(files) bin_files = Files.grep(/^bin/) (files - bin_files).each do |file| chmod File.join(DEST, file), 0444 end bin_files.each do |file| chmod File.join(DEST, file), 0555 end end if HERE == DEST project_chmod(files) else project_install(files) end