Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 55 lines (43 sloc) 1.38 KB
#!/usr/bin/env nake
# encoding: utf-8
# Make sure symlinks to this file work.
real_bin_path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
root_directory = File.expand_path(File.join(File.dirname(real_bin_path), ".."))
lib_directory = File.join(root_directory, "lib")
# In development environment we want to use ./lib.
unless $LOAD_PATH.include?(lib_directory)
$LOAD_PATH.unshift(lib_directory)
end
require "nake"
require "apiary/commands/preview"
Nake.verbose = false
Nake.args["-H", "--help"] = lambda do |*|
puts
Nake::Task.tasks.each do |name, task|
puts "#{File.basename(__FILE__)} #{name} # #{task.description}"
end
exit
end
# Hack around RubyGems that reportedly ignore nake shebang
unless File.basename($0) == "nake"
# Not using the shebang results in different ARGV.
ARGV.unshift("./bin/apiary")
# This code is not cool. I have to finish nake first.
begin
#Nake.run(ARGV)
begin
Nake.run_task
rescue Nake::TaskNotFound => exception
abort exception.message
rescue SystemExit => exception
exit exception.status
rescue Exception => exception
require "nake/helpers"
print_exception_with_backtrace_and_abort(exception)
end
# exit with exit status of the last command
exit $? ? $?.exitstatus : 0
rescue Nake::TaskNotFound => exception
abort "[#{"ERROR".red}] #{exception.message}"
end
end
Something went wrong with that request. Please try again.