bin/ebooks in twitter_ebooks-2.0.2 vs bin/ebooks in twitter_ebooks-2.0.3

- old
+ new

@@ -28,19 +28,21 @@ end log "New twitter_ebooks app created at #{target}" end - def self.consume(path) - filename = File.basename(path) - shortname = filename.split('.')[0..-2].join('.') - hash = Digest::MD5.hexdigest(File.read(path)) + def self.consume(pathes) + pathes.each do |path| + filename = File.basename(path) + shortname = filename.split('.')[0..-2].join('.') + hash = Digest::MD5.hexdigest(File.read(path)) - log "Consuming text corpus: #{filename}" - outpath = File.join(APP_PATH, 'model', "#{shortname}.model") - Model.consume(path).save(outpath) - log "Corpus consumed" + log "Consuming text corpus: #{filename}" + outpath = File.join(APP_PATH, 'model', "#{shortname}.model") + Model.consume(path).save(outpath) + log "Corpus consumed" + end end def self.gen(model_path, input) require 'benchmark' model = nil; @@ -59,11 +61,11 @@ end def self.command(args) usage = """Usage: ebooks new <reponame> - ebooks consume <corpus_path> + ebooks consume <corpus_path> [...] ebooks gen <model> [input] ebooks archive <@user> <outpath> """ if args.length == 0 @@ -71,10 +73,10 @@ exit end case args[0] when "new" then new(args[1]) - when "consume" then consume(args[1]) + when "consume" then consume(args[1..-1]) when "gen" then gen(args[1], args[2..-1].join(' ')) when "archive" then archive(args[1], args[2]) end end end