Sha256: 05ee44ad49183278dd850bce1ce6a4e97d3d5ac27bcccc90fb1d4d1a34398d33

Contents?: true

Size: 1.74 KB

Versions: 7

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")

require "nake"
require "nake/args"
require "nake/helpers"

# parse arguments
begin
  Nake.parse
rescue Exception => exception
  puts "~ Arguments parsed into #{Nake.parse.inspect.green}"
  puts "Exception occured during parsing arguments"
  print_exception_with_backtrace_and_abort(exception)
else
  if Nake.parse[:nake] && Nake.parse[:nake].include?("--debug") # Nake.debug isn't initialized yet
    puts "~ Arguments parsed into #{Nake.parse.inspect.green}"
  end
end

# load task file
if Nake.parse[:file]
  begin
    load Nake.parse[:file]
  rescue Exception => exception
    print_exception_with_backtrace_and_abort(exception)
  end
elsif File.exist?("tasks.rb")
  # default value, useful when running nake on systems without
  # shebang support, so you are using nake -T instead of ./tasks.rb -T
  Nake.parse[:file] = "tasks.rb"
else
  abort "You have to specify a file with tasks"
end

# run arguments
# yes, arguments has to run after the task file is loaded
begin
  original_args = Nake.parse.dup
  Nake.run_args
rescue SystemExit => exception
  exit exception.status
rescue Exception => exception
  puts "~ Arguments parsed into #{Nake.parse.inspect.green}"
  puts "Exception occured setting nake flags"
  print_exception_with_backtrace_and_abort(exception)
else
  if Nake.debug && Nake.parse != original_args
    puts "~ Arguments changed into #{Nake.parse.inspect.green}"
  end
end

# run tasks
begin
  Nake.run_task
rescue TaskNotFound => exception
  abort exception.message
rescue SystemExit => exception
  exit exception.status
rescue Exception => exception
  print_exception_with_backtrace_and_abort(exception)
end

# exit with exit status of the last command
exit $? ? $?.exitstatus : 0

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
nake-0.0.9.4 bin/nake
nake-0.0.9.3 bin/nake
nake-0.0.9.2 bin/nake
nake-0.0.9.pre bin/nake
do_riak-0.10.1.pre gems/gems/nake-0.0.8/bin/nake
nake-0.0.8.pre bin/nake
nake-0.0.8 bin/nake