# # Commandline launcher for Dokkit, (c)2006 Andrea Fazzi (and contributors) # # Get set up with library paths, however we're installed. def croak puts "Cannot locate Dokkit libraries - Do you need to set $DOKKIT_LIB ?" exit(1) end begin require 'rubygems' rescue LoadError # just ignore, don't use gems end fail = false dokkit_lib = nil begin require 'dokkit' require 'dokkit/app' # find this later dokkit_lib = nil rescue LoadError unless fail || !(dokkit_lib = ENV['DOKKIT_LIB']) $: << dokkit_lib # at least we can know this now... builtin = File.join(dokkit_lib,'dokkit/builtin.rake') fail = true # next time. retry else croak end end # If we're loaded via RubyGems or some such we need to locate # the builtin rakefile. unless dokkit_lib $:.each { |it| if File.exists?(File.join(it,'dokkit/builtin.rake')) dokkit_lib = it break end } end croak unless dokkit_lib Dokkit::Application.new(dokkit_lib).run