Sha256: 12d188ff9d5cf4acf6dbdf20f89cd148d06478b38ffc310315ed60a010367481

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

#!/usr/bin/env ruby

require 'rake'

rakefiles = %w[rakefile Rakefile rakefile.rb Rakefile.rb]

if rakefiles.none? { |f| File.exist?(f) } && !ARGV.include?('-f') && !ARGV.include?('--rakefile')
  require 'tmpdir'
  require 'fileutils'

  # syntethize a Rakefile
  tmpdir = Dir.mktmpdir
  rakefile = File.join(tmpdir, 'Rakefile')
  File.open(rakefile, 'w') do |f|
    f.puts 'require "chake"'
  end
  ARGV.unshift << '--rakefile' << rakefile

  # cleanup after finishing
  at_exit do
    FileUtils.rm_rf tmpdir
  end
end

class Rake::Application
  alias orig_thread_pool thread_pool
  def thread_pool # :nodoc:
    if Chake.respond_to?(:nodes)
      @thread_pool ||= Rake::ThreadPool.new(Chake.nodes.size + 1)
    else
      orig_thread_pool
    end
  end
end

Rake.application.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chake-0.91 bin/chake