twitter_ebooks 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/ebooks CHANGED
@@ -30,15 +30,17 @@ module Ebooks
30
30
  log "New twitter_ebooks app created at #{target}"
31
31
  end
32
32
 
33
- def self.consume(path)
34
- filename = File.basename(path)
35
- shortname = filename.split('.')[0..-2].join('.')
36
- hash = Digest::MD5.hexdigest(File.read(path))
37
-
38
- log "Consuming text corpus: #{filename}"
39
- outpath = File.join(APP_PATH, 'model', "#{shortname}.model")
40
- Model.consume(path).save(outpath)
41
- log "Corpus consumed"
33
+ def self.consume(pathes)
34
+ pathes.each do |path|
35
+ filename = File.basename(path)
36
+ shortname = filename.split('.')[0..-2].join('.')
37
+ hash = Digest::MD5.hexdigest(File.read(path))
38
+
39
+ log "Consuming text corpus: #{filename}"
40
+ outpath = File.join(APP_PATH, 'model', "#{shortname}.model")
41
+ Model.consume(path).save(outpath)
42
+ log "Corpus consumed"
43
+ end
42
44
  end
43
45
 
44
46
  def self.gen(model_path, input)
@@ -61,7 +63,7 @@ module Ebooks
61
63
  def self.command(args)
62
64
  usage = """Usage:
63
65
  ebooks new <reponame>
64
- ebooks consume <corpus_path>
66
+ ebooks consume <corpus_path> [...]
65
67
  ebooks gen <model> [input]
66
68
  ebooks archive <@user> <outpath>
67
69
  """
@@ -73,7 +75,7 @@ module Ebooks
73
75
 
74
76
  case args[0]
75
77
  when "new" then new(args[1])
76
- when "consume" then consume(args[1])
78
+ when "consume" then consume(args[1..-1])
77
79
  when "gen" then gen(args[1], args[2..-1].join(' '))
78
80
  when "archive" then archive(args[1], args[2])
79
81
  end
@@ -76,7 +76,7 @@ module Ebooks
76
76
  meta = {}
77
77
  mentions = ev.attrs[:entities][:user_mentions].map { |x| x[:screen_name] }
78
78
 
79
- reply_mentions = mentions.reject { |m| m.downcase == @username }
79
+ reply_mentions = mentions.reject { |m| m.downcase == @username.downcase }
80
80
  reply_mentions << ev[:user][:screen_name]
81
81
 
82
82
  meta[:reply_prefix] = reply_mentions.uniq.map { |m| '@'+m }.join(' ') + ' '
@@ -91,7 +91,7 @@ module Ebooks
91
91
  # - The tweet mentions list contains our username
92
92
  # - The tweet is not being retweeted by somebody else
93
93
  # - Or soft-retweeted by somebody else
94
- if mentions.map(&:downcase).include?(@username) && !ev[:retweeted_status] && !ev[:text].start_with?('RT ')
94
+ if mentions.map(&:downcase).include?(@username.downcase) && !ev[:retweeted_status] && !ev[:text].start_with?('RT ')
95
95
  log "Mention from #{ev[:user][:screen_name]}: #{ev[:text]}"
96
96
  @on_mention.call(ev, meta)
97
97
  else
@@ -1,3 +1,3 @@
1
1
  module Ebooks
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_ebooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: