tweetwine 0.3.0 → 0.3.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/CHANGELOG.rdoc +5 -0
- data/Gemfile +1 -1
- data/Rakefile +19 -7
- data/contrib/tweetwine-completion.bash +2 -2
- data/lib/tweetwine/twitter.rb +1 -1
- data/lib/tweetwine.rb +1 -1
- data/test/example/example_helper.rb +64 -0
- data/test/test_helper.rb +1 -106
- data/test/{character_encoding_test.rb → unit/character_encoding_test.rb} +1 -1
- data/test/{cli_test.rb → unit/cli_test.rb} +2 -1
- data/test/{config_test.rb → unit/config_test.rb} +1 -1
- data/test/{http_test.rb → unit/http_test.rb} +1 -1
- data/test/{oauth_test.rb → unit/oauth_test.rb} +2 -1
- data/test/{obfuscate_test.rb → unit/obfuscate_test.rb} +1 -1
- data/test/{option_parser_test.rb → unit/option_parser_test.rb} +1 -1
- data/test/{promise_test.rb → unit/promise_test.rb} +1 -1
- data/test/{twitter_test.rb → unit/twitter_test.rb} +3 -4
- data/test/{ui_test.rb → unit/ui_test.rb} +1 -1
- data/test/unit/unit_helper.rb +116 -0
- data/test/{url_shortener_test.rb → unit/url_shortener_test.rb} +1 -1
- data/test/{util_test.rb → unit/util_test.rb} +2 -1
- data/tweetwine.gemspec +2 -3
- metadata +42 -55
- data/example/example_helper.rb +0 -69
- /data/{example → test/example}/application_behavior_example.rb +0 -0
- /data/{example → test/example}/search_statuses_example.rb +0 -0
- /data/{example → test/example}/show_followers_example.rb +0 -0
- /data/{example → test/example}/show_friends_example.rb +0 -0
- /data/{example → test/example}/show_home_example.rb +0 -0
- /data/{example → test/example}/show_mentions_example.rb +0 -0
- /data/{example → test/example}/show_user_example.rb +0 -0
- /data/{example → test/example}/update_status_example.rb +0 -0
- /data/{example → test/example}/use_http_proxy_example.rb +0 -0
- /data/{example/fixture/config.yaml → test/fixture/config_example.yaml} +0 -0
- /data/test/fixture/{test_config.yaml → config_unit.yaml} +0 -0
- /data/{example → test}/fixture/home.json +0 -0
- /data/{example → test}/fixture/mentions.json +0 -0
- /data/{example → test}/fixture/search.json +0 -0
- /data/{example → test}/fixture/shorten_rubygems.html +0 -0
- /data/{example → test}/fixture/shorten_rubylang.html +0 -0
- /data/{example → test}/fixture/update_utf8.json +0 -0
- /data/{example → test}/fixture/update_with_urls.json +0 -0
- /data/{example → test}/fixture/update_without_urls.json +0 -0
- /data/{example → test}/fixture/user.json +0 -0
- /data/{example → test}/fixture/users.json +0 -0
data/CHANGELOG.rdoc
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -43,21 +43,33 @@ namespace :man do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
namespace :test do
|
46
|
-
def create_test_task(type,
|
47
|
-
|
46
|
+
def create_test_task(type, options = {})
|
47
|
+
base_dir = options[:base_dir]
|
48
|
+
file_glob = options[:file_glob]
|
48
49
|
test_desc = options[:desc] || "Run #{type} tests"
|
49
|
-
includes =
|
50
|
-
warn_opt = options[:warn] ?
|
50
|
+
includes = ['lib', 'test', base_dir].map { |dir| "-I #{dir}" }.join(' ')
|
51
|
+
warn_opt = options[:warn] ? '-w' : ''
|
51
52
|
|
52
53
|
desc test_desc
|
53
54
|
task type do
|
54
|
-
|
55
|
+
file_name_offset = base_dir.size + 1
|
56
|
+
neg_dotrb_suffix = -'.rb'.size - 1
|
57
|
+
tests = FileList["#{base_dir}/#{file_glob}"].
|
58
|
+
map { |file| '"' << file[file_name_offset..neg_dotrb_suffix] << '"' }.
|
59
|
+
join(' ')
|
55
60
|
sh %{bundle exec ruby #{warn_opt} #{includes} -e 'ARGV.each { |f| require f }' #{tests}}
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
59
|
-
create_test_task :unit,
|
60
|
-
|
64
|
+
create_test_task :unit,
|
65
|
+
:base_dir => 'test/unit',
|
66
|
+
:file_glob => '**/*_test.rb',
|
67
|
+
:warn => true
|
68
|
+
create_test_task :example,
|
69
|
+
:base_dir => 'test/example',
|
70
|
+
:file_glob => '**/*_example.rb',
|
71
|
+
:desc => 'Run integration/example tests',
|
72
|
+
:warn => false
|
61
73
|
|
62
74
|
desc "Run all tests"
|
63
75
|
task :all => [:unit, :example]
|
@@ -2,8 +2,8 @@ _tweetwine_completion() {
|
|
2
2
|
local cur prev cmds gopts
|
3
3
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
4
4
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
5
|
-
cmds="followers friends home mentions search update user"
|
6
|
-
gopts="--colors --help --http-proxy --
|
5
|
+
cmds="followers friends help home mentions search update user version"
|
6
|
+
gopts="--colors --config --help --http-proxy --no-colors --no-http-proxy --no-url-shorten --num --page --username --version"
|
7
7
|
|
8
8
|
case "${prev}" in
|
9
9
|
followers | friends | home | mentions | search | update | user)
|
data/lib/tweetwine/twitter.rb
CHANGED
@@ -194,7 +194,7 @@ module Tweetwine
|
|
194
194
|
|
195
195
|
def shorten_urls_in(status)
|
196
196
|
url_pairs = URI.
|
197
|
-
extract(status, %w{http
|
197
|
+
extract(status, %w{http https}).
|
198
198
|
uniq.
|
199
199
|
map { |full_url| [full_url, CLI.url_shortener.shorten(full_url)] }.
|
200
200
|
reject { |(full_url, short_url)| Util.blank? short_url }
|
data/lib/tweetwine.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
%w{
|
4
|
+
coulda
|
5
|
+
matchy
|
6
|
+
open4
|
7
|
+
stringio
|
8
|
+
tempfile
|
9
|
+
time
|
10
|
+
timecop
|
11
|
+
}.each { |lib| require lib }
|
12
|
+
|
13
|
+
Timecop.freeze(Time.parse("2009-10-14 01:56:15 +0300"))
|
14
|
+
|
15
|
+
require "test_helper"
|
16
|
+
|
17
|
+
module Tweetwine::Test
|
18
|
+
module Helper
|
19
|
+
include WebMock::API
|
20
|
+
|
21
|
+
CONFIG_FILE = fixture_file('config_example.yaml')
|
22
|
+
PROJECT_DIR = File.expand_path('../..', File.dirname(__FILE__))
|
23
|
+
PROXY_HOST = "proxy.net"
|
24
|
+
PROXY_PORT = 8123
|
25
|
+
PROXY_URL = "http://#{PROXY_HOST}:#{PROXY_PORT}"
|
26
|
+
USER = "fooman"
|
27
|
+
|
28
|
+
def start_app(args, &blk)
|
29
|
+
lib = PROJECT_DIR + '/lib'
|
30
|
+
executable = PROJECT_DIR + '/bin/tweetwine'
|
31
|
+
launch_cmd = "env USER='#{USER}' ruby -rubygems -I #{lib} -- #{executable} -f #{CONFIG_FILE} #{args.join(' ')}"
|
32
|
+
Open4::popen4(launch_cmd, &blk)
|
33
|
+
end
|
34
|
+
|
35
|
+
def start_cli(args, input = [], options = {:config_file => CONFIG_FILE})
|
36
|
+
input, output = StringIO.new(input.join("\n")), StringIO.new
|
37
|
+
options.merge!({ :in => input, :out => output })
|
38
|
+
CLI.start(args, options)
|
39
|
+
output.string.split("\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
def fixture(filename)
|
43
|
+
File.open(fixture_file(filename)) do |f|
|
44
|
+
f.readlines.join("\n")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def in_temp_dir
|
49
|
+
Dir.mktmpdir do |tmp_dir|
|
50
|
+
Dir.chdir(tmp_dir) do |dir|
|
51
|
+
yield dir
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def read_shorten_config
|
57
|
+
Util.symbolize_hash_keys(YAML.load_file(CONFIG_FILE))[:shorten_urls]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
include Coulda
|
63
|
+
include Tweetwine
|
64
|
+
include Tweetwine::Test::Helper
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
require "tweetwine"
|
4
|
-
|
5
|
-
require "json" # for webmock
|
6
|
-
require "mocha"
|
4
|
+
|
7
5
|
require "webmock/test_unit"
|
8
6
|
|
9
|
-
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
10
7
|
WebMock.disable_net_connect!
|
11
8
|
|
12
9
|
module Tweetwine
|
@@ -14,50 +11,6 @@ module Tweetwine
|
|
14
11
|
module Helper
|
15
12
|
extend self
|
16
13
|
|
17
|
-
def create_test_twitter_status_records_from_rest_api(*internal_records)
|
18
|
-
twitter_records = internal_records.map do |internal_record|
|
19
|
-
{
|
20
|
-
"user" => { "screen_name" => internal_record[:from_user] },
|
21
|
-
"created_at" => internal_record[:created_at],
|
22
|
-
"text" => internal_record[:status],
|
23
|
-
"in_reply_to_screen_name" => internal_record[:to_user]
|
24
|
-
}
|
25
|
-
end
|
26
|
-
[twitter_records, internal_records]
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_test_twitter_user_records_from_rest_api(*internal_records)
|
30
|
-
twitter_records = internal_records.map do |internal_record|
|
31
|
-
twitter_record = { "screen_name" => internal_record[:from_user] }
|
32
|
-
if internal_record[:status]
|
33
|
-
twitter_record.merge!({
|
34
|
-
"status" => {
|
35
|
-
"created_at" => internal_record[:created_at],
|
36
|
-
"text" => internal_record[:status],
|
37
|
-
"in_reply_to_screen_name" => internal_record[:to_user],
|
38
|
-
}
|
39
|
-
})
|
40
|
-
end
|
41
|
-
twitter_record
|
42
|
-
end
|
43
|
-
[twitter_records, internal_records]
|
44
|
-
end
|
45
|
-
|
46
|
-
def create_test_twitter_records_from_search_api(*internal_records)
|
47
|
-
twitter_search_records = internal_records.map do |internal_record|
|
48
|
-
{
|
49
|
-
"from_user" => internal_record[:from_user],
|
50
|
-
"created_at" => internal_record[:created_at],
|
51
|
-
"text" => internal_record[:status],
|
52
|
-
"to_user" => internal_record[:to_user]
|
53
|
-
}
|
54
|
-
end
|
55
|
-
twitter_records = {
|
56
|
-
"results" => twitter_search_records
|
57
|
-
}
|
58
|
-
[twitter_records, internal_records]
|
59
|
-
end
|
60
|
-
|
61
14
|
def file_mode(file)
|
62
15
|
File.stat(file).mode & 0777
|
63
16
|
end
|
@@ -88,63 +41,5 @@ module Tweetwine
|
|
88
41
|
$KCODE = original
|
89
42
|
end
|
90
43
|
end
|
91
|
-
|
92
|
-
module Doubles
|
93
|
-
def mock_config
|
94
|
-
@config = mock('Config')
|
95
|
-
CLI.stubs(:config).returns(@config)
|
96
|
-
end
|
97
|
-
|
98
|
-
def mock_http
|
99
|
-
@http = mock('Http')
|
100
|
-
CLI.stubs(:http).returns(@http)
|
101
|
-
end
|
102
|
-
|
103
|
-
def mock_oauth
|
104
|
-
@oauth = mock('OAuth')
|
105
|
-
CLI.stubs(:oauth).returns(@oauth)
|
106
|
-
end
|
107
|
-
|
108
|
-
def mock_ui
|
109
|
-
@ui = mock('UI')
|
110
|
-
CLI.stubs(:ui).returns(@ui)
|
111
|
-
end
|
112
|
-
|
113
|
-
def mock_url_shortener
|
114
|
-
@url_shortener = mock('UrlShortener')
|
115
|
-
CLI.stubs(:url_shortener).returns(@url_shortener)
|
116
|
-
end
|
117
|
-
|
118
|
-
def stub_config(options = {})
|
119
|
-
@config = options
|
120
|
-
CLI.stubs(:config).returns(@config)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
module Assertions
|
125
|
-
def assert_contains_in_order(expected, actual, msg = "", &sorter)
|
126
|
-
expected = block_given? ? expected.sort(&sorter) : expected.sort
|
127
|
-
actual = block_given? ? actual.sort(&sorter) : actual.sort
|
128
|
-
assert_equal(expected, actual, msg)
|
129
|
-
end
|
130
|
-
|
131
|
-
def assert_full_match(regex, str, msg = "")
|
132
|
-
match_data = regex.match(str)
|
133
|
-
assert(str == match_data.to_s, msg)
|
134
|
-
end
|
135
|
-
|
136
|
-
def assert_no_full_match(regex, str, msg = "")
|
137
|
-
match_data = regex.match(str)
|
138
|
-
assert(str != match_data.to_s, msg)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
class UnitTestCase < ::Test::Unit::TestCase
|
143
|
-
include WebMock::API
|
144
|
-
include Tweetwine
|
145
|
-
include Helper
|
146
|
-
include Doubles
|
147
|
-
include Assertions
|
148
|
-
end
|
149
44
|
end
|
150
45
|
end
|
@@ -9,7 +9,7 @@ require "yaml"
|
|
9
9
|
module Tweetwine::Test
|
10
10
|
|
11
11
|
class ConfigTest < UnitTestCase
|
12
|
-
CONFIG_FILE = Helper.fixture_file(
|
12
|
+
CONFIG_FILE = Helper.fixture_file('config_unit.yaml')
|
13
13
|
|
14
14
|
context "when given command line arguments, no environment variables, no config file" do
|
15
15
|
setup do
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "json"
|
3
|
+
require "unit_helper"
|
5
4
|
|
6
5
|
module Tweetwine::Test
|
7
6
|
|
@@ -353,8 +352,8 @@ class ClientTest < UnitTestCase
|
|
353
352
|
@twitter.update(status)
|
354
353
|
end
|
355
354
|
|
356
|
-
should "shorten
|
357
|
-
long_urls = ["http://www.google.fi/search?q=ruby+nokogiri&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a", "
|
355
|
+
should "shorten HTTP and HTTPS URLs" do
|
356
|
+
long_urls = ["http://www.google.fi/search?q=ruby+nokogiri&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a", "https://twitter.com/#!/messages"]
|
358
357
|
long_status = long_urls.join(" and ")
|
359
358
|
short_urls = ["http://shorten.it/2k7i8", "http://shorten.it/2k7mk"]
|
360
359
|
shortened_status = short_urls.join(" and ")
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require "test_helper"
|
4
|
+
|
5
|
+
require "contest"
|
6
|
+
require "mocha"
|
7
|
+
|
8
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
9
|
+
|
10
|
+
module Tweetwine::Test
|
11
|
+
module Helper
|
12
|
+
extend self
|
13
|
+
|
14
|
+
def create_test_twitter_status_records_from_rest_api(*internal_records)
|
15
|
+
twitter_records = internal_records.map do |internal_record|
|
16
|
+
{
|
17
|
+
"user" => { "screen_name" => internal_record[:from_user] },
|
18
|
+
"created_at" => internal_record[:created_at],
|
19
|
+
"text" => internal_record[:status],
|
20
|
+
"in_reply_to_screen_name" => internal_record[:to_user]
|
21
|
+
}
|
22
|
+
end
|
23
|
+
[twitter_records, internal_records]
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_test_twitter_user_records_from_rest_api(*internal_records)
|
27
|
+
twitter_records = internal_records.map do |internal_record|
|
28
|
+
twitter_record = { "screen_name" => internal_record[:from_user] }
|
29
|
+
if internal_record[:status]
|
30
|
+
twitter_record.merge!({
|
31
|
+
"status" => {
|
32
|
+
"created_at" => internal_record[:created_at],
|
33
|
+
"text" => internal_record[:status],
|
34
|
+
"in_reply_to_screen_name" => internal_record[:to_user],
|
35
|
+
}
|
36
|
+
})
|
37
|
+
end
|
38
|
+
twitter_record
|
39
|
+
end
|
40
|
+
[twitter_records, internal_records]
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_test_twitter_records_from_search_api(*internal_records)
|
44
|
+
twitter_search_records = internal_records.map do |internal_record|
|
45
|
+
{
|
46
|
+
"from_user" => internal_record[:from_user],
|
47
|
+
"created_at" => internal_record[:created_at],
|
48
|
+
"text" => internal_record[:status],
|
49
|
+
"to_user" => internal_record[:to_user]
|
50
|
+
}
|
51
|
+
end
|
52
|
+
twitter_records = {
|
53
|
+
"results" => twitter_search_records
|
54
|
+
}
|
55
|
+
[twitter_records, internal_records]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module Doubles
|
60
|
+
def mock_config
|
61
|
+
@config = mock('Config')
|
62
|
+
Tweetwine::CLI.stubs(:config).returns(@config)
|
63
|
+
end
|
64
|
+
|
65
|
+
def mock_http
|
66
|
+
@http = mock('Http')
|
67
|
+
Tweetwine::CLI.stubs(:http).returns(@http)
|
68
|
+
end
|
69
|
+
|
70
|
+
def mock_oauth
|
71
|
+
@oauth = mock('OAuth')
|
72
|
+
Tweetwine::CLI.stubs(:oauth).returns(@oauth)
|
73
|
+
end
|
74
|
+
|
75
|
+
def mock_ui
|
76
|
+
@ui = mock('UI')
|
77
|
+
Tweetwine::CLI.stubs(:ui).returns(@ui)
|
78
|
+
end
|
79
|
+
|
80
|
+
def mock_url_shortener
|
81
|
+
@url_shortener = mock('UrlShortener')
|
82
|
+
Tweetwine::CLI.stubs(:url_shortener).returns(@url_shortener)
|
83
|
+
end
|
84
|
+
|
85
|
+
def stub_config(options = {})
|
86
|
+
@config = options
|
87
|
+
Tweetwine::CLI.stubs(:config).returns(@config)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
module Assertions
|
92
|
+
def assert_contains_in_order(expected, actual, msg = "", &sorter)
|
93
|
+
expected = block_given? ? expected.sort(&sorter) : expected.sort
|
94
|
+
actual = block_given? ? actual.sort(&sorter) : actual.sort
|
95
|
+
assert_equal(expected, actual, msg)
|
96
|
+
end
|
97
|
+
|
98
|
+
def assert_full_match(regex, str, msg = "")
|
99
|
+
match_data = regex.match(str)
|
100
|
+
assert(str == match_data.to_s, msg)
|
101
|
+
end
|
102
|
+
|
103
|
+
def assert_no_full_match(regex, str, msg = "")
|
104
|
+
match_data = regex.match(str)
|
105
|
+
assert(str != match_data.to_s, msg)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class UnitTestCase < ::Test::Unit::TestCase
|
110
|
+
include WebMock::API
|
111
|
+
include Tweetwine
|
112
|
+
include Helper
|
113
|
+
include Doubles
|
114
|
+
include Assertions
|
115
|
+
end
|
116
|
+
end
|
data/tweetwine.gemspec
CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
|
12
12
|
s.name = name
|
13
13
|
s.version = version
|
14
|
-
s.date = "2010-02-28"
|
15
14
|
s.homepage = "http://github.com/tuomas/tweetwine"
|
16
15
|
|
17
16
|
s.summary = "A simple Twitter command line agent"
|
@@ -35,7 +34,7 @@ Gem::Specification.new do |s|
|
|
35
34
|
s.executables = %w{tweetwine}
|
36
35
|
|
37
36
|
s.add_dependency "oauth", "~> 0.4.4"
|
38
|
-
s.add_dependency "json", ">= 1.0.0"
|
37
|
+
s.add_dependency "json", ">= 1.0.0"
|
39
38
|
s.add_development_dependency "contest", "~> 0.1.2"
|
40
39
|
s.add_development_dependency "coulda", "~> 0.6.0"
|
41
40
|
s.add_development_dependency "gem-man", "~> 0.2.0"
|
@@ -44,7 +43,7 @@ Gem::Specification.new do |s|
|
|
44
43
|
s.add_development_dependency "open4", "~> 1.0.1"
|
45
44
|
s.add_development_dependency "ronn", "~> 0.7.3"
|
46
45
|
s.add_development_dependency "timecop", "~> 0.3.5"
|
47
|
-
s.add_development_dependency "webmock", "~> 1.
|
46
|
+
s.add_development_dependency "webmock", "~> 1.6.1"
|
48
47
|
|
49
48
|
s.has_rdoc = true
|
50
49
|
s.extra_rdoc_files = Dir["*.rdoc", "LICENSE.txt"]
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweetwine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 19
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tuomas Kareinen
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-11-14 00:00:00 +02:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
- 4
|
@@ -42,7 +40,6 @@ dependencies:
|
|
42
40
|
requirements:
|
43
41
|
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 23
|
46
43
|
segments:
|
47
44
|
- 1
|
48
45
|
- 0
|
@@ -58,7 +55,6 @@ dependencies:
|
|
58
55
|
requirements:
|
59
56
|
- - ~>
|
60
57
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 31
|
62
58
|
segments:
|
63
59
|
- 0
|
64
60
|
- 1
|
@@ -74,7 +70,6 @@ dependencies:
|
|
74
70
|
requirements:
|
75
71
|
- - ~>
|
76
72
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 7
|
78
73
|
segments:
|
79
74
|
- 0
|
80
75
|
- 6
|
@@ -90,7 +85,6 @@ dependencies:
|
|
90
85
|
requirements:
|
91
86
|
- - ~>
|
92
87
|
- !ruby/object:Gem::Version
|
93
|
-
hash: 23
|
94
88
|
segments:
|
95
89
|
- 0
|
96
90
|
- 2
|
@@ -106,7 +100,6 @@ dependencies:
|
|
106
100
|
requirements:
|
107
101
|
- - ~>
|
108
102
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 15
|
110
103
|
segments:
|
111
104
|
- 0
|
112
105
|
- 5
|
@@ -122,7 +115,6 @@ dependencies:
|
|
122
115
|
requirements:
|
123
116
|
- - "="
|
124
117
|
- !ruby/object:Gem::Version
|
125
|
-
hash: 43
|
126
118
|
segments:
|
127
119
|
- 0
|
128
120
|
- 9
|
@@ -138,7 +130,6 @@ dependencies:
|
|
138
130
|
requirements:
|
139
131
|
- - ~>
|
140
132
|
- !ruby/object:Gem::Version
|
141
|
-
hash: 21
|
142
133
|
segments:
|
143
134
|
- 1
|
144
135
|
- 0
|
@@ -154,7 +145,6 @@ dependencies:
|
|
154
145
|
requirements:
|
155
146
|
- - ~>
|
156
147
|
- !ruby/object:Gem::Version
|
157
|
-
hash: 5
|
158
148
|
segments:
|
159
149
|
- 0
|
160
150
|
- 7
|
@@ -170,7 +160,6 @@ dependencies:
|
|
170
160
|
requirements:
|
171
161
|
- - ~>
|
172
162
|
- !ruby/object:Gem::Version
|
173
|
-
hash: 25
|
174
163
|
segments:
|
175
164
|
- 0
|
176
165
|
- 3
|
@@ -186,12 +175,11 @@ dependencies:
|
|
186
175
|
requirements:
|
187
176
|
- - ~>
|
188
177
|
- !ruby/object:Gem::Version
|
189
|
-
hash: 3
|
190
178
|
segments:
|
191
179
|
- 1
|
192
|
-
-
|
193
|
-
-
|
194
|
-
version: 1.
|
180
|
+
- 6
|
181
|
+
- 1
|
182
|
+
version: 1.6.1
|
195
183
|
type: :development
|
196
184
|
version_requirements: *id011
|
197
185
|
description: A simple but tasty Twitter agent for command line use, made for fun.
|
@@ -212,27 +200,6 @@ files:
|
|
212
200
|
- tweetwine.gemspec
|
213
201
|
- bin/tweetwine
|
214
202
|
- contrib/tweetwine-completion.bash
|
215
|
-
- example/application_behavior_example.rb
|
216
|
-
- example/example_helper.rb
|
217
|
-
- example/fixture/config.yaml
|
218
|
-
- example/fixture/home.json
|
219
|
-
- example/fixture/mentions.json
|
220
|
-
- example/fixture/search.json
|
221
|
-
- example/fixture/shorten_rubygems.html
|
222
|
-
- example/fixture/shorten_rubylang.html
|
223
|
-
- example/fixture/update_utf8.json
|
224
|
-
- example/fixture/update_with_urls.json
|
225
|
-
- example/fixture/update_without_urls.json
|
226
|
-
- example/fixture/user.json
|
227
|
-
- example/fixture/users.json
|
228
|
-
- example/search_statuses_example.rb
|
229
|
-
- example/show_followers_example.rb
|
230
|
-
- example/show_friends_example.rb
|
231
|
-
- example/show_home_example.rb
|
232
|
-
- example/show_mentions_example.rb
|
233
|
-
- example/show_user_example.rb
|
234
|
-
- example/update_status_example.rb
|
235
|
-
- example/use_http_proxy_example.rb
|
236
203
|
- lib/tweetwine/basic_object.rb
|
237
204
|
- lib/tweetwine/character_encoding.rb
|
238
205
|
- lib/tweetwine/cli.rb
|
@@ -247,21 +214,43 @@ files:
|
|
247
214
|
- lib/tweetwine/url_shortener.rb
|
248
215
|
- lib/tweetwine/util.rb
|
249
216
|
- lib/tweetwine.rb
|
250
|
-
- test/
|
251
|
-
- test/
|
252
|
-
- test/
|
217
|
+
- test/example/application_behavior_example.rb
|
218
|
+
- test/example/example_helper.rb
|
219
|
+
- test/example/search_statuses_example.rb
|
220
|
+
- test/example/show_followers_example.rb
|
221
|
+
- test/example/show_friends_example.rb
|
222
|
+
- test/example/show_home_example.rb
|
223
|
+
- test/example/show_mentions_example.rb
|
224
|
+
- test/example/show_user_example.rb
|
225
|
+
- test/example/update_status_example.rb
|
226
|
+
- test/example/use_http_proxy_example.rb
|
227
|
+
- test/fixture/config_example.yaml
|
228
|
+
- test/fixture/config_unit.yaml
|
229
|
+
- test/fixture/home.json
|
230
|
+
- test/fixture/mentions.json
|
253
231
|
- test/fixture/oauth.rb
|
254
|
-
- test/fixture/
|
255
|
-
- test/
|
256
|
-
- test/
|
257
|
-
- test/
|
258
|
-
- test/
|
259
|
-
- test/
|
232
|
+
- test/fixture/search.json
|
233
|
+
- test/fixture/shorten_rubygems.html
|
234
|
+
- test/fixture/shorten_rubylang.html
|
235
|
+
- test/fixture/update_utf8.json
|
236
|
+
- test/fixture/update_with_urls.json
|
237
|
+
- test/fixture/update_without_urls.json
|
238
|
+
- test/fixture/user.json
|
239
|
+
- test/fixture/users.json
|
260
240
|
- test/test_helper.rb
|
261
|
-
- test/
|
262
|
-
- test/
|
263
|
-
- test/
|
264
|
-
- test/
|
241
|
+
- test/unit/character_encoding_test.rb
|
242
|
+
- test/unit/cli_test.rb
|
243
|
+
- test/unit/config_test.rb
|
244
|
+
- test/unit/http_test.rb
|
245
|
+
- test/unit/oauth_test.rb
|
246
|
+
- test/unit/obfuscate_test.rb
|
247
|
+
- test/unit/option_parser_test.rb
|
248
|
+
- test/unit/promise_test.rb
|
249
|
+
- test/unit/twitter_test.rb
|
250
|
+
- test/unit/ui_test.rb
|
251
|
+
- test/unit/unit_helper.rb
|
252
|
+
- test/unit/url_shortener_test.rb
|
253
|
+
- test/unit/util_test.rb
|
265
254
|
- man/tweetwine.7
|
266
255
|
- man/tweetwine.7.ronn
|
267
256
|
has_rdoc: true
|
@@ -271,7 +260,7 @@ licenses: []
|
|
271
260
|
post_install_message:
|
272
261
|
rdoc_options:
|
273
262
|
- --title
|
274
|
-
- tweetwine 0.3.
|
263
|
+
- tweetwine 0.3.1
|
275
264
|
- --exclude
|
276
265
|
- test
|
277
266
|
require_paths:
|
@@ -281,7 +270,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
270
|
requirements:
|
282
271
|
- - ">="
|
283
272
|
- !ruby/object:Gem::Version
|
284
|
-
hash: 3
|
285
273
|
segments:
|
286
274
|
- 0
|
287
275
|
version: "0"
|
@@ -290,7 +278,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
278
|
requirements:
|
291
279
|
- - ">="
|
292
280
|
- !ruby/object:Gem::Version
|
293
|
-
hash: 3
|
294
281
|
segments:
|
295
282
|
- 0
|
296
283
|
version: "0"
|
data/example/example_helper.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
%w{
|
4
|
-
coulda
|
5
|
-
matchy
|
6
|
-
open4
|
7
|
-
stringio
|
8
|
-
tempfile
|
9
|
-
time
|
10
|
-
timecop
|
11
|
-
webmock/test_unit
|
12
|
-
}.each { |lib| require lib }
|
13
|
-
|
14
|
-
Timecop.freeze(Time.parse("2009-10-14 01:56:15 +0300"))
|
15
|
-
|
16
|
-
require "tweetwine"
|
17
|
-
require "test_helper"
|
18
|
-
|
19
|
-
module Tweetwine
|
20
|
-
module Example
|
21
|
-
module Helper
|
22
|
-
include WebMock::API
|
23
|
-
include Test::Helper
|
24
|
-
|
25
|
-
CONFIG_FILE = File.expand_path('../fixture/config.yaml', __FILE__)
|
26
|
-
PROXY_HOST = "proxy.net"
|
27
|
-
PROXY_PORT = 8123
|
28
|
-
PROXY_URL = "http://#{PROXY_HOST}:#{PROXY_PORT}"
|
29
|
-
USER = "fooman"
|
30
|
-
|
31
|
-
def start_app(args, &blk)
|
32
|
-
lib = File.dirname(__FILE__) << "/../lib"
|
33
|
-
executable = File.dirname(__FILE__) << "/../bin/tweetwine"
|
34
|
-
launch_cmd = "env USER='#{USER}' ruby -rubygems -I#{lib} -- #{executable} -f #{CONFIG_FILE} #{args.join(' ')}"
|
35
|
-
Open4::popen4(launch_cmd, &blk)
|
36
|
-
end
|
37
|
-
|
38
|
-
def start_cli(args, input = [], options = {:config_file => CONFIG_FILE})
|
39
|
-
input, output = StringIO.new(input.join("\n")), StringIO.new
|
40
|
-
options.merge!({ :in => input, :out => output })
|
41
|
-
CLI.start(args, options)
|
42
|
-
output.string.split("\n")
|
43
|
-
end
|
44
|
-
|
45
|
-
def fixture(filename)
|
46
|
-
filepath = File.expand_path("../fixture/#{filename}", __FILE__)
|
47
|
-
File.open(filepath) do |f|
|
48
|
-
f.readlines.join("\n")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def in_temp_dir
|
53
|
-
Dir.mktmpdir do |tmp_dir|
|
54
|
-
Dir.chdir(tmp_dir) do |dir|
|
55
|
-
yield dir
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def read_shorten_config
|
61
|
-
Util.symbolize_hash_keys(YAML.load_file(CONFIG_FILE))[:shorten_urls]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
include Coulda
|
68
|
-
include Tweetwine
|
69
|
-
include Tweetwine::Example::Helper
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|