twitter2mixivoice 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/CHANGELOG.rdoc +18 -0
- data/LICENSE +22 -0
- data/README.rdoc +45 -0
- data/Rakefile +102 -0
- data/VERSION +1 -0
- data/bin/twitter2mixivoice +31 -0
- data/lib/application.rb +135 -0
- data/lib/mixi.rb +80 -0
- data/lib/options.rb +84 -0
- data/lib/tweet.rb +19 -0
- data/lib/twitter_2_mixi_voice.rb +34 -0
- data/lib/twitter_client.rb +85 -0
- data/test/test_application.rb +110 -0
- data/test/test_mixi.rb +86 -0
- data/test/test_options.rb +107 -0
- data/test/test_tweet.rb +32 -0
- data/test/test_twitter_2_mixi_voice.rb +20 -0
- data/test/test_twitter_client.rb +73 -0
- data/twitter2mixivoice.gemspec +67 -0
- metadata +81 -0
data/.document
ADDED
data/.gitignore
ADDED
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= ChangeLog
|
2
|
+
|
3
|
+
== 2009-11-08 kawakazu80@gmail.com
|
4
|
+
|
5
|
+
* 0.1.1
|
6
|
+
packed gem.
|
7
|
+
add Twitter2MixiVoice.gemspec file.
|
8
|
+
change 'twitter_2_mixi_voice' file into 'twitter2mixivoice' file.
|
9
|
+
|
10
|
+
* README.rdoc
|
11
|
+
add description of 'INSTALL:' chapter.
|
12
|
+
|
13
|
+
|
14
|
+
== 2009-11-08 kawakazu80@gmail.com
|
15
|
+
|
16
|
+
* 0.1.0
|
17
|
+
first release.
|
18
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2009 kazuya kawaguchi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
= Twitter2MixiVoice
|
2
|
+
|
3
|
+
This application is posted tweets of Twitter to MixiVoice.
|
4
|
+
|
5
|
+
|
6
|
+
== FEATURES:
|
7
|
+
|
8
|
+
* Post tweets of Twitter to MixiVoice.
|
9
|
+
|
10
|
+
|
11
|
+
== SUPPORT:
|
12
|
+
|
13
|
+
* e-mail address : kawakazu80@gmail.com
|
14
|
+
* twitter id : kazu_pon
|
15
|
+
|
16
|
+
|
17
|
+
== SYNOPSIS:
|
18
|
+
|
19
|
+
The following options are required.
|
20
|
+
|
21
|
+
* twitter id option : <em>--twitter_id</em> or <em>-t</em>
|
22
|
+
* twitter password option : <em>--twitter_password</em> or <em>-T</em>
|
23
|
+
* mixi email option : <em>--mixi_email</em> or <em>-m</em>
|
24
|
+
* mixi password option : <em>--mixi_password</em> or <em>-M</em>
|
25
|
+
|
26
|
+
Example:
|
27
|
+
|
28
|
+
$ twitter2mixivoice -t <em>twitter_id</em> -T <em>twitter_password</em> -m <em>user@hoge.com</em> -M <em>mixi_password</em>
|
29
|
+
|
30
|
+
|
31
|
+
== REQUIREMENTS:
|
32
|
+
|
33
|
+
* ruby 1.8.7
|
34
|
+
* twitter4r 0.3.1
|
35
|
+
* mechanize 0.9.3
|
36
|
+
|
37
|
+
|
38
|
+
== INSTALL:
|
39
|
+
|
40
|
+
gem install twitter2mixivoice
|
41
|
+
|
42
|
+
|
43
|
+
== Copyright:
|
44
|
+
|
45
|
+
Copyright (c) 2009 kazuya kawaguchi. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "twitter2mixivoice"
|
8
|
+
gem.summary = %Q{twitter2mixivoice}
|
9
|
+
gem.description = %Q{Post twitter tweet to mixi voice.}
|
10
|
+
gem.email = "kawakazu80@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/kazupon/Twitter2MixiVoice"
|
12
|
+
gem.authors = ["kazuya kawaguchi"]
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/test_*.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
begin
|
41
|
+
|
42
|
+
require "highline"
|
43
|
+
desc "Setting test account"
|
44
|
+
task :setting_test_account do
|
45
|
+
|
46
|
+
setting_dir_path = "config"
|
47
|
+
setting_file_path = "#{setting_dir_path}/settings.yml"
|
48
|
+
setting_block = Proc.new do
|
49
|
+
password_block = Proc.new { |q| q.echo = "*" }
|
50
|
+
twitter_id = HighLine.new.ask("Enter Twitter ID: ")
|
51
|
+
twitter_pwd = HighLine.new.ask("Enter Twitter Password: ", &password_block)
|
52
|
+
mixi_email = HighLine.new.ask("Enter Mixi ID: ")
|
53
|
+
mixi_pwd = HighLine.new.ask("Enter Mixi Password: ", &password_block)
|
54
|
+
|
55
|
+
settings = {
|
56
|
+
"mixi_account" => {
|
57
|
+
"email" => mixi_email,
|
58
|
+
"password" => mixi_pwd
|
59
|
+
} ,
|
60
|
+
"twitter_account" => {
|
61
|
+
"id" => twitter_id,
|
62
|
+
"password" => twitter_pwd
|
63
|
+
}
|
64
|
+
}
|
65
|
+
File.open(setting_file_path, "w") { |file| YAML.dump(settings, file) }
|
66
|
+
end
|
67
|
+
|
68
|
+
if FileTest.exist?(setting_file_path)
|
69
|
+
result = HighLine.new.ask("Already Test Account Setting File. ReUse ? Yes -> Enter key, No -> 'n' typing : ")
|
70
|
+
if result == "n"
|
71
|
+
setting_block.call
|
72
|
+
puts "Success : Update '#{setting_file_path}' File."
|
73
|
+
end
|
74
|
+
else
|
75
|
+
Dir.mkdir(setting_dir_path)
|
76
|
+
setting_block.call
|
77
|
+
puts "Success : Create '#{setting_file_path}' File."
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
rescue Exception => e
|
83
|
+
puts "Error : Create 'config/settings.yml' File."
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
#task :test => :check_dependencies
|
88
|
+
task :test => [:check_dependencies, :setting_test_account]
|
89
|
+
|
90
|
+
task :default => :test
|
91
|
+
|
92
|
+
require 'rake/rdoctask'
|
93
|
+
Rake::RDocTask.new do |rdoc|
|
94
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
95
|
+
|
96
|
+
rdoc.rdoc_dir = 'rdoc'
|
97
|
+
rdoc.title = "Twitter2MixiVoice #{version}"
|
98
|
+
rdoc.rdoc_files.include('README*')
|
99
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
100
|
+
rdoc.inline_source = true
|
101
|
+
rdoc.options << "-c UTF-8"
|
102
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# mixi_voice_bot.rb
|
5
|
+
# Twitter2MixiVoice
|
6
|
+
#
|
7
|
+
# Created by kazuya kawaguchi on 2009-11-08.
|
8
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
9
|
+
#
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
12
|
+
|
13
|
+
require "twitter_2_mixi_voice"
|
14
|
+
|
15
|
+
|
16
|
+
#
|
17
|
+
# entry point
|
18
|
+
#
|
19
|
+
|
20
|
+
if __FILE__ == $0
|
21
|
+
|
22
|
+
begin
|
23
|
+
# run application.
|
24
|
+
Twitter2MixiVoice::Application.run(ARGV)
|
25
|
+
rescue Exception => e
|
26
|
+
$stderr.puts e.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
__END__
|
data/lib/application.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
#
|
2
|
+
# application.rb
|
3
|
+
# mixi_voice_bot
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-10-25.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "mixi"
|
10
|
+
require "twitter_client"
|
11
|
+
require "options"
|
12
|
+
|
13
|
+
|
14
|
+
module Twitter2MixiVoice
|
15
|
+
|
16
|
+
|
17
|
+
# This constants is Twitter2MixiVoice Application return code.
|
18
|
+
Success, Error = 0, 1
|
19
|
+
|
20
|
+
|
21
|
+
# This class provides mixi bot application.
|
22
|
+
class Application
|
23
|
+
|
24
|
+
|
25
|
+
# constants
|
26
|
+
Posted_Tweets_Dir = File.join(ENV["HOME"], ".twitter2mixivoice")
|
27
|
+
Posted_File_Name = "posted_tweets.yml"
|
28
|
+
|
29
|
+
|
30
|
+
# Run Application.
|
31
|
+
#
|
32
|
+
# [<em>*args</em>]
|
33
|
+
# <tt>command line options.</tt>
|
34
|
+
#
|
35
|
+
def self.run(args)
|
36
|
+
|
37
|
+
# parse arguments.
|
38
|
+
options = Options.new(args, Twitter2MixiVoice::version)
|
39
|
+
|
40
|
+
#
|
41
|
+
# check options.
|
42
|
+
#
|
43
|
+
if options[:invalid_argument]
|
44
|
+
$stderr.puts options[:invalid_argument]
|
45
|
+
options[:show_help] = true
|
46
|
+
end
|
47
|
+
|
48
|
+
if options[:show_version]
|
49
|
+
$stdout.puts options[:show_version]
|
50
|
+
return Success
|
51
|
+
end
|
52
|
+
|
53
|
+
if options[:show_help]
|
54
|
+
$stderr.puts options.opts.to_s
|
55
|
+
return Error
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
result = Error
|
60
|
+
begin
|
61
|
+
|
62
|
+
# login to twitter.
|
63
|
+
twitter = login_to_twitter(options[:twitter_id], options[:twitter_password])
|
64
|
+
|
65
|
+
# login to mixi.
|
66
|
+
mixi = login_to_mixi(options[:mixi_email], options[:mixi_password])
|
67
|
+
|
68
|
+
# read cache tweets from YAML file.
|
69
|
+
posted_tweets = read_tweets(Posted_Tweets_Dir, Posted_File_Name)
|
70
|
+
|
71
|
+
# get tweets from twitter.
|
72
|
+
tweets = twitter.get_tweets_from_timeline
|
73
|
+
|
74
|
+
# post twitter tweet to mixi voice.
|
75
|
+
tweets.each do |tweet|
|
76
|
+
if (!posted_tweets.has_key?(tweet.id))
|
77
|
+
mixi.post_voice(tweet.text)
|
78
|
+
posted_tweets[tweet.id] = tweet
|
79
|
+
$stdout.puts "tweet -> voice : id = #{tweet.id}, text = #{tweet.text}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# write YAML file from cache tweets.
|
84
|
+
result = write_tweets(Posted_Tweets_Dir, Posted_File_Name, posted_tweets)
|
85
|
+
|
86
|
+
result = Success
|
87
|
+
|
88
|
+
rescue MixiException => e
|
89
|
+
$stderr.puts "Raise MixiException : #{e.to_s}"
|
90
|
+
result = Error
|
91
|
+
rescue TwitterClientException => e
|
92
|
+
$stderr.puts "Raise MixiException : #{e.to_s}"
|
93
|
+
result = Error
|
94
|
+
rescue Exception => e
|
95
|
+
$stderr.puts "Raise Exception : #{e.to_s}"
|
96
|
+
result = Error
|
97
|
+
end
|
98
|
+
|
99
|
+
return result
|
100
|
+
|
101
|
+
end # end of 'self.run'
|
102
|
+
|
103
|
+
|
104
|
+
# private code(s) block ...
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def self.login_to_twitter(id, password)
|
109
|
+
TwitterClient.new(id, password)
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.login_to_mixi(email, password)
|
113
|
+
Mixi.new(email, password)
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.read_tweets(dir_path, file_name)
|
117
|
+
tweets = {}
|
118
|
+
path = File.join(dir_path, file_name)
|
119
|
+
File.open(path) { |file| tweets = YAML.load(file) } if FileTest.exist?(path)
|
120
|
+
tweets
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.write_tweets(dir_path, file_name, tweets)
|
124
|
+
Dir.mkdir(dir_path) unless FileTest.exist?(dir_path)
|
125
|
+
path = File.join(dir_path, file_name)
|
126
|
+
File.open(path, "w+") { |file| YAML.dump(tweets, file) }
|
127
|
+
end
|
128
|
+
|
129
|
+
# ... private code(s) block
|
130
|
+
|
131
|
+
|
132
|
+
end # end of 'Application'
|
133
|
+
|
134
|
+
|
135
|
+
end # end of 'Twitter2MixiVoice'
|
data/lib/mixi.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
# mixi.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "rubygems"
|
10
|
+
require "mechanize"
|
11
|
+
require "kconv"
|
12
|
+
|
13
|
+
|
14
|
+
module Twitter2MixiVoice
|
15
|
+
|
16
|
+
|
17
|
+
# This exception class that is thrown when an errors occur in Mixi class.
|
18
|
+
class MixiException < Exception ; end # end of 'MixiException'
|
19
|
+
|
20
|
+
|
21
|
+
# This class provides mixi functions.
|
22
|
+
class Mixi
|
23
|
+
|
24
|
+
|
25
|
+
VOICE_MAX_LENGTH = 150
|
26
|
+
|
27
|
+
|
28
|
+
# Create Mixi class instance.
|
29
|
+
def initialize(email, password)
|
30
|
+
|
31
|
+
# check parameter.
|
32
|
+
raise MixiException.new("Invalid 'email' parameter .") if email.nil? || email.empty?
|
33
|
+
raise MixiException.new("Invalid 'password' parameter .") if password.nil? || password.empty?
|
34
|
+
|
35
|
+
# login to mixi.
|
36
|
+
begin
|
37
|
+
@agent = WWW::Mechanize.new
|
38
|
+
@agent.get("http://mixi.jp")
|
39
|
+
@agent.page.form_with(:name => "login_form") do |form|
|
40
|
+
form.field_with(:name => "email").value = email
|
41
|
+
form.field_with(:name => "password").value = password
|
42
|
+
form.submit
|
43
|
+
end
|
44
|
+
rescue Exception => e
|
45
|
+
raise MixiException.new(e.to_s)
|
46
|
+
end
|
47
|
+
|
48
|
+
# check login error.
|
49
|
+
error = @agent.page.at("div#errorArea")
|
50
|
+
unless error.nil?
|
51
|
+
raise MixiException.new(error.inner_text)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Post mixi voice.
|
58
|
+
def post_voice(message)
|
59
|
+
|
60
|
+
# check parameter
|
61
|
+
raise MixiException.new("Invalid 'message' parameter.") if message.nil? || message.empty? || message.split(//u).length > VOICE_MAX_LENGTH
|
62
|
+
|
63
|
+
# post voice
|
64
|
+
begin
|
65
|
+
@agent.get("http://mixi.jp/recent_echo.pl")
|
66
|
+
@agent.page.form_with(:action => "add_echo.pl") do |form|
|
67
|
+
form.field_with(:name => "body").value = message
|
68
|
+
form.click_button
|
69
|
+
end
|
70
|
+
rescue Exception => e
|
71
|
+
raise MixiException.new(e.to_s)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end # end of 'Mixi'
|
78
|
+
|
79
|
+
|
80
|
+
end # end of 'Twitter2MixiVoice'
|
data/lib/options.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#
|
2
|
+
# options.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-04.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "optparse"
|
10
|
+
|
11
|
+
|
12
|
+
module Twitter2MixiVoice
|
13
|
+
|
14
|
+
|
15
|
+
# This class provides command line option.
|
16
|
+
class Options < Hash
|
17
|
+
|
18
|
+
|
19
|
+
attr_reader :opts
|
20
|
+
|
21
|
+
|
22
|
+
def initialize(params, version = nil)
|
23
|
+
|
24
|
+
super()
|
25
|
+
|
26
|
+
|
27
|
+
@opts = OptionParser.new do |o|
|
28
|
+
|
29
|
+
o.on("-t", "--twitter_id TWITTER_ID", "login twitter id") do |id|
|
30
|
+
self[:twitter_id] = id
|
31
|
+
end
|
32
|
+
|
33
|
+
o.on("-T", "--twitter_password TWITTER_PASSWORD", "login twitter passowrd") do |password|
|
34
|
+
self[:twitter_password] = password
|
35
|
+
end
|
36
|
+
|
37
|
+
o.on("-m", "--mixi_email MIXI_EMAIL", "login mixi email") do |email|
|
38
|
+
self[:mixi_email] = email
|
39
|
+
end
|
40
|
+
|
41
|
+
o.on("-M", "--mixi_password MIXI_PASSWORD", "login mixi password") do |password|
|
42
|
+
self[:mixi_password] = password
|
43
|
+
end
|
44
|
+
|
45
|
+
o.on("-h", "--help", "#{File.basename($0, ".*")} help") do |help|
|
46
|
+
self[:show_help] = help
|
47
|
+
end
|
48
|
+
|
49
|
+
o.on_tail("-v", "--version", "#{File.basename($0, ".*")} version") do
|
50
|
+
self[:show_version] = "#{File.basename($0, ".*")}: #{version}"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
begin
|
57
|
+
@opts.parse!(params)
|
58
|
+
rescue OptionParser::InvalidOption => e
|
59
|
+
self[:invalid_argument] = e.message
|
60
|
+
rescue OptionParser::InvalidArgument => e
|
61
|
+
self[:invalid_argument] = e.message
|
62
|
+
rescue OptionParser::MissingArgument => e
|
63
|
+
self[:invalid_argument] = e.message
|
64
|
+
rescue OptionParser::NeedlessArgument => e
|
65
|
+
self[:invalid_argument] = e.message
|
66
|
+
rescue OptionParser::ParseError => e
|
67
|
+
self[:invalid_argument] = e.message
|
68
|
+
rescue Exception => e
|
69
|
+
self[:invalid_argument] = e.message
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# check authorized parameter.
|
74
|
+
if self[:show_version].nil? && self[:show_help].nil?
|
75
|
+
self[:invalid_argument] = "invalid argument" if self[:twitter_id].nil? || self[:twitter_password].nil? || self[:mixi_email].nil? || self[:mixi_password].nil?
|
76
|
+
end
|
77
|
+
|
78
|
+
end # end of 'initialize'
|
79
|
+
|
80
|
+
|
81
|
+
end # end of 'Options'
|
82
|
+
|
83
|
+
|
84
|
+
end # end of 'Twitter2MixiVoice'
|
data/lib/tweet.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# tweet.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
|
10
|
+
module Twitter2MixiVoice
|
11
|
+
|
12
|
+
|
13
|
+
# This class provides 'tweet' data model of twitter.
|
14
|
+
class Tweet
|
15
|
+
attr_accessor :id, :text, :created_at
|
16
|
+
end # end of 'Tweet'
|
17
|
+
|
18
|
+
|
19
|
+
end # end of 'Twitter2MixiVoice'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# twitter_2_mixi_voice.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
|
10
|
+
# This module is posted tweet of twitter to mixi voice.
|
11
|
+
module Twitter2MixiVoice
|
12
|
+
|
13
|
+
|
14
|
+
require "mixi"
|
15
|
+
require "twitter_client"
|
16
|
+
require "tweet"
|
17
|
+
require "application"
|
18
|
+
require "options"
|
19
|
+
|
20
|
+
|
21
|
+
# Get +Twitter2MixiVoice+ module version.
|
22
|
+
def self.version
|
23
|
+
version = nil
|
24
|
+
begin
|
25
|
+
version_path = File.join(File.dirname(__FILE__), "..", "VERSION")
|
26
|
+
version = File.exist?(version_path) ? File.read(version_path) : ""
|
27
|
+
rescue Exception => e
|
28
|
+
version = ""
|
29
|
+
end
|
30
|
+
version
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end # end of 'Twitter2MixiVoice'
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#
|
2
|
+
# twitter_client.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "rubygems"
|
10
|
+
require "twitter"
|
11
|
+
require "tweet"
|
12
|
+
|
13
|
+
|
14
|
+
module Twitter2MixiVoice
|
15
|
+
|
16
|
+
|
17
|
+
# This exception class that is thrown when an errors occur in TwitterClient class.
|
18
|
+
class TwitterException < Exception ; end # end of 'TwitterException'
|
19
|
+
|
20
|
+
|
21
|
+
# This class provides twitter functions.
|
22
|
+
class TwitterClient
|
23
|
+
|
24
|
+
|
25
|
+
# Create TwitterClient class instance.
|
26
|
+
def initialize(id, password)
|
27
|
+
|
28
|
+
# check parameter.
|
29
|
+
raise TwitterException.new("Invalid 'id' parameter.") if id.nil? || id.empty?
|
30
|
+
raise TwitterException.new("Invalid 'password' password.") if password.nil? || password.empty?
|
31
|
+
|
32
|
+
# login to twitter.
|
33
|
+
begin
|
34
|
+
@client = Twitter::Client.new(:login => id, :password => password)
|
35
|
+
rescue Exception => e
|
36
|
+
raise TwitterException.new(e.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
# check authenticate.
|
40
|
+
unless @client.authenticate?(id, password)
|
41
|
+
raise TwitterException.new("Not authenticate.")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Get tweets from timeline.
|
48
|
+
def get_tweets_from_timeline
|
49
|
+
|
50
|
+
# initialize tweets
|
51
|
+
tweets = []
|
52
|
+
|
53
|
+
# add that get status from timeline in tweet collection.
|
54
|
+
begin
|
55
|
+
|
56
|
+
# insert status in tweet collection.
|
57
|
+
@client.timeline_for(:me) do |status|
|
58
|
+
tweet = Tweet.new
|
59
|
+
tweet.id = status.id.to_i
|
60
|
+
tweet.text = status.text
|
61
|
+
tweet.created_at = status.created_at
|
62
|
+
tweets << tweet
|
63
|
+
end
|
64
|
+
|
65
|
+
# sort tweet collection.
|
66
|
+
unless tweets.empty?
|
67
|
+
tweets = tweets.sort do |a, b|
|
68
|
+
a.created_at.to_f <=> b.created_at.to_f
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
rescue Exception => e
|
73
|
+
raise TwitterException.new(e.to_s)
|
74
|
+
end
|
75
|
+
|
76
|
+
# return tweets.
|
77
|
+
tweets
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
end # end of 'TwitterClient'
|
83
|
+
|
84
|
+
|
85
|
+
end # end of 'Twitter2MixiVoice'
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#
|
2
|
+
# test_application.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
require "yaml"
|
12
|
+
require "stringio"
|
13
|
+
|
14
|
+
|
15
|
+
class TestApplication < Test::Unit::TestCase
|
16
|
+
|
17
|
+
|
18
|
+
Settings = YAML.load_file(File.join(File.dirname(__FILE__), "..", "config", "settings.yml"))
|
19
|
+
Success, Error = 0, 1
|
20
|
+
|
21
|
+
|
22
|
+
# helper method code(s) block ...
|
23
|
+
|
24
|
+
def twitter_id; Settings["twitter_account"]["id"]; end
|
25
|
+
|
26
|
+
def twitter_password; Settings["twitter_account"]["password"]; end
|
27
|
+
|
28
|
+
def mixi_email; Settings["mixi_account"]["email"]; end
|
29
|
+
|
30
|
+
def mixi_password; Settings["mixi_account"]["password"]; end
|
31
|
+
|
32
|
+
def run_application(params)
|
33
|
+
|
34
|
+
org_stdout = $stdout
|
35
|
+
org_stderr = $stderr
|
36
|
+
fake_stdout = StringIO.new
|
37
|
+
fake_stderr = StringIO.new
|
38
|
+
|
39
|
+
result = nil
|
40
|
+
begin
|
41
|
+
result = Twitter2MixiVoice::Application.run(params)
|
42
|
+
ensure
|
43
|
+
$stdout = org_stdout
|
44
|
+
$stderr = org_stderr
|
45
|
+
end
|
46
|
+
|
47
|
+
@stdout = fake_stdout.string
|
48
|
+
@stderr = fake_stderr.string
|
49
|
+
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
# ... helper method code(s)
|
54
|
+
|
55
|
+
|
56
|
+
# test code(s) block ...
|
57
|
+
|
58
|
+
def test_run_auth_option
|
59
|
+
|
60
|
+
options = []
|
61
|
+
options << ["-t", twitter_id, "-T", twitter_password, "-m", mixi_email, "-M", mixi_password] # short
|
62
|
+
options << ["--twitter_id", twitter_id, "--twitter_password", twitter_password, "--mixi_email", mixi_email, "--mixi_password", mixi_password] # long
|
63
|
+
options.each do |option|
|
64
|
+
assert_equal(Twitter2MixiVoice::Success, run_application(option))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def test_run_none_password_auth_option
|
70
|
+
option = ["-t", twitter_id, "--mixi_email", mixi_email]
|
71
|
+
assert_equal(Twitter2MixiVoice::Error, run_application(option))
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
def test_run_version_option
|
76
|
+
options = [["-v"], ["--version"]] # short & long
|
77
|
+
options.each do |option|
|
78
|
+
assert_equal(Twitter2MixiVoice::Success, run_application(option))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
def test_run_help_option
|
84
|
+
options = [["-h"], ["--help"]] # short & long
|
85
|
+
options.each do |option|
|
86
|
+
assert_equal(Twitter2MixiVoice::Error, run_application(option))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def test_run_option_invalid_undefine
|
92
|
+
assert_equal(Twitter2MixiVoice::Error, run_application([] << "--invalied"))
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
def test_run_option_empty
|
97
|
+
assert_equal(Twitter2MixiVoice::Error, run_application([]))
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
def test_posted_tweets_data
|
102
|
+
file_path = File.join(ENV["HOME"], ".twitter2mixivoice", "posted_tweets.yml")
|
103
|
+
run_application(["--twitter_id", twitter_id, "--twitter_password", twitter_password, "--mixi_email", mixi_email, "--mixi_password", mixi_password])
|
104
|
+
assert(FileTest.exist?(file_path))
|
105
|
+
end
|
106
|
+
|
107
|
+
# ... test code(s) block
|
108
|
+
|
109
|
+
|
110
|
+
end # end of 'TestApplication'
|
data/test/test_mixi.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#
|
2
|
+
# test_mixi.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
require "yaml"
|
12
|
+
|
13
|
+
|
14
|
+
class TestMixi < Test::Unit::TestCase
|
15
|
+
|
16
|
+
|
17
|
+
Settings = YAML.load_file(File.join(File.dirname(__FILE__), "..", "config", "settings.yml"))
|
18
|
+
|
19
|
+
|
20
|
+
# helper methods code block ...
|
21
|
+
|
22
|
+
def email; Settings["mixi_account"]["email"]; end
|
23
|
+
|
24
|
+
def password; Settings["mixi_account"]["password"]; end
|
25
|
+
|
26
|
+
def create_mixi(email, password)
|
27
|
+
Twitter2MixiVoice::Mixi.new(email, password)
|
28
|
+
end
|
29
|
+
|
30
|
+
# ... helper methods code block
|
31
|
+
|
32
|
+
|
33
|
+
# tests code block ...
|
34
|
+
|
35
|
+
def test_initialize
|
36
|
+
mixi = create_mixi(self.email, self.password)
|
37
|
+
assert_not_nil mixi
|
38
|
+
mixi
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def test_initialize_param_error
|
43
|
+
|
44
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi("", "") }
|
45
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi(email, "") }
|
46
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi("", password) }
|
47
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi(email, nil) }
|
48
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi(nil, password) }
|
49
|
+
|
50
|
+
# TODO: should be special data('/','¥', '\', etc ...) check
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def test_initialize_auth_error
|
56
|
+
assert_raise(Twitter2MixiVoice::MixiException) { create_mixi("hoge", "hoge") }
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def test_add_voice
|
61
|
+
mixi = test_initialize
|
62
|
+
mixi.post_voice "hello world."
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def test_add_voice_param_error
|
67
|
+
|
68
|
+
mixi = test_initialize
|
69
|
+
mixi_voice_max_length = 150
|
70
|
+
assert_raise(Twitter2MixiVoice::MixiException) { mixi.post_voice("") }
|
71
|
+
assert_raise(Twitter2MixiVoice::MixiException) { mixi.post_voice(nil) }
|
72
|
+
assert_nothing_raised(Twitter2MixiVoice::MixiException) { mixi.post_voice("a" * (mixi_voice_max_length - 1)) }
|
73
|
+
assert_nothing_raised(Twitter2MixiVoice::MixiException) { mixi.post_voice("a" * mixi_voice_max_length) }
|
74
|
+
assert_raise(Twitter2MixiVoice::MixiException) { mixi.post_voice("a" * (mixi_voice_max_length + 1)) }
|
75
|
+
assert_nothing_raised(Twitter2MixiVoice::MixiException) { mixi.post_voice("あ" * (mixi_voice_max_length - 1)) }
|
76
|
+
assert_nothing_raised(Twitter2MixiVoice::MixiException) { mixi.post_voice("あ" * mixi_voice_max_length) }
|
77
|
+
assert_raise(Twitter2MixiVoice::MixiException) { mixi.post_voice("あ" * (mixi_voice_max_length + 1)) }
|
78
|
+
|
79
|
+
# TODO: should be special data('/','¥', '\', etc ...) check
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
# ... tests code block
|
84
|
+
|
85
|
+
|
86
|
+
end # end of 'TestMixi'
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#
|
2
|
+
# test_options.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-04.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
|
12
|
+
|
13
|
+
class TestOptions < Test::Unit::TestCase
|
14
|
+
|
15
|
+
|
16
|
+
Version = "1.0.1"
|
17
|
+
|
18
|
+
|
19
|
+
# helper method code(s) block ...
|
20
|
+
|
21
|
+
def verify_options(params, version = nil)
|
22
|
+
params.each do |data, proc|
|
23
|
+
options = Twitter2MixiVoice::Options.new(data, version)
|
24
|
+
proc.call(options) if proc
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# ... helper method code(s) block
|
29
|
+
|
30
|
+
|
31
|
+
# test code(s) block ...
|
32
|
+
|
33
|
+
def test_help_option
|
34
|
+
|
35
|
+
proc = Proc.new do |options|
|
36
|
+
assert(options[:show_help])
|
37
|
+
assert_match(/Usage:/, options.opts.to_s)
|
38
|
+
assert_nil(options[:invalid_argument])
|
39
|
+
end
|
40
|
+
|
41
|
+
help_options = {}
|
42
|
+
help_options[["-h"]] = proc
|
43
|
+
help_options[["--help"]] = proc
|
44
|
+
|
45
|
+
verify_options(help_options)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def test_version_option
|
51
|
+
|
52
|
+
proc = Proc.new do |options|
|
53
|
+
assert(options[:show_version])
|
54
|
+
assert_match(/: #{Version}/, options[:show_version])
|
55
|
+
assert_nil(options[:invalid_argument])
|
56
|
+
end
|
57
|
+
|
58
|
+
version_options = {}
|
59
|
+
version_options[["-v"]] = proc
|
60
|
+
version_options[["--version"]] = proc
|
61
|
+
|
62
|
+
verify_options(version_options, Version)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def test_auth_options
|
68
|
+
|
69
|
+
auth_options = {}
|
70
|
+
|
71
|
+
auth_options[["--twitter_id", "twitter", "-T", "tweet", "--mixi_email", "user@mixi.jp", "-M", "voice"]] = Proc.new do |options|
|
72
|
+
assert_nil(options[:invalid_argument])
|
73
|
+
assert_not_nil(options[:twitter_id])
|
74
|
+
assert_not_nil(options[:twitter_password])
|
75
|
+
assert_not_nil(options[:mixi_email])
|
76
|
+
assert_not_nil(options[:mixi_password])
|
77
|
+
end
|
78
|
+
|
79
|
+
auth_options[["-t", "twitter", "-m", "user@mixi.jp"]] = Proc.new do |options|
|
80
|
+
assert_not_nil(options[:invalid_argument])
|
81
|
+
assert_not_nil(options[:twitter_id])
|
82
|
+
assert_nil(options[:twitter_password])
|
83
|
+
assert_not_nil(options[:mixi_email])
|
84
|
+
assert_nil(options[:mixi_password])
|
85
|
+
end
|
86
|
+
|
87
|
+
verify_options(auth_options)
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
def test_empty_options
|
93
|
+
|
94
|
+
options = {}
|
95
|
+
|
96
|
+
options[[""]] = Proc.new do |options|
|
97
|
+
assert_not_nil(options[:invalid_argument])
|
98
|
+
end
|
99
|
+
|
100
|
+
verify_options(options)
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
# ... test code(s) block
|
105
|
+
|
106
|
+
|
107
|
+
end # end of 'TestOptions'
|
data/test/test_tweet.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# test_tweet.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
|
12
|
+
|
13
|
+
class TestTweet < Test::Unit::TestCase
|
14
|
+
|
15
|
+
|
16
|
+
def test_tweet
|
17
|
+
|
18
|
+
tweet = Twitter2MixiVoice::Tweet.new
|
19
|
+
tweet.id = 12345
|
20
|
+
tweet.text = "hello world."
|
21
|
+
tweet.created_at = Time.now
|
22
|
+
|
23
|
+
assert_equal(12345, tweet.id)
|
24
|
+
assert_equal("hello world.", tweet.text)
|
25
|
+
assert(Time.now > tweet.created_at)
|
26
|
+
|
27
|
+
tweet
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end # end of 'TestTweet'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# test_twitter_2_mixi_voice.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-04.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
|
12
|
+
|
13
|
+
class TestTwitter2MixiVoice < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def test_version
|
16
|
+
assert_not_nil(Twitter2MixiVoice::version)
|
17
|
+
puts "Twitter2MixiVoice version : #{Twitter2MixiVoice::version}"
|
18
|
+
end
|
19
|
+
|
20
|
+
end # end of 'TestTwitter2MixiVoice'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# test_twitter_client.rb
|
3
|
+
# Twitter2MixiVoice
|
4
|
+
#
|
5
|
+
# Created by kazuya kawaguchi on 2009-11-03.
|
6
|
+
# Copyright 2009 kazuya kawaguchi. All rights reserved.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "test/unit"
|
10
|
+
require "twitter_2_mixi_voice"
|
11
|
+
require "yaml"
|
12
|
+
|
13
|
+
|
14
|
+
class TestTwitterClient < Test::Unit::TestCase
|
15
|
+
|
16
|
+
|
17
|
+
Settings = YAML.load_file(File.join(File.dirname(__FILE__), "..", "config", "settings.yml"))
|
18
|
+
|
19
|
+
|
20
|
+
# helper method code(s) block ...
|
21
|
+
|
22
|
+
def id; Settings["twitter_account"]["id"]; end
|
23
|
+
|
24
|
+
def password; Settings["twitter_account"]["password"]; end
|
25
|
+
|
26
|
+
def create_twitter(id, password)
|
27
|
+
Twitter2MixiVoice::TwitterClient.new(id, password)
|
28
|
+
end
|
29
|
+
|
30
|
+
# ... helper method code(s) block
|
31
|
+
|
32
|
+
|
33
|
+
# test code(s) block ...
|
34
|
+
|
35
|
+
def test_initialize
|
36
|
+
twitter = create_twitter(self.id, self.password)
|
37
|
+
assert_not_nil(twitter)
|
38
|
+
twitter
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def test_initialize_param_error
|
43
|
+
|
44
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter("", "") }
|
45
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter(self.id, "") }
|
46
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter("", self.password) }
|
47
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter(self.id, nil) }
|
48
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter(nil, self.password) }
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def test_initialize_auth_error
|
54
|
+
assert_raise(Twitter2MixiVoice::TwitterException) { create_twitter("hoge", "hoge") }
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def test_get_tweets_from_timeline
|
59
|
+
twitter = test_initialize
|
60
|
+
tweets = twitter.get_tweets_from_timeline
|
61
|
+
assert_not_nil(tweets)
|
62
|
+
tweets.each do |tweet|
|
63
|
+
assert_not_nil(tweet.id)
|
64
|
+
assert_not_nil(tweet.text)
|
65
|
+
assert(Time.now > tweet.created_at)
|
66
|
+
puts("id = #{tweet.id}, text = #{tweet.text}, created_at = #{tweet.created_at}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# ... test code(s) block
|
71
|
+
|
72
|
+
|
73
|
+
end # end of 'TestTwitterClient'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{twitter2mixivoice}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["kazuya kawaguchi"]
|
12
|
+
s.date = %q{2009-11-08}
|
13
|
+
s.default_executable = %q{twitter_2_mixi_voice}
|
14
|
+
s.description = %q{Post twitter tweet to mixi voice.}
|
15
|
+
s.email = %q{kawakazu80@gmail.com}
|
16
|
+
s.executables = ["twitter_2_mixi_voice"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"CHANGELOG.rdoc",
|
25
|
+
"LICENSE",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/twitter_2_mixi_voice",
|
30
|
+
"lib/application.rb",
|
31
|
+
"lib/mixi.rb",
|
32
|
+
"lib/options.rb",
|
33
|
+
"lib/tweet.rb",
|
34
|
+
"lib/twitter_2_mixi_voice.rb",
|
35
|
+
"lib/twitter_client.rb",
|
36
|
+
"test/test_application.rb",
|
37
|
+
"test/test_mixi.rb",
|
38
|
+
"test/test_options.rb",
|
39
|
+
"test/test_tweet.rb",
|
40
|
+
"test/test_twitter_2_mixi_voice.rb",
|
41
|
+
"test/test_twitter_client.rb"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/kazupon/Twitter2MixiVoice}
|
44
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.5}
|
47
|
+
s.summary = %q{twitter2mixivoice}
|
48
|
+
s.test_files = [
|
49
|
+
"test/test_application.rb",
|
50
|
+
"test/test_mixi.rb",
|
51
|
+
"test/test_options.rb",
|
52
|
+
"test/test_tweet.rb",
|
53
|
+
"test/test_twitter_2_mixi_voice.rb",
|
54
|
+
"test/test_twitter_client.rb"
|
55
|
+
]
|
56
|
+
|
57
|
+
if s.respond_to? :specification_version then
|
58
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
59
|
+
s.specification_version = 3
|
60
|
+
|
61
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
62
|
+
else
|
63
|
+
end
|
64
|
+
else
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: twitter2mixivoice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kazuya kawaguchi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-08 00:00:00 +09:00
|
13
|
+
default_executable: twitter2mixivoice
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Post twitter tweet to mixi voice.
|
17
|
+
email: kawakazu80@gmail.com
|
18
|
+
executables:
|
19
|
+
- twitter2mixivoice
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- CHANGELOG.rdoc
|
29
|
+
- LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
- Rakefile
|
32
|
+
- VERSION
|
33
|
+
- bin/twitter2mixivoice
|
34
|
+
- lib/application.rb
|
35
|
+
- lib/mixi.rb
|
36
|
+
- lib/options.rb
|
37
|
+
- lib/tweet.rb
|
38
|
+
- lib/twitter_2_mixi_voice.rb
|
39
|
+
- lib/twitter_client.rb
|
40
|
+
- test/test_application.rb
|
41
|
+
- test/test_mixi.rb
|
42
|
+
- test/test_options.rb
|
43
|
+
- test/test_tweet.rb
|
44
|
+
- test/test_twitter_2_mixi_voice.rb
|
45
|
+
- test/test_twitter_client.rb
|
46
|
+
- twitter2mixivoice.gemspec
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://github.com/kazupon/Twitter2MixiVoice
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --charset=UTF-8
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: twitter2mixivoice
|
75
|
+
test_files:
|
76
|
+
- test/test_application.rb
|
77
|
+
- test/test_mixi.rb
|
78
|
+
- test/test_options.rb
|
79
|
+
- test/test_tweet.rb
|
80
|
+
- test/test_twitter_2_mixi_voice.rb
|
81
|
+
- test/test_twitter_client.rb
|