Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 2642bbac51
Fetching contributors…

Cannot retrieve contributors at this time

90 lines (77 sloc) 1.796 kb
module Main
# top level constants
#
Main::VERSION = '5.1.0' unless
defined? Main::VERSION
def self.version() Main::VERSION end
Main::LIBDIR = File.join(File.dirname(File.expand_path(__FILE__)), self.name.downcase, '') unless
defined? Main::LIBDIR
def self.libdir() Main::LIBDIR end
Main::EXIT_SUCCESS = 0 unless defined? Main::EXIT_SUCCESS
Main::EXIT_FAILURE = 1 unless defined? Main::EXIT_FAILURE
Main::EXIT_WARN = 42 unless defined? Main::EXIT_WARN
Main::EXIT_WARNING = 42 unless defined? Main::EXIT_WARNING
## deps
#
def Main.dependencies
{
'chronic' => [ 'chronic' , '>= 0.6.2' ] ,
'fattr' => [ 'fattr' , '>= 2.2.0' ] ,
'arrayfields' => [ 'arrayfields' , '>= 4.7.4' ] ,
'map' => [ 'map' , '>= 5.1.0' ]
}
end
def Main.libdir(*args, &block)
@libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
args.empty? ? @libdir : File.join(@libdir, *args)
ensure
if block
begin
$LOAD_PATH.unshift(@libdir)
block.call()
ensure
$LOAD_PATH.shift()
end
end
end
def Main.load(*libs)
libs = libs.join(' ').scan(/[^\s+]+/)
Main.libdir{ libs.each{|lib| Kernel.load(lib) } }
end
end
# built-in
#
require 'logger'
require 'enumerator'
require 'set'
require 'uri'
require 'time'
require 'date'
# use gems to pick up dependancies
#
begin
require 'rubygems'
rescue LoadError
42
end
if defined?(gem)
Main.dependencies.each do |lib, dependency|
gem(*dependency)
require(lib)
end
end
# main's own libs
#
Main.load %w[
stdext.rb
softspoken.rb
util.rb
logger.rb
usage.rb
cast.rb
parameter.rb
getoptlong.rb
mode.rb
program.rb
factories.rb
]
Jump to Line
Something went wrong with that request. Please try again.