lib/yard/cli/command.rb in yard-0.7.5 vs lib/yard/cli/command.rb in yard-0.8.0
- old
+ new
@@ -32,10 +32,13 @@
end
opts.on('--legacy', 'Use old style Ruby parser and handlers. ',
' Always on in 1.8.x.') do
YARD::Parser::SourceParser.parser_type = :ruby18
end
+ opts.on('--safe', 'Enable safe mode for this instance') do
+ # Parsed in YARD::Config.load
+ end
opts.on_tail('-q', '--quiet', 'Show no warnings.') { log.level = Logger::ERROR }
opts.on_tail('--verbose', 'Show more information.') { log.level = Logger::INFO }
opts.on_tail('--debug', 'Show debugging information.') { log.level = Logger::DEBUG }
opts.on_tail('--backtrace', 'Show stack traces') { log.show_backtraces = true }
opts.on_tail('-v', '--version', 'Show version.') { puts "yard #{YARD::VERSION}"; exit }
@@ -54,17 +57,17 @@
log.warn "Unrecognized/#{err.message}"
args.shift if args.first && args.first[0,1] != '-'
retry
end
- # Loads a Ruby script. If +Config.options[:safe_mode]+ is enabled,
+ # Loads a Ruby script. If <tt>Config.options[:safe_mode]</tt> is enabled,
# this method will do nothing.
#
# @param [String] file the path to the script to load
# @since 0.6.2
def load_script(file)
return if YARD::Config.options[:safe_mode]
- require(file.gsub(/\.rb$/, ''))
+ load(file)
rescue LoadError => load_exception
log.error "The file `#{file}' could not be loaded:\n#{load_exception}"
exit
end
end
\ No newline at end of file