Sha256: b6f0e0e734720bc6b17626e4a9f26e688b3fc63d7ec32ff3690732027f5e3b9e

Contents?: true

Size: 1.56 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
ratch-0.3.0 work/scrap/install.1
ratch-0.2.2 dev/install.1