bin/jsus in jsus-0.2.5 vs bin/jsus in jsus-0.2.6
- old
+ new
@@ -1,12 +1,21 @@
#!/usr/bin/env ruby
require 'rubygems'
-if File.exists?('./lib/jsus.rb') # override with local version of jsus
- $:.unshift File.expand_path(Dir.pwd) + "/lib"
-elsif File.exists?(File.expand_path(File.dirname(__FILE__)) + "/../lib/jsus.rb")
- $:.unshift File.expand_path(File.dirname(__FILE__)) + "/../lib"
+require 'pathname'
+begin
+ gem_home = Pathname.new(ENV["GEM_HOME"]).realpath.to_s
+ current_dir = File.dirname(Pathname.new(__FILE__).realpath.to_s)
+ if current_dir.index(gem_home) != 0 && File.exists?(current_dir + '/../lib/jsus.rb')
+ # If we are outside gem home,
+ # override whatever they got there
+ # with local version of jsus
+ $:.unshift File.expand_path(current_dir + "/../lib")
+ end
+rescue Exception => e
+ # Something weird happened during our checks,
+ # but it's probably nothing.
end
require 'jsus'
require "fileutils"
require "optparse"
@@ -127,11 +136,11 @@
package.generate_scripts_info(output_dir) unless options[:without_scripts_info]
package.generate_tree(output_dir) unless options[:without_tree_info]
# Validations
-validators_map = {"mooforge" => Jsus::Validator::Mooforge}
+validators_map = {"mooforge" => Jsus::Util::Validator::Mooforge}
(options[:validators] || []).each do |validator_name|
if validator = validators_map[validator_name]
errors = validator.new(pool.sources.to_a & package.source_files.to_a).validation_errors
unless errors.empty?
puts "Validator #{validator_name} found errors: "
@@ -162,10 +171,10 @@
end
docs_start_time = Time.now
# Generate documentation
if options[:documented_classes] && !options[:documented_classes].empty?
- documenter = Jsus::Documenter.new(:highlight_source => !options[:no_syntax_highlight])
+ documenter = Jsus::Util::Documenter.new(:highlight_source => !options[:no_syntax_highlight])
package.source_files.each {|source| documenter << source }
pool.sources.each {|source| documenter << source } if pool
documenter.only(options[:documented_classes]).generate(output_dir + "/docs")
end
docs_finish_time = Time.now