Sha256: 4bbcf97ba7cb04c231f90532bcbf28d885d5aead363157e6514f09b785ee8afc

Contents?: true

Size: 1.86 KB

Versions: 54

Compression:

Stored size: 1.86 KB

Contents

require 'rbconfig'
require 'find'
require 'fileutils'
require 'tempfile'

include RbConfig

$ruby = CONFIG['ruby_install_name']

##
# Install a binary file. We patch in on the way through to
# insert a #! line. If this is a Unix install, we name
# the command (for example) 'rake' and let the shebang line
# handle running it. Under windows, we add a '.rb' extension
# and let file associations do their stuff
#

def installBIN(from, opfile)

  tmp_file = Tempfile.new("_tmp")

  File.open(from) do |ip|
    File.open(tmp_file, "w") do |op|
      ruby = File.join($realbindir, $ruby)
      op.puts "#!#{ruby} -w"
      op.write ip.read
    end
  end

  opfile += ".rb" if CONFIG["target_os"] =~ /mswin/i
  FileUtils.install(tmp_file, File.join($bindir, opfile),
    {:mode => 0755, :verbose => true})
  tmp_file.unlink
end

$sitedir = CONFIG["sitelibdir"]
unless $sitedir
  version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
  $libdir = File.join(CONFIG["libdir"], "ruby", version)
  $sitedir = $:.find {|x| x =~ /site_ruby/}
  if !$sitedir
    $sitedir = File.join($libdir, "site_ruby")
  elsif $sitedir !~ Regexp.quote(version)
    $sitedir = File.join($sitedir, version)
  end
end

$bindir = CONFIG["bindir"]

$realbindir = $bindir

if (destdir = ENV['DESTDIR'])
  $bindir  = destdir + $bindir
  $sitedir = destdir + $sitedir

  FileUtils.mkdir_p($bindir)
  FileUtils.mkdir_p($sitedir)
end

rake_dest = File.join($sitedir, "rake")
FileUtils.mkdir_p(rake_dest, {:verbose => true})
File.chmod(0755, rake_dest)

# The library files

files = Dir.chdir('lib') { Dir['**/*.rb'].sort }

for fn in files
  fn_dir = File.dirname(fn)
  target_dir = File.join($sitedir, fn_dir)
  if ! File.exist?(target_dir)
    FileUtils.mkdir_p(target_dir)
  end
  FileUtils.install(File.join('lib', fn), File.join($sitedir, fn),
    {:mode => 0644, :verbose => true})
end

# and the executable

installBIN("bin/rake", "rake")

Version data entries

54 entries across 53 versions & 11 rubygems

Version Path
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/install.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.2.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.2.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.2.0 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.0.3 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.0.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
bundle_depot-0.0.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/install.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/install.rb
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/install.rb
syllable_counter-1.0.0 vendor/bundle/gems/rake-10.1.0/install.rb
challah-1.0.0 vendor/bundle/gems/rake-10.1.0/install.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/install.rb
rake-10.1.0 install.rb