Sha256: 3893ab547a751c411294b0f190e3ec8ed1e3daf820d4896e650a3a3e30439400

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

#!/usr/bin/env ratch

# install package to site_ruby

# This tool installs the package to site_ruby
# using Ruby's defualt configuration settings.
# If you want to change these you can can supply
# config settings for 'prefix' and/or 'sitedir'.

main :install do

  system_prefix = Config::CONFIG['prefix']
  system_libdir = Config::CONFIG['sitelibdir']

  config = config_load('install')

  prefix = config['prefix'] || system_prefix
  libdir = config['libdir']

  unless libdir
    if (prefix == system_prefix) then
      libdir = system_libdir
    else
      libdir = File.join(prefix, system_libdir[system_prefix.size..-1])
    end
  end

  # TODO Probably should get files from manifest, if it exists.
  # files = projectinfo.filelist
  files = Dir.glob("{lib,ext,bin}/**/*").select{ |f| File.file?(f) }

  lib_files  = files.grep(/^(lib|ext)/)
  bin_files  = files.grep(/^bin/)

  # Copy files to proper locations.

  lib_files.each do |file|
    dest = File.dirname(file).sub('lib/', '')
    dest = File.join(libdir, dest)
    #dest.sub!(/(core|more)\//, '')  # SPECIAL FOR FACETS !!!!!
    if noharm?
      puts "mkdir -p #{dest}"
      puts "install -m 0444 #{file} #{dest}"
    else
      mkdir_p dest unless File.directory?(dest)
      install file, dest, :mode => 0444
    end
  end

  bin_files.each do |file|
    dest = File.dirname(file)
    dest = File.join(prefix, dest)
    if noharm?
      puts "mkdir -p #{dest}"
      puts "install -m 0555 #{file} #{dest}"
    else
      mkdir_p dest unless File.directory?(dest)
      install file, dest, :mode => 0555
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-0.2.1 data/ratch/rubyproject/install2