Sha256: 50468dd9ada2ad7ccca025cf97e20a6d9f6b95513586018ba474424e3ad9d995
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
# Copyright (c) 2016-2017 Minqi Pan # # This file is part of Ruby Compiler, distributed under the MIT License # For full terms see the included LICENSE file require 'shellwords' require 'tmpdir' require 'fileutils' require 'json' require 'open3' module Ruby class Compiler module Utils class << self def run(*args) STDERR.puts "-> Running #{args}" pid = spawn(*args) pid, status = Process.wait2(pid) raise Error, "Failed running #{args}" unless status.success? end def chdir(path) STDERR.puts "-> cd #{path}" Dir.chdir(path) { yield } STDERR.puts "-> cd #{Dir.pwd}" end def prepare_tmpdir(tmpdir) STDERR.puts "-> FileUtils.mkdir_p(#{tmpdir})" FileUtils.mkdir_p(tmpdir) Dir[::Ruby::Compiler::VENDOR_DIR + '/*'].each do |dirpath| target = File.join(tmpdir, File.basename(dirpath)) unless Dir.exist?(target) STDERR.puts "-> FileUtils.cp_r(#{dirpath}, #{target})" FileUtils.cp_r(dirpath, target) end end end def remove_dynamic_libs(path) ['dll', 'dylib', 'so'].each do |extname| Dir["#{path}/**/*.#{extname}"].each do |x| STDERR.puts "-> FileUtils.rm_f #{x}" FileUtils.rm_f(x) end end end def copy_static_libs(path, target) ['lib', 'a'].each do |extname| Dir["#{path}/*.#{extname}"].each do |x| STDERR.puts "-> FileUtils.cp #{x}, #{target}" FileUtils.cp(x, target) end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-compiler-0.1.1 | lib/ruby/compiler/utils.rb |