lib/indexer/command.rb in indexer-0.1.0 vs lib/indexer/command.rb in indexer-0.2.0

- old
+ new

@@ -24,19 +24,19 @@ # # def run(argv=ARGV) cmd = nil args = cli(argv, - '-d --debug' => lambda{ $DEBUG = true }, - '-w --warn' => lambda{ $VERBOSE = true }, - '-f --force' => lambda{ @force = true }, - '-o --stdout' => lambda{ @stdout = true }, - '-s --static' => lambda{ @static = true }, - '-u --using' => lambda{ no_cmd!(cmd); cmd = :using }, - '-a --adding' => lambda{ no_cmd!(cmd); cmd = :adding }, - '-g --generate' => lambda{ no_cmd!(cmd); cmd = :generate }, - '-h --help' => lambda{ no_cmd!(cmd); cmd = :help } + '-u --using' => lambda{ no_cmd!(cmd); cmd = :using }, + '-a --adding' => lambda{ no_cmd!(cmd); cmd = :adding }, + '-g --generate' => lambda{ no_cmd!(cmd); cmd = :generate }, + '-w --webserver' => lambda{ no_cmd!(cmd); cmd = :webserver }, + '-h --help' => lambda{ no_cmd!(cmd); cmd = :help }, + '-d --debug' => lambda{ $DEBUG = true; $VERBOSE = true }, + '-f --force' => lambda{ @force = true }, + '-o --stdout' => lambda{ @stdout = true }, + '-s --static' => lambda{ @static = true } ) send(cmd || :show, *args) rescue => error raise error if $DEBUG $stderr.puts "#{File.basename($0)} error: #{error}" @@ -101,19 +101,26 @@ raise Error.exception("unknown file type") end end # + def webserver + require 'indexer/webui' + Indexer::WebUI::Server.start(ARGV) + end + + # def help puts <<-END index [command-option] [options...] [arguments...] (none) [fields...] update index and provide information from index -u --using <sources...> create index using given information sources -a --adding <sources...> update index appending additional information sources -r --remove <sources...> update index removing given information sources -g --generate <type> [fname] generate a file (gemspec, indexfile, metadata) + -w --webserver (experimental) edit .index file via web interface -h --help show this help message -o --stdout output to console instead of saving to file -f --force force protected file overwrite if file already exists or is up to date -s --static keep index as is or generate static format if generator supports it @@ -130,12 +137,11 @@ if File.exist?(outfile) && !(@stdout or @force) raise Error.exception("#{outfile} file already exists", IOError) end - template_dir = File.join(DATADIR, "r#{REVISION}") - template_file = File.join(template_dir, 'ruby.txt') + template_file = File.join(DATADIR, 'ruby.txt') if Metadata.exists? metadata = Metadata.open else metadata = Metadata.new @@ -166,11 +172,10 @@ if File.exist?(outfile) && !(@stdout or @force) raise Error.exception("#{outfile} file already exists", IOError) end - template_dir = File.join(DATADIR, "r#{REVISION}") - template_file = File.join(template_dir, 'yaml.txt') + template_file = File.join(DATADIR, 'yaml.txt') if Metadata.exists? metadata = Metadata.open else metadata = Metadata.new