rabbiter-2.0.4/0000755000004100000410000000000013153431623013340 5ustar www-datawww-datarabbiter-2.0.4/Rakefile0000644000004100000410000000213713153431623015010 0ustar www-datawww-data# -*- ruby -*- # # Copyright (C) 2012-2014 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. require "rubygems" require "bundler/gem_helper" require "gettext/tools/task" base_dir = File.expand_path(File.dirname(__FILE__)) helper = Bundler::GemHelper.new(base_dir) def helper.version_tag version end helper.install spec = helper.gemspec GetText::Tools::Task.define do |task| task.spec = spec end task :build => "gettext" rabbiter-2.0.4/rabbiter.gemspec0000644000004100000410000000411413153431623016477 0ustar www-datawww-data# -*- ruby -*- # # Copyright (C) 2012-2014 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. base_dir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(base_dir, "lib")) require "rabbiter/version" Gem::Specification.new do |spec| spec.name = "rabbiter" spec.version = Rabbiter::VERSION.dup spec.rubyforge_project = "rabbit" spec.homepage = "http://rabbit-shocker.org/en/rabbiter/" spec.authors = ["Kouhei Sutou"] spec.email = ["kou@cozmixng.org"] spec.summary = "Rabbiter is a twitter client for Rabbit" spec.description = "Rabbiter receives comments from twitter and sends them to Rabbit. " + "Rabbit shows them in your slides. " + "It is very useful when you talk on public event." spec.license = "GPLv2+" spec.files = ["Rakefile", "COPYING", "GPL", "README"] spec.files += ["Gemfile", "#{spec.name}.gemspec"] spec.files += Dir.glob("lib/**/*.rb") spec.files += Dir.glob("doc/**/*.*") spec.files += Dir.glob("po/*/#{spec.name}.po") spec.files += Dir.glob("locale/**/*.mo") Dir.chdir("bin") do spec.executables = Dir.glob("*") end spec.add_runtime_dependency("rabbit", ">= 2.0.0") spec.add_runtime_dependency("gio2", ">= 2.1.1") spec.add_runtime_dependency("twitter_oauth") spec.add_runtime_dependency("twitter") spec.add_development_dependency("rake") spec.add_development_dependency("bundler") spec.add_development_dependency("gettext") end rabbiter-2.0.4/bin/0000755000004100000410000000000013153431623014110 5ustar www-datawww-datarabbiter-2.0.4/bin/rabbiter0000755000004100000410000001137313153431623015635 0ustar www-datawww-data#!/usr/bin/env ruby # -*- ruby -*- # # Copyright (C) 2010-2016 Kouhei Sutou # Copyright (C) 2010 OBATA Akio # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. require "drb/drb" require "uri" require "rabbit/console" require "rabbiter" include Rabbiter::GetText def parse(args=ARGV, logger=nil) Rabbit::Console.parse!(args, logger) do |parser, options| options.version = Rabbiter::VERSION options.rabbit_uri = options.druby_uri options.filters = [] options.user_languages = [] options.resolve_shorten_url = true options.log_status = false parser.separator "" parser.on("--rabbit-uri=URI", _("Rabbit's dRuby URI"), "(#{options.rabbit_uri})") do |uri| options.rabbit_uri = uri end parser.on("--filter=FILTER", _("Filter by word."), _("To use multiple filters, use this option multiple.")) do |filter| options.filters << filter end parser.on("--user-language=LANGUAGE", _("Filter by user language."), _("(e.g.: ja, en)"), _("To use multiple language, use this option multiple.")) do |language| options.user_languages << language end parser.on("--[no-]resolve-shorten-url", _("Resolve shorten URL such as https://t.co/XXX."), "(#{options.resolve_shorten_url})") do |boolean| options.resolve_shorten_url = boolean end parser.category(_("Debug")) parser.on("--[no-]log-status", _("Log target statuses.")) do |boolean| options.log_status = boolean end end end def target?(status, options) return true if options.user_languages.empty? user = status.user return false if user.nil? user_lang = user.lang return false if user_lang.nil? options.user_languages.include?(user_lang) end def clean_text(status, options) raw_text = status.full_text if options.resolve_shorten_url target_text = resolve_shorten_urls(raw_text, status, options) else target_text = raw_text end cleaned_text = remove_hash_tag(target_text, options.filters) cleaned_text = remove_ustream_link(cleaned_text) cleaned_text end def remove_hash_tag(text, filters) hash_tag_regexps = filters.collect do |filter| if filter.start_with?("#") Regexp.escape(filter) else Regexp.escape("\##{filter}") end end text.gsub(Regexp.union(*hash_tag_regexps), "") end def resolve_t_co(url) Net::HTTP.start(url.host, url.port) do |http| response = http.head(url.path) location = response["location"] if location URI(location) else url end end end def resolve_shorten_url(url) case url.host when "t.co" resolve_t_co else url end end def resolve_shorten_urls(raw_text, status, options) resolved_text = raw_text.dup target_urls = status.urls + status.media.uniq {|media| media.id} reversed_urls = target_urls.sort_by do |url| start_position, _ = url.indices -start_position end reversed_urls.each do |url| expanded_url = url.expanded_url next if expanded_url.nil? start_position, end_position = url.indices resolved_url = resolve_shorten_url(expanded_url) resolved_text[start_position...end_position] = resolved_url.to_s end resolved_text end def remove_ustream_link(text) text.gsub(/\(.* live at https:\/\/ustre\.am\/.*\)/, "") end def main options, logger = parse if options.filters.empty? logger.error(_("must specify one or more filters by --filter")) exit(false) end rabbit = DRbObject.new_with_uri(options.rabbit_uri) client = Rabbiter::Client.new(logger) client.start(*options.filters) do |status| text = status.full_text next if text.nil? next unless target?(status, options) text = clean_text(status, options) comment = "@#{status.user.screen_name}: #{text}" logger.info(comment) begin rabbit.append_comment(comment) rescue DRb::DRbConnError logger.error("Rabbiter: #{$!.class}: #{$!.message}") end end main_loop = GLib::MainLoop.new trap("INT") do client.close main_loop.quit end main_loop.run end main rabbiter-2.0.4/Gemfile0000644000004100000410000000145313153431623014636 0ustar www-datawww-data# -*- ruby -*- # # Copyright (C) 2012 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA source "http://rubygems.org" gemspec rabbiter-2.0.4/doc/0000755000004100000410000000000013153431623014105 5ustar www-datawww-datarabbiter-2.0.4/doc/ja/0000755000004100000410000000000013153431623014477 5ustar www-datawww-datarabbiter-2.0.4/doc/ja/index.rd0000644000004100000410000001736113153431623016145 0ustar www-datawww-data--- layout: ja title: Rabbiter --- == Rabbiterとは RabbiterはTwitterから発表に関連するツイートを収集して、それをコメントと してRabbitに流しこむためのツールです。 日本Ruby会議など公開されたイベントで発表する場合は、観客が発表を聴きな がらコメントをTwitterに書き込むことが増えてきました。Rabbiterを使うとそ のようなコメントをRabbitで表示しているスライド中に表示することができま す。 発表者に余裕がある場合は、発表中にそのコメントに返事をして観客の意見を 反映した発表にすることもできます。観客は他の観客のコメントも知ることが でき、発表中に自分とは違った視点の考えを取り入れながら発表を聴くことが できます。ただし、発表内容よりも観客のコメントの方に観客の注意が向いて しまう危険もあることに注意してください。観客のコメントに負けないくらい 魅力的な発表となるように事前準備をしっかりしましょう。 == インストール RubyGemsでインストールできます。関連パッケージも一緒にインストールされ ます。 % gem install rabbiter == 使い方 Rabbiterが収集するツイートは特定のキーワードで絞り込みます。最近のイベ ントではイベント用のハッシュタグが指定されていることが多いので、それを 指定するのがよいでしょう。例えば、ハッシュタグが「#rubykaigi」の場合は 以下のように実行します。 % rabbiter --filter "#rubykaigi" Rabbiterを起動した後にキーワードを含むツイートが投稿されるとすぐに収集 します((-これは(())というものを使っ ているからです。-))。 Rabbitが起動していない場合は以下のようなエラーメッセージが表示されます。 [ERROR] Rabbiter: DRb::DRbConnError: druby://localhost:10101 - # RabbitとRabbiterはどちらを先に起動しても大丈夫です。上記のエラーメッセー ジが出力された後に以下のようにRabbitを起動してもスライド上にTwitterから のメッセージが表示されます。 % rabbit rabbit-theme-bench-ja.gem 今回の例の「#rubykaigi」は日本Ruby会議中以外はあまり使われないのでテス トには向いていません。動作確認をするなら「twitter」というキーワードがお すすめです。常に世界中の誰かが「twitter」というキーワードをツイートして います。 % rabbiter --filter "twitter" スライドにツイートが表示されましたか? それでは発表の準備をしっかりして発表に備えてください。 == より詳しい使い方 通常はここまで説明した使い方で十分ですが、それでは足りないこともありま す。そのようなときのためにより詳しい使い方を説明します。 === 複数のキーワードを登録する 多くのイベントではハッシュタグが1つですが、複数のハッシュタグを設定して いる場合もあります。例えば、イベント全体のハッシュタグとセッションごと のハッシュタグを設定している場合もあります。また、ハッシュタグだけでは なく関連するキーワードを含むツイートもコメントとして取り込みたい場合が あります。例えば、「#rubykaigi」を含むツイートだけではなく「Ruby」を含 むツイートも取り込みたいという場合です。 このように複数のキーワードを登録したい場合は((%--filter%))オプションを キーワードの数だけ指定してください。例えば、「#rubykaigi」と「Ruby」を キーワードとして登録したい場合は以下のようにします。 % rabbiter --filter "#rubykaigi" --filter "Ruby" === ユーザーの言語で絞り込む 世界的なキーワードは世界中で使われています。例えば、「twitter」というキー ワードは世界中でツイートされているため、いろんな言語のツイートが収集さ れます。日本で開催されているイベントでは、日本語のツイートは関連するツ イートである可能性が高いですが、フランス語のツイートは関連する可能性は 低いでしょう。 スライドには多くのコメントを表示したくなるかもしれませんが、発表してい る間は観客にはできるだけ発表に集中できるように、表示するコメントはでき るだけ発表に関連するものだけにした方にしましょう。ツイートが関連するか どうかをツイートしたユーザーの言語で絞り込むことができます。 例えば、自分の言語を日本語に設定しているユーザーのツイートだけにする場 合は以下のように((%--user-language "ja"%))を指定します。 % rabbiter --filter "#rubykaigi" --user-language "ja" ((%--filter%))と同じように((%--user-language%))も複数回指定することがで きます。複数回指定すると指定したどれかの言語のユーザーのツイートのみが 収集されます。以下は日本語またはフランス語に設定したユーザーのツイート のみを収集する例です。 % rabbiter --filter "#rubykaigi" --user-language "ja" --user-language "fr" === 違うホストで起動しているRabbitにコメントを送る TODO === もっと知りたい ((%--help%))オプションを指定すると使えるオプションがすべて表示されます。 自分が使いたい機能がないか調べてみてください。 % rabbiter --help == 作者 * Kouhei Sutou * OBATA Akio == 著作権 著作権はそれぞれのコードを書いた人が持っています。つまり、コミットされ たコードの著作権はそのコミッタが持っていて、パッチのコードの著作権はそ のパッチ作者が持っています。 == ライセンス GPLv2 or laterです。詳しくはGPLファイルを見てください。取り込まれたパッ チやコードなどを提供してもらった場合、それらのライセンスがGPLv2 or laterとすることに同意してもらったこととします。また、それらも含めて須藤 がライセンスを変更できる権利を持つことに同意してもらったこととします。 == メーリングリスト (())を参照してください。 == 開発への参加方法 === リポジトリ Rabbiterのリポジトリは(())にあります。 === コミットメール 以下のメーリングリストにコミットメール毎に変更点が流れます。メーリング リストに参加することで開発状況を確認できます。メーリングリストに参加す るには以下のようなメールを送信してください。 To: commit@ml.rabbit-shocker.org Cc: null@rabbit-shocker.org Subject: 登録 登録 === バグの報告方法 ご意見ご要望不具合報告等は作者へのメール、メーリングリスト、(())をご利用くださ い。 == 感謝 以下の方々はRabbiterを助けてくれたみなさんです。ありがとうございま す!!! * おばたさん: 最初のバージョンを書いてくれました。 rabbiter-2.0.4/doc/ja/news.rd0000644000004100000410000000221513153431623016002 0ustar www-datawww-data--- layout: ja title: お知らせ apply_data: false --- == 2.0.3: 2016-08-21 脱twitter-streamリリース! === 改良 * doc: ドキュメントをgem内に入れるようにした。 [shocker-ja:1225] [Youhei SASAKIさんが報告] * (({t.co}))の短縮URLを展開するようにした。 [shocker-ja:1228] [OBATA Akioさんが提案] [GitHub#5] [OBATA Akioさんがパッチ提供] * twitter-stream gemをやめてtwitter gemを使うようにした。 === 感謝 * Youhei SASAKIさん * OBATA Akioさん == 2.0.2: 2014-06-05 Ruby/GIO2 2.2.0対応リリース! === 改良 * doc: OS Xのインストールドキュメントに((%glib-networking%))の説明を追加。 [GitHub#4] [Colin Deanさんがパッチ提供] [shocker-ja:1190] [znzさんが報告] * Ruby/GIO2 2.2.0に対応。 === 感謝 * Colin Deanさん * znzさん == 2.0.1: 2013-08-29 1年ぶりのバグフィックスリリース! === 改良 * OS XなどGTK+からURLを開けない環境でも初期設定できるようにした。 == 2.0.0: 2012-08-29 初めてのリリース! Rabbitパッケージから分離しました。 rabbiter-2.0.4/doc/en/0000755000004100000410000000000013153431623014507 5ustar www-datawww-datarabbiter-2.0.4/doc/en/index.rd0000644000004100000410000001214013153431623016143 0ustar www-datawww-data--- layout: en title: Rabbiter --- == About Rabbiter Rabbiter is a tool that collects tweets related to the talk and sends them to Rabbit as comments. In public conference such as RubyKaigi, audiences tweet comments about the listening talk to Twitter. To show the comments to your slide showed by Rabbit, you can use Rabbiter. If you have room to breathe, you can reply to the comments to reflect audiences' opinions. An audience can listen your talk with some different points of view because an audience can know other's comments. Note that you have a risk that audiences are interested in audiences' comments rather than your talk. You should ready your talk to make very interesting talk rather than audiences' comments. == Install You can install Rabbiter by RubyGems. Required packages are also installed. % gem install rabbiter == Usage Rabbiter filters target tweets by specified keywords. It's good idea that you use hash tag for the conference. Here is an example command line for "#rubykaigi" hash tag: % rabbiter --filter "#rubykaigi" Rabbiter collects target tweets that have specified keywords. ((-Because Rabbiter uses (()).-)) If you don't run Rabbit yet, the following error message will be shown: [ERROR] Rabbiter: DRb::DRbConnError: druby://localhost:10101 - # You can run Rabbit before Rabbiter and Rabbiter before Rabbit. You can show tweets from Twitter on your slide by running Rabbit after the above error message is showen. % rabbit rabbit-theme-bench-en.gem This example hash tag "#rubykaigi" isn't suitable for test because RubyKaigi isn't always sitting. "twitter" keyword is suitable for test. Someone tweets a message that contain "twitter" at the world. % rabbiter --filter "twitter" Can you show tweets on your slide? OK. Use your rest time to ready your talk. == Advanced usage Normally, the above description is enough. In some cases, you need more description. The below is description for those cases. === Register multiple keywords Many conferences use only one conference hash tag. But some conferences use one ore more conference hash tags. For example, one conference hash tag is for the whole conference and other conference hash tag is for a session in the conference. Or you may want to collect tweets that don't have hash tag but have related keyword. For example, you want to collect not only "#rubykaigi" but also "Ruby". You can use ((%--filter%)) option multiple times to specify multiple keywords. Here is an example command line that specify "#rubykaigi" and "Ruby" as keywords: % rabbiter --filter "#rubykaigi" --filter "Ruby" === Filter by user's language Global keyword is used all over the world. For example, "twitter" is used all over the world. So you can collect many tweets in many language by the keyword. If a conference is holed at Japan, tweets in Japanese will be related to the conference but tweets in French will not be related to the conference. You may want to show many comments in your slides but you should show only related comments to your talk. You can use user's language to filter related tweets. Here is an example command line that filters by Japanese: % rabbiter --filter "#rubykaigi" --user-language "ja" You can specify ((%--user-language%)) option multiple times like ((%--filter%)) option. You can collect only specified languages. Here is an example command line that filters by Japanese or French. % rabbiter --filter "#rubykaigi" --user-language "ja" --user-language "fr" === Sends comments to Rabbit that is run at other host TODO === More information You can see all available options by running with ((%--help%)) option. Look the output to find a feature what you want. % rabbiter --help == Authors * Kouhei Sutou * OBATA Akio == Copyright The code author retains copyright of the source code. In other words the committer retains copyright of his or her committed code and patch authors retain the copyright of their submitted patch code. == License Licensed under GPLv2 or later. For more information see 'GPL' file. Provided patches, codes and so on are also licensed under GPLv2 or later. Kouhei Sutou can change their license. Authores of them are cosidered agreeing with those rules when they contribute their patches, codes and so on. == Mailing list See (()). == Join development === Repository Rabbiter's repository is (()). === Commit mail You can stay up to date on the latest development by subscribing to the git commit ML. If you want to subscribe to the ML, send an e-mail like the following. To: commit@ml.rabbit-shocker.org Cc: null@rabbit-shocker.org Subject: Subscribe Subscribe === Bug report Use the mailing list or (()) for reporting a bug or a request. == Thanks Here is a contributor list. Thanks to them!!! * OBATA Akio: He wrote the initial verison. rabbiter-2.0.4/doc/en/news.rd0000644000004100000410000000206413153431623016014 0ustar www-datawww-data--- layout: en title: News apply_data: false --- == 2.0.3: 2016-08-21 Un-twitter-stream-ize release! === Improvements * doc: Added documents into gem. [shocker-ja:1225] [Reported by Youhei SASAKI] * Supported expanding shorten URLs by (({t.co})). [shocker-ja:1228] [Suggested by OBATA Akio] [GitHub#5] [Patch by OBATA Akio] * Changed to use twitter gem instead of twitter-stream gem. === Thanks * Youhei SASAKI * OBATA Akio == 2.0.2: 2014-06-05 Ruby/GIO2 2.2.0 supported release! === Improvements * doc: Added description about ((%glib-networking%)) to install documentation for OS X. [GitHub#4] [Patch by Colin Dean] [shocker-ja:1190] [Reported by Kazuhiro NISHIYAMA] * Supported Ruby/GIO2 2.2.0. === Thanks * Colin Dean * Kazuhiro NISHIYAMA == 2.0.1: 2013-08-29 A bug fix release for the first time in a year! === Improvements * Supported initial setup on environments that don't support opening a URI from GTK+ such as OS X. == 2.0.0: 2012-08-29 The first release! Rabbiter is derived from Rabbit package. rabbiter-2.0.4/GPL0000644000004100000410000004325413153431623013715 0ustar www-datawww-data GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. rabbiter-2.0.4/README0000644000004100000410000000006713153431623014223 0ustar www-datawww-dataSee doc/en/ or http://rabbit-shocker.org/en/rabbiter/. rabbiter-2.0.4/lib/0000755000004100000410000000000013153431623014106 5ustar www-datawww-datarabbiter-2.0.4/lib/rabbiter/0000755000004100000410000000000013153431623015700 5ustar www-datawww-datarabbiter-2.0.4/lib/rabbiter/version.rb0000644000004100000410000000144613153431623017717 0ustar www-datawww-data# Copyright (C) 2012-2016 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. module Rabbiter VERSION = "2.0.4" end rabbiter-2.0.4/lib/rabbiter/gettext.rb0000644000004100000410000000170213153431623017711 0ustar www-datawww-data# Copyright (C) 2012 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. module Rabbiter module GetText DOMAIN = "rabbiter" class << self def included(mod) mod.send(:include, ::GetText) mod.bindtextdomain(DOMAIN) end end end end rabbiter-2.0.4/lib/rabbiter.rb0000644000004100000410000000760713153431623016237 0ustar www-datawww-data# Copyright (C) 2010-2014 Kouhei Sutou # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. require "shellwords" require "pathname" require "yaml" require "twitter" require "twitter_oauth" require "rabbit/utils" require "rabbiter/version" require "rabbiter/gettext" module Rabbiter class Client CONSUMER_KEY = "wT9WSC0afRw94fxUw0iIKw" CONSUMER_SECRET = "mwY35vfQfmWde9lZbyNNB15QzCq3k2VwGj3X1IAkQ8" include GetText def initialize(logger) @logger = logger @oauth_parameters = nil @config_file_path = Pathname.new("~/.rabbit/twitter-oauth.yaml") @config_file_path = @config_file_path.expand_path @listeners = [] @connection = nil end def register_listener(&block) @listeners << block end def setup return unless @oauth_parameters.nil? setup_access_token unless @config_file_path.exist? oauth_access_parameters = YAML.load(@config_file_path.read) @oauth_parameters = { :access_key => oauth_access_parameters[:access_token], :access_secret => oauth_access_parameters[:access_secret], } end def close return if @connection.nil? @connection.close @connection = nil end def start(*filters, &block) register_listener(&block) if block_given? setup if @oauth_parameters.nil? return if @oauth_parameters.nil? stream_options = { :access_token => @oauth_parameters[:access_key], :access_token_secret => @oauth_parameters[:access_secret], :consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET, :user_agent => "Rabbiter #{Rabbiter::VERSION}", } @client = ::Twitter::Streaming::Client.new(stream_options) @client.filter(:track => filters.join(",")) do |status| @listeners.each do |listener| listener.call(status) end end end private def setup_access_token FileUtils.mkdir_p(@config_file_path.dirname) oauth_options = { :consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET, :proxy => ENV["http_proxy"], } client = TwitterOAuth::Client.new(oauth_options) request_token = client.request_token authorize_url = request_token.authorize_url puts( _("1) Access this URL: %{url}") % {:url => authorize_url}) show_uri(authorize_url) print(_("2) Enter the PIN: ")) pin = $stdin.gets.strip access_token = request_token.get_access_token(:oauth_verifier => pin) oauth_parameters = { :access_token => access_token.token, :access_secret => access_token.secret, } @config_file_path.open("w") do |config_file| config_file.chmod(0600) config_file.puts(YAML.dump(oauth_parameters)) end end def show_uri(uri) if Gtk.respond_to?(:show_uri_on_window) begin Gtk.show_uri_on_window(nil, uri, Gdk::CURRENT_TIME) rescue GLib::ErrorInfo @logger.warning("[twitter][show-uri] #{$!}") end elsif Gtk.respond_to?(:show_uri) begin Gtk.show_uri(uri) rescue GLib::ErrorInfo @logger.warning("[twitter][show-uri] #{$!}") end end end end end rabbiter-2.0.4/po/0000755000004100000410000000000013153431623013756 5ustar www-datawww-datarabbiter-2.0.4/po/ja/0000755000004100000410000000000013153431623014350 5ustar www-datawww-datarabbiter-2.0.4/po/ja/rabbiter.po0000644000004100000410000000334213153431623016504 0ustar www-datawww-data# Japanese translations for rabbiter package. # Copyright (C) 2012 Kouhei Sutou # This file is distributed under the same license as the rabbiter package. # Kouhei Sutou , 2012. # msgid "" msgstr "" "Project-Id-Version: rabbiter 2.0.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2016-08-21 16:42+0900\n" "Last-Translator: Kouhei Sutou \n" "Language-Team: Japanese\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" msgid "Rabbit's dRuby URI" msgstr "RabbitのdRuby URI" msgid "Filter by word." msgstr "単語でフィルターします。" msgid "To use multiple filters, use this option multiple." msgstr "複数のフィルターを使うときはこのオプションを複数回使ってください。" msgid "Filter by user language." msgstr "ユーザーの言語でフィルターします。" msgid "(e.g.: ja, en)" msgstr "(例: ja, en)" msgid "To use multiple language, use this option multiple." msgstr "複数の言語を指定するときはこのオプションを複数回使ってください。" msgid "Resolve shorten URL such as https://t.co/XXX." msgstr "https://t.co/XXX のような短縮URLを展開します。" msgid "Debug" msgstr "デバッグ" msgid "Log target statuses." msgstr "対象となるステータスをログに出力します。" msgid "must specify one or more filters by --filter" msgstr "--filterで1つ以上のフィルターを指定してください。" msgid "1) Access this URL: %{url}" msgstr "1) このURLにアクセスしてください: %{url}" msgid "2) Enter the PIN: " msgstr "2) PINを入力してください: " rabbiter-2.0.4/COPYING0000644000004100000410000000005413153431623014372 0ustar www-datawww-dataGPLv2 or later. See 'GPL' file about GPLv2. rabbiter-2.0.4/locale/0000755000004100000410000000000013153431623014577 5ustar www-datawww-datarabbiter-2.0.4/locale/ja/0000755000004100000410000000000013153431623015171 5ustar www-datawww-datarabbiter-2.0.4/locale/ja/LC_MESSAGES/0000755000004100000410000000000013153431623016756 5ustar www-datawww-datarabbiter-2.0.4/locale/ja/LC_MESSAGES/rabbiter.mo0000644000004100000410000000305713153431623021112 0ustar www-datawww-data 89Hcv|-23.,b65# 23?$s<;c$`E   (e.g.: ja, en)1) Access this URL: %{url}2) Enter the PIN: DebugFilter by user language.Filter by word.Log target statuses.Rabbit's dRuby URIResolve shorten URL such as https://t.co/XXX.To use multiple filters, use this option multiple.To use multiple language, use this option multiple.must specify one or more filters by --filterProject-Id-Version: rabbiter 2.0.0 Report-Msgid-Bugs-To: PO-Revision-Date: 2016-08-21 16:42+0900 Last-Translator: Kouhei Sutou Language-Team: Japanese Language: ja MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; (例: ja, en)1) このURLにアクセスしてください: %{url}2) PINを入力してください: デバッグユーザーの言語でフィルターします。単語でフィルターします。対象となるステータスをログに出力します。RabbitのdRuby URIhttps://t.co/XXX のような短縮URLを展開します。複数のフィルターを使うときはこのオプションを複数回使ってください。複数の言語を指定するときはこのオプションを複数回使ってください。--filterで1つ以上のフィルターを指定してください。