module RakeCompile

Constants

VERSION

Public Class Methods

compiler_for_source(source, flags=nil) click to toggle source
# File lib/rake-compile/compiler.rb, line 2
def self.compiler_for_source(source, flags=nil)
  cpp_flags = cc_flags = flags

  if flags.is_a? Hash
    cpp_flags = flags[:cpp_flags]
    cc_flags = flags[:cc_flags]
  end

  case File.extname(source)
  when '.cpp', '.cc', '.hpp'
    "c++ #{cpp_flags}"
  when ".c", ".h"
    "cc #{cc_flags}"
  else
    raise("Don't know how to compile #{source}")
  end
end
install(src, dst) click to toggle source
# File lib/rake-compile/install.rb, line 2
def self.install(src, dst)
  RakeCompile.log("INSTALL".yellow, dst)
  FileUtils.rm_f(dst)
  FileUtils.cp(src, dst)
end
log(key, msg) click to toggle source
# File lib/rake-compile/logging.rb, line 2
def self.log(key, msg)
  puts "[#{key}] #{msg}"
end
uninstall(path) click to toggle source
# File lib/rake-compile/install.rb, line 7
def self.uninstall(path)
  RakeCompile.log("UNINSTALL".yellow, path)
  FileUtils.rm_rf(path)
end