Sha256: 0f87a203ab136721d58952d58f065f78fac746ae3d40eea9e28cfd2b2f577cf5

Contents?: true

Size: 890 Bytes

Versions: 5

Compression:

Stored size: 890 Bytes

Contents

#! /usr/bin/env ruby

require 'getoptlong'
require 'rbconfig'
require 'ftools'
require 'find'

SRC_BASE = 'lib'
SRC = 'rgl'


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

5 entries across 5 versions & 1 rubygems

Version Path
rgl-0.2.2 install.rb
rgl-0.2.3 install.rb
rgl-0.3.0 install.rb
rgl-0.3.1 install.rb
rgl-0.4.0 install.rb