Pistos / rip forked from defunkt/rip

Ruby's Intelligent Packaging

This URL has Read+Write access

rip / setup.rb
100644 37 lines (29 sloc) 0.662 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# installs rip like so:
# ruby setup.rb
#
# also uninstalls rip like so:
# ruby setup.rb uninstall
#
# probably requires sudo.
#
 
__DIR__ = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(__DIR__, 'lib')
 
require "rip"
 
include Rip::Setup
 
# TODO: Use, like, real option parsing. --rue
 
%w( bindir libdir ripdir ).each do |opt|
  if given = ARGV.grep(/--#{opt}=\S+/).last
    Rip::Setup.const_set(opt.upcase, File.expand_path(given.split("=").last))
  end
end
 
if ARGV.include? 'uninstall'
  uninstall :verbose
elsif ARGV.include? 'reinstall'
  uninstall
  install
elsif installed?
  puts "rip: already installed"
else
  install
end