module Hoe::Compiler

def activate_compiler_deps

def activate_compiler_deps
  dependency "rake-compiler", "~> 1.0", :development
  gem "rake-compiler", "~> 1.0"
rescue LoadError
  warn "Couldn't load rake-compiler. Skipping. Run `rake newb` to fix."
end

def define_compiler_tasks

def define_compiler_tasks
  require "rake/extensiontask"
  @extensions.each do |name|
    clean_globs << "lib/#{name}/*.{so,bundle,dll}"
    Rake::ExtensionTask.new name, spec do |ext|
      ext.lib_dir = File.join(*["lib", name.to_s, ENV["FAT_DIR"]].compact)
    end
  end
  compile_tasks.each do |t|
    task t => :compile
  end
rescue LoadError
  warn "Couldn't load rake-compiler. Skipping. Run `rake newb` to fix."
end

def extension name

def extension name
  @extensions ||= []
  @extensions << name
  spec_extras[:extensions] = @extensions.map { |n| "ext/#{n}/extconf.rb" }
end

def initialize_compiler

def initialize_compiler
  self.compile_tasks = [:multi, :test, :check_manifest]
end