File: install.rb

package info (click to toggle)
libdevel-logger-ruby 1.0.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 72 kB
  • ctags: 56
  • sloc: ruby: 397; makefile: 51
file content (39 lines) | stat: -rwxr-xr-x 821 bytes parent folder | download
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
38
39
#!/usr/bin/env ruby

require "rbconfig"
require "ftools"
include Config

RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
DSTPATH = CONFIG["sitedir"] + "/" +  RV 

def join( *arg )
  File.join( *arg )
end

def base( name )
  File.basename( name )
end

begin
  unless FileTest.directory?( "lib" )
    raise RuntimeError.new( "'lib' not found." )
  end
  unless FileTest.directory?( join( "lib", "devel" ))
    raise RuntimeError.new( "'lib/devel' not found." )
  end

  File.mkpath( join( DSTPATH, "devel" ), true )
  Dir[ 'lib/devel/*.rb' ].each do | name |
    File.install( name, join( DSTPATH, 'devel', base( name )), 0644, true )
  end
  Dir[ 'lib/*.rb' ].each do | name |
    File.install( name, join( DSTPATH, base( name )), 0644, true )
  end

  puts "install succeed!"

rescue 
  puts "install failed!"
  puts $!
end