Sha256: 8b19a496f919d9a3fa7f55e2abf3868b4f590256ec2541aa7e67bf9417992b22
Contents?: true
Size: 892 Bytes
Versions: 32
Compression:
Stored size: 892 Bytes
Contents
#! /usr/bin/env ruby require 'getoptlong' require 'rbconfig' require 'ftools' require 'find' SRC_BASE = 'lib' SRC = 'gratr' INSTDIR = File.join Config::CONFIG['sitedir'] DESTDIR = File.join INSTDIR, SRC opts = GetoptLong.new( [ "--uninstall", "-u", GetoptLong::NO_ARGUMENT ] ) def install begin File.makedirs( DESTDIR ) pwd = Dir.pwd Dir.chdir(SRC_BASE) Dir['*.rb'].each do |file| dst = File.join( INSTDIR, file ) File.install(file, dst, 0644, true) end Find.find(SRC) do |file| dst = File.join( INSTDIR, file ) File.install(file, dst, 0644, true) if file =~ /.rb$/ end Dir.chdir(pwd) rescue puts $! end end def uninstall begin puts "Deleting:" Find.find(DESTDIR) { |file| File.rm_f file,true } Dir.delete DESTDIR rescue end end if (opt = opts.get) and opt[0] =~ /^-?-u/ uninstall else install end
Version data entries
32 entries across 32 versions & 5 rubygems