lib/inochi/inochi.rb in inochi-0.0.0 vs lib/inochi/inochi.rb in inochi-0.0.1
- old
+ new
@@ -94,11 +94,11 @@
@already_seen << project_module
# put project on Ruby load path
project_file = File.expand_path(first_caller_file)
project_libs = File.dirname(project_file)
- $LOAD_PATH.unshift project_libs
+ $LOAD_PATH << project_libs unless $LOAD_PATH.include? project_libs
# supply configuration defaults
project_config[:project] ||= project_symbol.to_s
project_config[:tagline] ||= ''
project_config[:version] ||= '0.0.0'
@@ -144,10 +144,13 @@
# and formatted in YAML fashion for easy consumption by other tools.
#
# * A list of command-line options is displayed at
# the bottom of the program's help information.
#
+ # It is assumed that this method is invoked from only within
+ # the main project executable (in the project bin/ directory).
+ #
# @param [Symbol] project_symbol
# Name of the Ruby constant which serves
# as a namespace for the entire project.
#
# @param trollop_args
@@ -158,15 +161,14 @@
#
# @return The result of Trollop::options().
#
def main project_symbol, *trollop_args, &trollop_config
program_file = first_caller_file
+ program_name = File.basename(program_file)
program_home = File.dirname(File.dirname(program_file))
# load the project module
- program_name = File.basename(program_home)
-
require File.join(program_home, 'lib', program_name)
project_module = fetch_project_module(project_symbol)
# parse command-line options
require 'trollop'
@@ -602,10 +604,10 @@
gem.files = FileList['**/*'].exclude('_darcs') - CLEAN
gem.executables = project_module::PROGRAM
gem.has_rdoc = true
unless project_module == Inochi
- gem.add_dependency 'inochi', Inochi::VERSION
+ gem.add_dependency 'inochi', "~> #{Inochi::VERSION[/^\d+/]}"
end
project_module::REQUIRE.each_pair do |gem_name, version_reqs|
gem.add_dependency gem_name, *version_reqs
end