[DRE-commits] [SCM] atig.git branch, master, updated. upstream/0.3.4-8-gfb81aa4
Youhei SASAKI
uwabami at gfd-dennou.org
Mon Jul 2 09:38:13 UTC 2012
The following commit has been merged in the master branch:
commit fb81aa44b40fe8b94e15092f133dc43a8b5d5a3a
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date: Thu Jun 28 00:55:47 2012 +0900
Import upstream bugfixes
Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
diff --git a/debian/patches/0001-Remove-Bundler-and-Rubygems-Dependencies.patch b/debian/patches/0001-Remove-Bundler-and-Rubygems-Dependencies.patch
index d889c53..31c22dc 100644
--- a/debian/patches/0001-Remove-Bundler-and-Rubygems-Dependencies.patch
+++ b/debian/patches/0001-Remove-Bundler-and-Rubygems-Dependencies.patch
@@ -14,20 +14,16 @@ Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
spec/spec_helper.rb | 10 +++++-----
8 files changed, 5 insertions(+), 12 deletions(-)
-diff --git a/lib/atig/bitly.rb b/lib/atig/bitly.rb
-index 4675954..0046f25 100644
---- a/lib/atig/bitly.rb
-+++ b/lib/atig/bitly.rb
+--- atig.orig/lib/atig/bitly.rb
++++ atig/lib/atig/bitly.rb
@@ -1,5 +1,4 @@
# -*- mode:ruby; coding:utf-8 -*-
-require 'rubygems'
require 'json'
require 'atig/http'
-diff --git a/lib/atig/db/sql.rb b/lib/atig/db/sql.rb
-index ccf0b4d..df425b1 100644
---- a/lib/atig/db/sql.rb
-+++ b/lib/atig/db/sql.rb
+--- atig.orig/lib/atig/db/sql.rb
++++ atig/lib/atig/db/sql.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
@@ -35,10 +31,8 @@ index ccf0b4d..df425b1 100644
require 'sqlite3'
module Atig
-diff --git a/lib/atig/db/statuses.rb b/lib/atig/db/statuses.rb
-index 4080d48..e753651 100644
---- a/lib/atig/db/statuses.rb
-+++ b/lib/atig/db/statuses.rb
+--- atig.orig/lib/atig/db/statuses.rb
++++ atig/lib/atig/db/statuses.rb
@@ -1,7 +1,6 @@
# -*- mode:ruby; coding:utf-8 -*-
require 'atig/db/listenable'
@@ -47,38 +41,30 @@ index 4080d48..e753651 100644
require 'sqlite3'
require 'atig/db/roman'
require 'atig/db/sql'
-diff --git a/lib/atig/monkey.rb b/lib/atig/monkey.rb
-index ec5a652..c7cdfab 100644
---- a/lib/atig/monkey.rb
-+++ b/lib/atig/monkey.rb
+--- atig.orig/lib/atig/monkey.rb
++++ atig/lib/atig/monkey.rb
@@ -1,4 +1,3 @@
-require 'rubygems'
require 'net/irc'
# monkey hack
-diff --git a/lib/atig/oauth.rb b/lib/atig/oauth.rb
-index cd7c2d0..58b7cd0 100644
---- a/lib/atig/oauth.rb
-+++ b/lib/atig/oauth.rb
+--- atig.orig/lib/atig/oauth.rb
++++ atig/lib/atig/oauth.rb
@@ -1,5 +1,4 @@
# -*- mode:ruby; coding:utf-8 -*-
-require 'rubygems'
require 'oauth'
require 'atig/oauth-patch'
-diff --git a/lib/atig/search.rb b/lib/atig/search.rb
-index 26ccdba..6947e50 100644
---- a/lib/atig/search.rb
-+++ b/lib/atig/search.rb
+--- atig.orig/lib/atig/search.rb
++++ atig/lib/atig/search.rb
@@ -1,4 +1,3 @@
-require 'rubygems'
require 'json'
require 'atig/http'
require 'atig/url_escape'
-diff --git a/lib/atig/stream.rb b/lib/atig/stream.rb
-index 5f1360d..a30e090 100644
---- a/lib/atig/stream.rb
-+++ b/lib/atig/stream.rb
+--- atig.orig/lib/atig/stream.rb
++++ atig/lib/atig/stream.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
@@ -86,10 +72,8 @@ index 5f1360d..a30e090 100644
require 'json'
require 'uri'
require 'logger'
-diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
-index 6658fc7..aebee1b 100644
---- a/spec/spec_helper.rb
-+++ b/spec/spec_helper.rb
+--- atig.orig/spec/spec_helper.rb
++++ atig/spec/spec_helper.rb
@@ -1,9 +1,9 @@
# -*- mode:ruby; coding:utf-8 -*-
-require 'rubygems'
diff --git a/debian/patches/0002-Update-and-Fix-README.mkdn.patch b/debian/patches/0002-Update-and-Fix-README.mkdn.patch
new file mode 100644
index 0000000..a027715
--- /dev/null
+++ b/debian/patches/0002-Update-and-Fix-README.mkdn.patch
@@ -0,0 +1,24 @@
+From: Yamagishi Kazutoshi <ykzts at desire.sh>
+Date: Sun, 27 May 2012 10:36:35 +0000
+Subject: Update and Fix README.mkdn
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+---
+ README.mkdn | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- atig.orig/README.mkdn
++++ atig/README.mkdn
+@@ -21,9 +21,9 @@
+
+ You type:
+
+- $ cd atig
+- $ ruby atig.rb -d
+- I, [2010-04-05T07:22:07.861527 #62002] INFO -- : Host: localhost Port:16668
++ $ cd atig
++ $ bin/atig -d
++ I, [2010-04-05T07:22:07.861527 #62002] INFO -- : Host: localhost Port:16668
+
+ and access localhost:16668 by Irc client.
+
diff --git a/debian/patches/0003-Userstream-should-work.patch b/debian/patches/0003-Userstream-should-work.patch
new file mode 100644
index 0000000..6471d23
--- /dev/null
+++ b/debian/patches/0003-Userstream-should-work.patch
@@ -0,0 +1,158 @@
+From: Tomonori Tamagawa <xtuaok at gmail.com>
+Date: Mon, 28 May 2012 13:52:49 +0900
+Subject: Userstream should work
+
+ - update Userstream API endpoint
+ - disable DM,Mention and Timeline agent when opts.stream is true
+ - use OAuth and HTTPS::Get for userstream session.
+---
+ lib/atig/agent/dm.rb | 1 +
+ lib/atig/agent/mention.rb | 5 ++++-
+ lib/atig/agent/timeline.rb | 5 ++++-
+ lib/atig/gateway/session.rb | 2 +-
+ lib/atig/oauth.rb | 1 +
+ lib/atig/option.rb | 2 +-
+ lib/atig/stream.rb | 47 +++++++++++++++++++++----------------------
+ 7 files changed, 35 insertions(+), 28 deletions(-)
+
+--- atig.orig/lib/atig/agent/dm.rb
++++ atig/lib/atig/agent/dm.rb
+@@ -7,6 +7,7 @@
+ include Util
+
+ def initialize(context, api, db)
++ return if context.opts.stream
+ @log = context.log
+ @api = api
+ @prev = nil
+--- atig.orig/lib/atig/agent/mention.rb
++++ atig/lib/atig/agent/mention.rb
+@@ -4,7 +4,10 @@
+ module Atig
+ module Agent
+ class Mention < Atig::Agent::Agent
+- def initialize(context, api, db); super end
++ def initialize(context, api, db)
++ return if context.opts.stream
++ super
++ end
+ def interval; 180 end
+ def path; '/statuses/mentions' end
+ def source; :mention end
+--- atig.orig/lib/atig/agent/timeline.rb
++++ atig/lib/atig/agent/timeline.rb
+@@ -4,7 +4,10 @@
+ module Atig
+ module Agent
+ class Timeline < Atig::Agent::Agent
+- def initialize(context, api, db); super end
++ def initialize(context, api, db)
++ return if context.opts.stream
++ super
++ end
+ def interval; 30 end
+ def path; '/statuses/home_timeline' end
+ def source; :timeline end
+--- atig.orig/lib/atig/gateway/session.rb
++++ atig/lib/atig/gateway/session.rb
+@@ -138,7 +138,7 @@
+ log :debug, "initialize Twitter"
+ twitter = Twitter.new context, oauth.access
+ search = SearchTwitter.new context
+- stream = Stream.new context, @nick, at pass if @opts.stream
++ stream = Stream.new context, oauth.oauth, oauth.access if @opts.stream
+ @api = Scheduler.new context, twitter, search, stream
+
+ log :debug, "initialize filter"
+--- atig.orig/lib/atig/oauth.rb
++++ atig/lib/atig/oauth.rb
+@@ -19,6 +19,7 @@
+ end
+
+ attr_reader :access
++ attr_reader :oauth
+ def initialize(context, nick)
+ uri = URI(context.opts.api_base)
+ site = "http://#{uri.host}"
+--- atig.orig/lib/atig/option.rb
++++ atig/lib/atig/option.rb
+@@ -30,7 +30,7 @@
+ end
+
+ default_value :api_base, 'https://api.twitter.com/1/'
+- default_value :stream_api_base, 'http://chirpstream.twitter.com/2b/'
++ default_value :stream_api_base, 'https://userstream.twitter.com/2/'
+ default_value :search_api_base, 'http://search.twitter.com/'
+
+ def initialize(table)
+--- atig.orig/lib/atig/stream.rb
++++ atig/lib/atig/stream.rb
+@@ -12,11 +12,11 @@
+ include Util
+
+ class APIFailed < StandardError; end
+- def initialize(context, user, password)
++ def initialize(context, consumer, access)
+ @log = context.log
+ @opts = context.opts
+- @user = user
+- @password = password
++ @consumer = consumer
++ @access = access
+ end
+
+ def watch(path, query={}, &f)
+@@ -29,32 +29,31 @@
+
+ @log.debug [uri.to_s]
+
+- Net::HTTP.start(uri.host, uri.port) do |http|
+- request = Net::HTTP::Post.new uri.request_uri
+- request.basic_auth @user, @password
+-
+- http.request(request) do |response|
+- unless response.code == '200' then
+- raise APIFailed,"#{response.code} #{response.message}"
+- end
++ http = Net::HTTP.new(uri.host, uri.port)
++ http.use_ssl = true
++ request = Net::HTTP::Get.new(uri.request_uri)
++ request.oauth!(http, @consumer, @access)
++ http.request(request) do |response|
++ unless response.code == '200' then
++ raise APIFailed,"#{response.code} #{response.message}"
++ end
+
+- begin
+- buffer = ''
+- response.read_body do |chunk|
+- next if chunk.chomp.empty?
+- buffer << chunk.to_s
+-
+- if buffer =~ /\A(.*)\n/ then
+- text = $1
+- unless text.strip.empty?
+- f.call TwitterStruct.make(JSON.parse(text))
+- end
+- buffer = ''
++ begin
++ buffer = ''
++ response.read_body do |chunk|
++ next if chunk.chomp.empty?
++ buffer << chunk.to_s
++
++ if buffer =~ /\A(.*)\n/ then
++ text = $1
++ unless text.strip.empty?
++ f.call TwitterStruct.make(JSON.parse(text))
+ end
++ buffer = ''
+ end
+- rescue => e
+- raise APIFailed,e.to_s
+ end
++ rescue => e
++ raise APIFailed,e.to_s
+ end
+ end
+ end
diff --git a/debian/patches/0004-Userstream-changes.patch b/debian/patches/0004-Userstream-changes.patch
new file mode 100644
index 0000000..1cee97e
--- /dev/null
+++ b/debian/patches/0004-Userstream-changes.patch
@@ -0,0 +1,81 @@
+From: Tomonori Tamagawa <xtuaok at gmail.com>
+Date: Mon, 28 May 2012 18:11:24 +0900
+Subject: Userstream changes.
+
+ - Stream : add reference to channel object to notify stream events.
+ - Stream : remove consumer from initialize arguments, it can be referenced as @access.consumer
+ - Gateway::Session : JOIN '#<nickname>' for stream events
+ - Agent::UserStream : handle stream events
+---
+ lib/atig/agent/user_stream.rb | 14 ++++++++++++++
+ lib/atig/gateway/session.rb | 8 +++++++-
+ lib/atig/stream.rb | 8 +++++---
+ 3 files changed, 26 insertions(+), 4 deletions(-)
+
+--- atig.orig/lib/atig/agent/user_stream.rb
++++ atig/lib/atig/agent/user_stream.rb
+@@ -23,6 +23,20 @@
+ d.add :status => status, :user => status.user, :source => :user_stream
+ end
+ end
++ if status and status.event
++ case status.event
++ when 'list_member_added'
++ t.channel.notify "list member \00311added\017 : @#{status.target.screen_name} into #{status.target_object.full_name} [ http://twitter.com#{status.target_object.uri} ]"
++ when 'list_member_removed'
++ t.channel.notify "list member \00305removed\017 : @#{status.target.screen_name} from #{status.target_object.full_name} [ http://twitter.com#{status.target_object.uri} ]"
++ when 'follow'
++ t.channel.notify "#{status.source.screen_name} \00311follows\017 @#{status.target.screen_name}"
++ when 'favorite'
++ t.channel.notify "#{status.source.screen_name} \00311favorites\017 => @#{status.target_object.user.screen_name} : #{status.target_object.text}"
++ when 'unfavorite'
++ t.channel.notify "#{status.source.screen_name} \00305unfavorites\017 => @#{status.target_object.user.screen_name} : #{status.target_object.text}"
++ end
++ end
+ end
+ end
+ end
+--- atig.orig/lib/atig/gateway/session.rb
++++ atig/lib/atig/gateway/session.rb
+@@ -138,7 +138,13 @@
+ log :debug, "initialize Twitter"
+ twitter = Twitter.new context, oauth.access
+ search = SearchTwitter.new context
+- stream = Stream.new context, oauth.oauth, oauth.access if @opts.stream
++ if @opts.stream
++ unless @channels.key?("##{@nick}")
++ ch = channel("##{@nick}")
++ ch.join_me
++ end
++ end
++ stream = Stream.new context, @channels["##{@nick}"], oauth.access if @opts.stream
+ @api = Scheduler.new context, twitter, search, stream
+
+ log :debug, "initialize filter"
+--- atig.orig/lib/atig/stream.rb
++++ atig/lib/atig/stream.rb
+@@ -11,11 +11,13 @@
+ class Stream
+ include Util
+
++ attr_reader :channel
++
+ class APIFailed < StandardError; end
+- def initialize(context, consumer, access)
++ def initialize(context, channel, access)
+ @log = context.log
+ @opts = context.opts
+- @consumer = consumer
++ @channel = channel
+ @access = access
+ end
+
+@@ -32,7 +34,7 @@
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ request = Net::HTTP::Get.new(uri.request_uri)
+- request.oauth!(http, @consumer, @access)
++ request.oauth!(http, @access.consumer, @access)
+ http.request(request) do |response|
+ unless response.code == '200' then
+ raise APIFailed,"#{response.code} #{response.message}"
diff --git a/debian/patches/0005-don-t-process-retweet-status-by-no_retweet_ids.patch b/debian/patches/0005-don-t-process-retweet-status-by-no_retweet_ids.patch
new file mode 100644
index 0000000..ad191d8
--- /dev/null
+++ b/debian/patches/0005-don-t-process-retweet-status-by-no_retweet_ids.patch
@@ -0,0 +1,86 @@
+From: Tomonori Tamagawa <xtuaok at gmail.com>
+Date: Mon, 28 May 2012 19:02:04 +0900
+Subject: don't process retweet status by no_retweet_ids
+
+---
+ lib/atig/agent.rb | 1 +
+ lib/atig/agent/noretweets.rb | 24 ++++++++++++++++++++++++
+ lib/atig/agent/user_stream.rb | 1 +
+ lib/atig/db/db.rb | 3 ++-
+ lib/atig/gateway.rb | 1 +
+ 5 files changed, 29 insertions(+), 1 deletion(-)
+ create mode 100644 lib/atig/agent/noretweets.rb
+
+--- atig.orig/lib/atig/agent.rb
++++ atig/lib/atig/agent.rb
+@@ -7,3 +7,4 @@
+ require 'atig/agent/timeline'
+ require 'atig/agent/clenup'
+ require 'atig/agent/user_stream'
++require 'atig/agent/noretweets'
+--- /dev/null
++++ atig/lib/atig/agent/noretweets.rb
+@@ -0,0 +1,24 @@
++# -*- mode:ruby; coding:utf-8 -*-
++
++require 'atig/util'
++
++module Atig
++ module Agent
++ class Noretweets
++ include Util
++
++ def initialize(context, api, db)
++ @opts = context.opts
++ @log = context.log
++ @db = db
++ log :info, "initialize"
++
++ api.repeat(3600){|t| update t }
++ end
++
++ def update(api)
++ @db.noretweets.clear.concat( api.get("friendships/no_retweet_ids") )
++ end
++ end
++ end
++end
+--- atig.orig/lib/atig/agent/user_stream.rb
++++ atig/lib/atig/agent/user_stream.rb
+@@ -18,6 +18,7 @@
+ @api.stream do|t|
+ t.watch('user') do |status|
+ # @log.debug status.inspect
++ next if status.retweeted_status and db.noretweets.include?(status.user.id)
+ if status and status.user
+ db.statuses.transaction do|d|
+ d.add :status => status, :user => status.user, :source => :user_stream
+--- atig.orig/lib/atig/db/db.rb
++++ atig/lib/atig/db/db.rb
+@@ -13,7 +13,7 @@
+ module Db
+ class Db
+ include Util
+- attr_reader :followings, :statuses, :dms, :lists
++ attr_reader :followings, :statuses, :dms, :lists, :noretweets
+ attr_accessor :me
+ Path = ::Dir.tmpdir
+ VERSION = 4
+@@ -26,6 +26,7 @@
+ @statuses = Statuses.new dir('status')
+ @dms = Statuses.new dir('dm')
+ @lists = Lists.new dir('lists.%s')
++ @noretweets = Array.new
+
+ log :info, "initialize"
+ end
+--- atig.orig/lib/atig/gateway.rb
++++ atig/lib/atig/gateway.rb
+@@ -9,6 +9,7 @@
+ Atig::Agent::Timeline,
+ Atig::Agent::Cleanup,
+ Atig::Agent::UserStream,
++ Atig::Agent::Noretweets,
+ ]
+
+ Atig::Gateway::Session.ifilters = [
diff --git a/debian/patches/0006-handle-direct-message-in-userstream.patch b/debian/patches/0006-handle-direct-message-in-userstream.patch
new file mode 100644
index 0000000..e362820
--- /dev/null
+++ b/debian/patches/0006-handle-direct-message-in-userstream.patch
@@ -0,0 +1,30 @@
+From: Tomonori Tamagawa <xtuaok at gmail.com>
+Date: Fri, 1 Jun 2012 15:09:20 +0900
+Subject: handle direct message in userstream.
+
+---
+ lib/atig/agent/user_stream.rb | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- atig.orig/lib/atig/agent/user_stream.rb
++++ atig/lib/atig/agent/user_stream.rb
+@@ -19,12 +19,16 @@
+ t.watch('user') do |status|
+ # @log.debug status.inspect
+ next if status.retweeted_status and db.noretweets.include?(status.user.id)
+- if status and status.user
++ if status.direct_message
++ dm = status.direct_message
++ db.dms.transaction do|d|
++ d.add :status => dm, :user => dm.sender
++ end
++ elsif status and status.user
+ db.statuses.transaction do|d|
+ d.add :status => status, :user => status.user, :source => :user_stream
+ end
+- end
+- if status and status.event
++ elsif status and status.event
+ case status.event
+ when 'list_member_added'
+ t.channel.notify "list member \00311added\017 : @#{status.target.screen_name} into #{status.target_object.full_name} [ http://twitter.com#{status.target_object.uri} ]"
diff --git a/debian/patches/Disabled_Update_Checker.patch b/debian/patches/Disabled_Update_Checker.patch
new file mode 100644
index 0000000..5b37fb0
--- /dev/null
+++ b/debian/patches/Disabled_Update_Checker.patch
@@ -0,0 +1,42 @@
+--- atig.orig/lib/atig/channel/timeline.rb
++++ atig/lib/atig/channel/timeline.rb
+@@ -2,7 +2,7 @@
+
+ require 'atig/channel/channel'
+ require 'atig/util'
+-require 'atig/update_checker'
++#require 'atig/update_checker'
+
+ module Atig
+ module Channel
+@@ -24,18 +24,18 @@
+ end
+
+ # 最新版のチェック
+- daemon do
+- log :info,"check update"
+- messages = UpdateChecker.latest
+- unless messages.empty?
+- @channel.notify "\002New version is available.\017 run 'git pull'."
+- messages[0, 3].each do |m|
+- @channel.notify " \002#{m[/.+/]}\017"
+- end
+- @channel.notify(" ... and more. check it: http://mzp.github.com/atig/") if messages.size > 3
+- end
+- sleep (3*60*60)
+- end
++ #daemon do
++ # log :info,"check update"
++ # messages = UpdateChecker.latest
++ # unless messages.empty?
++ # @channel.notify "\002New version is available.\017 run 'git pull'."
++ # messages[0, 3].each do |m|
++ # @channel.notify " \002#{m[/.+/]}\017"
++ # end
++ # @channel.notify(" ... and more. check it: http://mzp.github.com/atig/") if messages.size > 3
++ # end
++ # sleep (3*60*60)
++ #end
+
+ db.statuses.listen do|entry|
+ if db.followings.include?(entry.user) or
diff --git a/debian/patches/series b/debian/patches/series
index 92e1533..dd02359 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,7 @@
0001-Remove-Bundler-and-Rubygems-Dependencies.patch
+0002-Update-and-Fix-README.mkdn.patch
+0003-Userstream-should-work.patch
+0004-Userstream-changes.patch
+0005-don-t-process-retweet-status-by-no_retweet_ids.patch
+0006-handle-direct-message-in-userstream.patch
+Disabled_Update_Checker.patch
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
index df83168..b47b3a8 100644
--- a/debian/ruby-tests.rake
+++ b/debian/ruby-tests.rake
@@ -4,5 +4,5 @@ task :default => [:spec]
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
- ruby_opts = '-Ku' unless RUBY_VERSION >= '1.9'
+ t.ruby_opts = '-Ku -w'
end
--
atig.git
More information about the Pkg-ruby-extras-commits
mailing list