t 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +1 -1
- data/README.md +24 -14
- data/bin/t +34 -1
- data/lib/t/cli.rb +203 -121
- data/lib/t/core_ext/string.rb +7 -0
- data/lib/t/delete.rb +101 -0
- data/lib/t/set.rb +25 -17
- data/lib/t/version.rb +2 -2
- data/spec/cli_spec.rb +587 -0
- data/spec/delete_spec.rb +251 -0
- data/spec/fixtures/.trc +4 -4
- data/spec/fixtures/access_token +1 -0
- data/spec/fixtures/checkip.html +1 -0
- data/spec/fixtures/direct_message.json +1 -0
- data/spec/fixtures/direct_messages.json +1 -0
- data/spec/fixtures/favorites.json +1 -0
- data/spec/fixtures/recommendations.json +1 -0
- data/spec/fixtures/request_token +1 -0
- data/spec/fixtures/retweet.json +1 -0
- data/spec/fixtures/settings.json +1 -0
- data/spec/fixtures/sferik.json +1 -0
- data/spec/fixtures/status.json +1 -0
- data/spec/fixtures/statuses.json +1 -0
- data/spec/fixtures/xml.gp +17 -0
- data/spec/helper.rb +42 -2
- data/spec/rcfile_spec.rb +17 -16
- data/spec/set_spec.rb +125 -0
- data/t.gemspec +5 -3
- metadata +95 -36
data/spec/set_spec.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe T::Set do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@t = T::CLI.new
|
8
|
+
Timecop.freeze(Time.local(2011, 11, 24, 16, 20, 0))
|
9
|
+
@old_stderr = $stderr
|
10
|
+
$stderr = StringIO.new
|
11
|
+
@old_stdout = $stdout
|
12
|
+
$stdout = StringIO.new
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
$stderr = @old_stderr
|
17
|
+
$stdout = @old_stdout
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#bio" do
|
21
|
+
before do
|
22
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
23
|
+
stub_post("/1/account/update_profile.json").
|
24
|
+
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."}).
|
25
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
26
|
+
end
|
27
|
+
it "should request the correct resource" do
|
28
|
+
@t.set("bio", "A mind forever voyaging through strange seas of thought, alone.")
|
29
|
+
a_post("/1/account/update_profile.json").
|
30
|
+
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."}).
|
31
|
+
should have_been_made
|
32
|
+
end
|
33
|
+
it "should have the correct output" do
|
34
|
+
@t.set("bio", "A mind forever voyaging through strange seas of thought, alone.")
|
35
|
+
$stdout.string.chomp.should == "@testcli's bio has been updated."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#bio" do
|
40
|
+
before do
|
41
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
42
|
+
end
|
43
|
+
it "should have the correct output" do
|
44
|
+
@t.set("default", "testcli", "abc123")
|
45
|
+
$stdout.string.chomp.should == "Default account has been updated."
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#language" do
|
50
|
+
before do
|
51
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
52
|
+
stub_post("/1/account/settings.json").
|
53
|
+
with(:body => {:lang => "en"}).
|
54
|
+
to_return(:body => fixture("settings.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
55
|
+
end
|
56
|
+
it "should request the correct resource" do
|
57
|
+
@t.set("language", "en")
|
58
|
+
a_post("/1/account/settings.json").
|
59
|
+
with(:body => {:lang => "en"}).
|
60
|
+
should have_been_made
|
61
|
+
end
|
62
|
+
it "should have the correct output" do
|
63
|
+
@t.set("language", "en")
|
64
|
+
$stdout.string.chomp.should == "@testcli's language has been updated."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#location" do
|
69
|
+
before do
|
70
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
71
|
+
stub_post("/1/account/update_profile.json").
|
72
|
+
with(:body => {:location => "San Francisco"}).
|
73
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
74
|
+
end
|
75
|
+
it "should request the correct resource" do
|
76
|
+
@t.set("location", "San Francisco")
|
77
|
+
a_post("/1/account/update_profile.json").
|
78
|
+
with(:body => {:location => "San Francisco"}).
|
79
|
+
should have_been_made
|
80
|
+
end
|
81
|
+
it "should have the correct output" do
|
82
|
+
@t.set("location", "San Francisco")
|
83
|
+
$stdout.string.chomp.should == "@testcli's location has been updated."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#name" do
|
88
|
+
before do
|
89
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
90
|
+
stub_post("/1/account/update_profile.json").
|
91
|
+
with(:body => {:name => "Erik Michaels-Ober"}).
|
92
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
93
|
+
end
|
94
|
+
it "should request the correct resource" do
|
95
|
+
@t.set("name", "Erik Michaels-Ober")
|
96
|
+
a_post("/1/account/update_profile.json").
|
97
|
+
with(:body => {:name => "Erik Michaels-Ober"}).
|
98
|
+
should have_been_made
|
99
|
+
end
|
100
|
+
it "should have the correct output" do
|
101
|
+
@t.set("name", "Erik Michaels-Ober")
|
102
|
+
$stdout.string.chomp.should == "@testcli's name has been updated."
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "#url" do
|
107
|
+
before do
|
108
|
+
@t.options = @t.options.merge(:profile => File.expand_path('../fixtures/.trc', __FILE__))
|
109
|
+
stub_post("/1/account/update_profile.json").
|
110
|
+
with(:body => {:url => "https://github.com/sferik"}).
|
111
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
112
|
+
end
|
113
|
+
it "should request the correct resource" do
|
114
|
+
@t.set("url", "https://github.com/sferik")
|
115
|
+
a_post("/1/account/update_profile.json").
|
116
|
+
with(:body => {:url => "https://github.com/sferik"}).
|
117
|
+
should have_been_made
|
118
|
+
end
|
119
|
+
it "should have the correct output" do
|
120
|
+
@t.set("url", "https://github.com/sferik")
|
121
|
+
$stdout.string.chomp.should == "@testcli's URL has been updated."
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
data/t.gemspec
CHANGED
@@ -2,16 +2,18 @@
|
|
2
2
|
require File.expand_path("../lib/t/version", __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_dependency 'actionpack', '
|
5
|
+
gem.add_dependency 'actionpack', ['>= 2.3.11', '< 4']
|
6
6
|
gem.add_dependency 'launchy', '~> 2.0'
|
7
|
-
gem.add_dependency '
|
8
|
-
gem.add_dependency 'twitter', ['~> 2.0', '>= 2.0.1']
|
7
|
+
gem.add_dependency 'geokit', '~> 1.6'
|
9
8
|
gem.add_dependency 'oauth', '~> 0.4'
|
9
|
+
gem.add_dependency 'thor', '~> 0.15.0.rc2'
|
10
|
+
gem.add_dependency 'twitter', ['>= 2.0.2', '< 3']
|
10
11
|
gem.add_dependency 'yajl-ruby', '~> 1.1'
|
11
12
|
gem.add_development_dependency 'pry'
|
12
13
|
gem.add_development_dependency 'rake'
|
13
14
|
gem.add_development_dependency 'rspec'
|
14
15
|
gem.add_development_dependency 'simplecov'
|
16
|
+
gem.add_development_dependency 'timecop'
|
15
17
|
gem.add_development_dependency 'webmock'
|
16
18
|
gem.author = "Erik Michaels-Ober"
|
17
19
|
gem.bindir = 'bin'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,25 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70255154627420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.3.11
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '4'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
|
-
version_requirements: *
|
27
|
+
version_requirements: *70255154627420
|
25
28
|
- !ruby/object:Gem::Dependency
|
26
29
|
name: launchy
|
27
|
-
requirement: &
|
30
|
+
requirement: &70255154625340 !ruby/object:Gem::Requirement
|
28
31
|
none: false
|
29
32
|
requirements:
|
30
33
|
- - ~>
|
@@ -32,46 +35,57 @@ dependencies:
|
|
32
35
|
version: '2.0'
|
33
36
|
type: :runtime
|
34
37
|
prerelease: false
|
35
|
-
version_requirements: *
|
38
|
+
version_requirements: *70255154625340
|
36
39
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
40
|
+
name: geokit
|
41
|
+
requirement: &70255154624800 !ruby/object:Gem::Requirement
|
39
42
|
none: false
|
40
43
|
requirements:
|
41
44
|
- - ~>
|
42
45
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
46
|
+
version: '1.6'
|
44
47
|
type: :runtime
|
45
48
|
prerelease: false
|
46
|
-
version_requirements: *
|
49
|
+
version_requirements: *70255154624800
|
47
50
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
51
|
+
name: oauth
|
52
|
+
requirement: &70255154623920 !ruby/object:Gem::Requirement
|
50
53
|
none: false
|
51
54
|
requirements:
|
52
55
|
- - ~>
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- - ! '>='
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0.1
|
57
|
+
version: '0.4'
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70255154623920
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
63
|
-
requirement: &
|
62
|
+
name: thor
|
63
|
+
requirement: &70255154623220 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.15.0.rc2
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: *70255154623220
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: twitter
|
74
|
+
requirement: &70255154622300 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.0.2
|
80
|
+
- - <
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3'
|
69
83
|
type: :runtime
|
70
84
|
prerelease: false
|
71
|
-
version_requirements: *
|
85
|
+
version_requirements: *70255154622300
|
72
86
|
- !ruby/object:Gem::Dependency
|
73
87
|
name: yajl-ruby
|
74
|
-
requirement: &
|
88
|
+
requirement: &70255154621520 !ruby/object:Gem::Requirement
|
75
89
|
none: false
|
76
90
|
requirements:
|
77
91
|
- - ~>
|
@@ -79,10 +93,10 @@ dependencies:
|
|
79
93
|
version: '1.1'
|
80
94
|
type: :runtime
|
81
95
|
prerelease: false
|
82
|
-
version_requirements: *
|
96
|
+
version_requirements: *70255154621520
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pry
|
85
|
-
requirement: &
|
99
|
+
requirement: &70255154621000 !ruby/object:Gem::Requirement
|
86
100
|
none: false
|
87
101
|
requirements:
|
88
102
|
- - ! '>='
|
@@ -90,10 +104,10 @@ dependencies:
|
|
90
104
|
version: '0'
|
91
105
|
type: :development
|
92
106
|
prerelease: false
|
93
|
-
version_requirements: *
|
107
|
+
version_requirements: *70255154621000
|
94
108
|
- !ruby/object:Gem::Dependency
|
95
109
|
name: rake
|
96
|
-
requirement: &
|
110
|
+
requirement: &70255154620260 !ruby/object:Gem::Requirement
|
97
111
|
none: false
|
98
112
|
requirements:
|
99
113
|
- - ! '>='
|
@@ -101,10 +115,10 @@ dependencies:
|
|
101
115
|
version: '0'
|
102
116
|
type: :development
|
103
117
|
prerelease: false
|
104
|
-
version_requirements: *
|
118
|
+
version_requirements: *70255154620260
|
105
119
|
- !ruby/object:Gem::Dependency
|
106
120
|
name: rspec
|
107
|
-
requirement: &
|
121
|
+
requirement: &70255154619800 !ruby/object:Gem::Requirement
|
108
122
|
none: false
|
109
123
|
requirements:
|
110
124
|
- - ! '>='
|
@@ -112,10 +126,21 @@ dependencies:
|
|
112
126
|
version: '0'
|
113
127
|
type: :development
|
114
128
|
prerelease: false
|
115
|
-
version_requirements: *
|
129
|
+
version_requirements: *70255154619800
|
116
130
|
- !ruby/object:Gem::Dependency
|
117
131
|
name: simplecov
|
118
|
-
requirement: &
|
132
|
+
requirement: &70255154619220 !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: *70255154619220
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: timecop
|
143
|
+
requirement: &70255154618420 !ruby/object:Gem::Requirement
|
119
144
|
none: false
|
120
145
|
requirements:
|
121
146
|
- - ! '>='
|
@@ -123,10 +148,10 @@ dependencies:
|
|
123
148
|
version: '0'
|
124
149
|
type: :development
|
125
150
|
prerelease: false
|
126
|
-
version_requirements: *
|
151
|
+
version_requirements: *70255154618420
|
127
152
|
- !ruby/object:Gem::Dependency
|
128
153
|
name: webmock
|
129
|
-
requirement: &
|
154
|
+
requirement: &70255154616840 !ruby/object:Gem::Requirement
|
130
155
|
none: false
|
131
156
|
requirements:
|
132
157
|
- - ! '>='
|
@@ -134,7 +159,7 @@ dependencies:
|
|
134
159
|
version: '0'
|
135
160
|
type: :development
|
136
161
|
prerelease: false
|
137
|
-
version_requirements: *
|
162
|
+
version_requirements: *70255154616840
|
138
163
|
description: A command-line interface for Twitter.
|
139
164
|
email: sferik@gmail.com
|
140
165
|
executables:
|
@@ -152,12 +177,30 @@ files:
|
|
152
177
|
- bin/t
|
153
178
|
- lib/t.rb
|
154
179
|
- lib/t/cli.rb
|
180
|
+
- lib/t/core_ext/string.rb
|
181
|
+
- lib/t/delete.rb
|
155
182
|
- lib/t/rcfile.rb
|
156
183
|
- lib/t/set.rb
|
157
184
|
- lib/t/version.rb
|
185
|
+
- spec/cli_spec.rb
|
186
|
+
- spec/delete_spec.rb
|
158
187
|
- spec/fixtures/.trc
|
188
|
+
- spec/fixtures/access_token
|
189
|
+
- spec/fixtures/checkip.html
|
190
|
+
- spec/fixtures/direct_message.json
|
191
|
+
- spec/fixtures/direct_messages.json
|
192
|
+
- spec/fixtures/favorites.json
|
193
|
+
- spec/fixtures/recommendations.json
|
194
|
+
- spec/fixtures/request_token
|
195
|
+
- spec/fixtures/retweet.json
|
196
|
+
- spec/fixtures/settings.json
|
197
|
+
- spec/fixtures/sferik.json
|
198
|
+
- spec/fixtures/status.json
|
199
|
+
- spec/fixtures/statuses.json
|
200
|
+
- spec/fixtures/xml.gp
|
159
201
|
- spec/helper.rb
|
160
202
|
- spec/rcfile_spec.rb
|
203
|
+
- spec/set_spec.rb
|
161
204
|
- t.gemspec
|
162
205
|
homepage: http://github.com/sferik/t
|
163
206
|
licenses: []
|
@@ -179,12 +222,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
222
|
version: 1.3.6
|
180
223
|
requirements: []
|
181
224
|
rubyforge_project:
|
182
|
-
rubygems_version: 1.8.
|
225
|
+
rubygems_version: 1.8.12
|
183
226
|
signing_key:
|
184
227
|
specification_version: 3
|
185
228
|
summary: CLI for Twitter
|
186
229
|
test_files:
|
230
|
+
- spec/cli_spec.rb
|
231
|
+
- spec/delete_spec.rb
|
187
232
|
- spec/fixtures/.trc
|
233
|
+
- spec/fixtures/access_token
|
234
|
+
- spec/fixtures/checkip.html
|
235
|
+
- spec/fixtures/direct_message.json
|
236
|
+
- spec/fixtures/direct_messages.json
|
237
|
+
- spec/fixtures/favorites.json
|
238
|
+
- spec/fixtures/recommendations.json
|
239
|
+
- spec/fixtures/request_token
|
240
|
+
- spec/fixtures/retweet.json
|
241
|
+
- spec/fixtures/settings.json
|
242
|
+
- spec/fixtures/sferik.json
|
243
|
+
- spec/fixtures/status.json
|
244
|
+
- spec/fixtures/statuses.json
|
245
|
+
- spec/fixtures/xml.gp
|
188
246
|
- spec/helper.rb
|
189
247
|
- spec/rcfile_spec.rb
|
248
|
+
- spec/set_spec.rb
|
190
249
|
has_rdoc:
|