#!/usr/bin/env ruby

require 'Ops'

def exit_failure( reason="", code=1 )
  puts reason; exit
end

bootstrap_files = [
  File.join( 'tasks', 'init.rb' ) ]

Rake.application.init( File.basename( $0 ) )

begin
  bootstrap_files.each do | f |
    File.join Ops::root_dir, f
    require f
  end
rescue => e
  puts e
end

bootstrap_files.each do | f |
  f = File.join Ops::pwd_dir, f
  require f if File.exists? f
end

begin
  Rake.application.top_level
rescue => e
  puts "Failed to call task: #{ e.message }"
end

exit
