vanity-source 0.7 → 0.8
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 +6 -0
- data/lib/vanity/sources/backtweets.rb +1 -1
- data/lib/vanity/sources/github.rb +1 -1
- data/lib/vanity/sources/github_issues.rb +2 -2
- data/lib/vanity/sources/ruby_gems.rb +2 -2
- data/test/backtweets_test.rb +2 -2
- data/test/github_issues_test.rb +10 -2
- data/test/github_test.rb +3 -3
- data/test/ruby_gems_test.rb +2 -2
- data/test/test.log +78 -0
- data/test/test_helper.rb +2 -2
- data/vanity-source.gemspec +1 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2010-08-24 v0.8 Minor API change
|
2
|
+
|
3
|
+
Attribute :id is now :uid.
|
4
|
+
|
5
|
+
Activity content can be set using either :html or :text attribute.
|
6
|
+
|
1
7
|
2010-08-24 v0.7 Added test suite and resources
|
2
8
|
|
3
9
|
Each source can have an associated resources file (YAML), e.g. ruby_gems.rb
|
@@ -32,7 +32,7 @@ module Vanity
|
|
32
32
|
new_ones = tweets.take_while { |tweet| tweet["tweet_id"] != last_tweet_id }.reverse
|
33
33
|
new_ones.each do |tweet|
|
34
34
|
handle, id = tweet["tweet_from_user"], tweet["tweet_id"]
|
35
|
-
block.call :activity=>{ :
|
35
|
+
block.call :activity=>{ :uid=>id, :html=>tweet["tweet_text"], :url=>"http://twitter.com/#{handle}/#{id}",
|
36
36
|
:timestamp=>Time.parse(tweet["tweet_created_at"]).utc,
|
37
37
|
:person=>{ :name=>handle, :url=>"http://twitter.com/#{handle}", :photo=>tweet["tweet_profile_image_url"] } }
|
38
38
|
end
|
@@ -54,7 +54,7 @@ module Vanity
|
|
54
54
|
new_ones = commits.take_while { |commit| commit["id"] != last_seen_id }
|
55
55
|
new_ones.reverse.each do |commit|
|
56
56
|
committer = commit["committer"]
|
57
|
-
block.call :activity=>{ :
|
57
|
+
block.call :activity=>{ :uid=>commit["id"], :text=>commit["message"], :url=>commit["url"],
|
58
58
|
:timestamp=>Time.parse(commit["committed_date"]).utc,
|
59
59
|
:person=>{ :name=>committer["name"], :url=>"http://github.com/#{committer["name"]}",
|
60
60
|
:email=>committer["email"] } }
|
@@ -37,7 +37,7 @@ module Vanity
|
|
37
37
|
if open_ids = context["open-ids"]
|
38
38
|
open.reject { |issue| open_ids.include?(issue["number"]) }.reverse.each do |issue|
|
39
39
|
sha = Digest::SHA1.hexdigest([context["repo"], "open", issue["number"], issue["updated_at"]].join(":"))
|
40
|
-
block.call :activity=>{ :
|
40
|
+
block.call :activity=>{ :uid=>sha, :text=>"New issue opened: #{issue["title"]}",
|
41
41
|
:url=>"http://github.com/#{context["repo"]}/issues#issue/#{issue["number"]}",
|
42
42
|
:timestamp=>Time.parse(issue["created_at"]).utc }
|
43
43
|
end
|
@@ -54,7 +54,7 @@ module Vanity
|
|
54
54
|
if closed_ids = context["closed-ids"]
|
55
55
|
closed.reject { |issue| closed_ids.include?(issue["number"]) }.reverse.each do |issue|
|
56
56
|
sha = Digest::SHA1.hexdigest([context["repo"], "closed", issue["number"], issue["updated_at"]].join(":"))
|
57
|
-
block.call :activity=>{ :
|
57
|
+
block.call :activity=>{ :uid=>sha, :text=>"Issue closed: #{issue["title"]}",
|
58
58
|
:url=>"http://github.com/#{context["repo"]}/issues#issue/#{issue["number"]}",
|
59
59
|
:timestamp=>Time.parse(issue["closed_at"]).utc }
|
60
60
|
end
|
@@ -33,8 +33,8 @@ module Vanity
|
|
33
33
|
if context["version"]
|
34
34
|
current, latest = Gem::Version.new(context["version"]), Gem::Version.new(json["version"])
|
35
35
|
if latest > current
|
36
|
-
yield :activity=>{ :
|
37
|
-
:
|
36
|
+
yield :activity=>{ :uid=>"#{gem_name}-#{latest}", :url=>"http://rubygems.org/gems/#{gem_name}",
|
37
|
+
:html=>"Released <a href=\"http://rubygems.org/gems/#{gem_name}/versions/#{latest}\">#{gem_name} version #{latest}</a>" }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
context["version"] = json["version"]
|
data/test/backtweets_test.rb
CHANGED
@@ -86,11 +86,11 @@ test Vanity::Source::Backtweets do
|
|
86
86
|
context "activity" do
|
87
87
|
|
88
88
|
should "capture tweet identifier" do
|
89
|
-
assert_equal "20959239300", activity.
|
89
|
+
assert_equal "20959239300", activity.uid
|
90
90
|
end
|
91
91
|
|
92
92
|
should "capture tweet text" do
|
93
|
-
assert_equal "Super awesome <a href=\"http://vanity.labnotes.org/\">http://j.mp/aOrUnsz</a>", activity.
|
93
|
+
assert_equal "Super awesome <a href=\"http://vanity.labnotes.org/\">http://j.mp/aOrUnsz</a>", activity.html
|
94
94
|
end
|
95
95
|
|
96
96
|
should "capture tweet URL" do
|
data/test/github_issues_test.rb
CHANGED
@@ -121,12 +121,16 @@ test Vanity::Source::GithubIssues do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
should "use SHA1 for ID" do
|
124
|
-
assert_match /^[0-9a-f]{40}$/, @open.
|
124
|
+
assert_match /^[0-9a-f]{40}$/, @open.uid
|
125
125
|
end
|
126
126
|
|
127
127
|
should "capture issue creation time" do
|
128
128
|
assert_equal Time.parse("2010/03/17 22:32:02 UTC"), @open.timestamp
|
129
129
|
end
|
130
|
+
|
131
|
+
should "capture issue title" do
|
132
|
+
assert_equal "New issue opened: Option to use Google Analytics for A/B testing", @open.text
|
133
|
+
end
|
130
134
|
end
|
131
135
|
|
132
136
|
context "activity for closed issue" do
|
@@ -139,12 +143,16 @@ test Vanity::Source::GithubIssues do
|
|
139
143
|
end
|
140
144
|
|
141
145
|
should "use SHA1 for ID" do
|
142
|
-
assert_match /^[0-9a-f]{40}$/, @closed.
|
146
|
+
assert_match /^[0-9a-f]{40}$/, @closed.uid
|
143
147
|
end
|
144
148
|
|
145
149
|
should "capture issue closing time" do
|
146
150
|
assert_equal Time.parse("2010/07/03 04:16:42 UTC"), @closed.timestamp
|
147
151
|
end
|
152
|
+
|
153
|
+
should "capture issue title" do
|
154
|
+
assert_equal "Issue closed: Passwords not supported for the Redis config", @closed.text
|
155
|
+
end
|
148
156
|
end
|
149
157
|
|
150
158
|
end
|
data/test/github_test.rb
CHANGED
@@ -126,7 +126,7 @@ test Vanity::Source::Github do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
should "create most recent activity for most recent commit" do
|
129
|
-
assert_equal ["The second commit", "The third commit"], activities.map(&:
|
129
|
+
assert_equal ["The second commit", "The third commit"], activities.map(&:text)
|
130
130
|
end
|
131
131
|
|
132
132
|
context "activity" do
|
@@ -136,7 +136,7 @@ test Vanity::Source::Github do
|
|
136
136
|
end
|
137
137
|
|
138
138
|
should "capture commit SHA" do
|
139
|
-
assert_equal "dd154a9fdd2ac534b62b55b8acac2fd092d65439", activity.
|
139
|
+
assert_equal "dd154a9fdd2ac534b62b55b8acac2fd092d65439", activity.uid
|
140
140
|
end
|
141
141
|
|
142
142
|
should "capture timestamp" do
|
@@ -144,7 +144,7 @@ test Vanity::Source::Github do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
should "capture commit message" do
|
147
|
-
assert_equal "The third commit", activity.
|
147
|
+
assert_equal "The third commit", activity.text
|
148
148
|
end
|
149
149
|
|
150
150
|
should "capture commit author name" do
|
data/test/ruby_gems_test.rb
CHANGED
@@ -89,11 +89,11 @@ test Vanity::Source::RubyGems do
|
|
89
89
|
|
90
90
|
context "activity" do
|
91
91
|
should "should have unique identifier" do
|
92
|
-
assert_equal "vanity-2.1.0", activity.
|
92
|
+
assert_equal "vanity-2.1.0", activity.uid
|
93
93
|
end
|
94
94
|
|
95
95
|
should "capture have body denoting release" do
|
96
|
-
assert_equal "Released <a href=\"http://rubygems.org/gems/vanity/versions/2.1.0\">vanity version 2.1.0</a>", activity.
|
96
|
+
assert_equal "Released <a href=\"http://rubygems.org/gems/vanity/versions/2.1.0\">vanity version 2.1.0</a>", activity.html
|
97
97
|
end
|
98
98
|
|
99
99
|
should "link to project page" do
|
data/test/test.log
CHANGED
@@ -244,3 +244,81 @@ Backtweets: 200
|
|
244
244
|
Backtweets: 500
|
245
245
|
RubyGems: 200
|
246
246
|
RubyGems: 500
|
247
|
+
Backtweets: 500
|
248
|
+
Backtweets: 200
|
249
|
+
Backtweets: 200
|
250
|
+
Backtweets: 500
|
251
|
+
RubyGems: 200
|
252
|
+
RubyGems: 500
|
253
|
+
Backtweets: 500
|
254
|
+
Backtweets: 200
|
255
|
+
Backtweets: 200
|
256
|
+
Backtweets: 500
|
257
|
+
RubyGems: 200
|
258
|
+
RubyGems: 500
|
259
|
+
Backtweets: 500
|
260
|
+
Backtweets: 200
|
261
|
+
Backtweets: 200
|
262
|
+
Backtweets: 500
|
263
|
+
RubyGems: 200
|
264
|
+
RubyGems: 500
|
265
|
+
Backtweets: 500
|
266
|
+
Backtweets: 200
|
267
|
+
Backtweets: 200
|
268
|
+
Backtweets: 500
|
269
|
+
RubyGems: 200
|
270
|
+
RubyGems: 500
|
271
|
+
Backtweets: 500
|
272
|
+
Backtweets: 200
|
273
|
+
Backtweets: 200
|
274
|
+
Backtweets: 500
|
275
|
+
RubyGems: 200
|
276
|
+
RubyGems: 500
|
277
|
+
Backtweets: 500
|
278
|
+
Backtweets: 200
|
279
|
+
Backtweets: 200
|
280
|
+
Backtweets: 500
|
281
|
+
RubyGems: 200
|
282
|
+
RubyGems: 500
|
283
|
+
Backtweets: 500
|
284
|
+
Backtweets: 200
|
285
|
+
Backtweets: 200
|
286
|
+
Backtweets: 500
|
287
|
+
RubyGems: 200
|
288
|
+
RubyGems: 500
|
289
|
+
Backtweets: 500
|
290
|
+
Backtweets: 200
|
291
|
+
Backtweets: 200
|
292
|
+
Backtweets: 500
|
293
|
+
RubyGems: 200
|
294
|
+
RubyGems: 500
|
295
|
+
Backtweets: 500
|
296
|
+
Backtweets: 200
|
297
|
+
Backtweets: 200
|
298
|
+
Backtweets: 500
|
299
|
+
RubyGems: 200
|
300
|
+
RubyGems: 500
|
301
|
+
Backtweets: 500
|
302
|
+
Backtweets: 200
|
303
|
+
Backtweets: 200
|
304
|
+
Backtweets: 500
|
305
|
+
RubyGems: 200
|
306
|
+
RubyGems: 500
|
307
|
+
Backtweets: 500
|
308
|
+
Backtweets: 200
|
309
|
+
Backtweets: 200
|
310
|
+
Backtweets: 500
|
311
|
+
RubyGems: 200
|
312
|
+
RubyGems: 500
|
313
|
+
Backtweets: 500
|
314
|
+
Backtweets: 200
|
315
|
+
Backtweets: 200
|
316
|
+
Backtweets: 500
|
317
|
+
RubyGems: 200
|
318
|
+
RubyGems: 500
|
319
|
+
Backtweets: 500
|
320
|
+
Backtweets: 200
|
321
|
+
Backtweets: 200
|
322
|
+
Backtweets: 500
|
323
|
+
RubyGems: 200
|
324
|
+
RubyGems: 500
|
data/test/test_helper.rb
CHANGED
@@ -44,7 +44,7 @@ module Vanity
|
|
44
44
|
module Source
|
45
45
|
module TestHelpers
|
46
46
|
# Represents an activity.
|
47
|
-
Activity = Struct.new(:
|
47
|
+
Activity = Struct.new(:uid, :html, :text, :url, :timestamp, :person)
|
48
48
|
|
49
49
|
# Represents person associated with activity.
|
50
50
|
Person = Struct.new(:name, :email, :url, :photo)
|
@@ -117,7 +117,7 @@ module Vanity
|
|
117
117
|
totals[name] += value
|
118
118
|
end
|
119
119
|
elsif args[:activity]
|
120
|
-
values = args[:activity].values_at(:
|
120
|
+
values = args[:activity].values_at(:uid, :html, :text, :url, :timestamp)
|
121
121
|
if person = args[:activity][:person]
|
122
122
|
values << Person.new(*person.values_at(:name, :email, :url, :photo))
|
123
123
|
end
|
data/vanity-source.gemspec
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanity-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 8
|
9
|
+
version: "0.8"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Assaf Arkin
|
@@ -105,7 +105,7 @@ licenses: []
|
|
105
105
|
post_install_message:
|
106
106
|
rdoc_options:
|
107
107
|
- --title
|
108
|
-
- Vanity::Source 0.
|
108
|
+
- Vanity::Source 0.8
|
109
109
|
- --main
|
110
110
|
- README.rdoc
|
111
111
|
- --webcvs
|