vanity-source 0.8 → 0.9
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 +2 -0
- data/lib/vanity/source.rb +6 -0
- data/lib/vanity/sources/github.rb +5 -1
- data/test/cassettes/github.yml +1 -1
- data/test/github_test.rb +4 -5
- data/test/test.log +28 -0
- data/vanity-source.gemspec +1 -1
- metadata +5 -5
data/CHANGELOG
CHANGED
data/lib/vanity/source.rb
CHANGED
@@ -213,6 +213,12 @@ module Vanity
|
|
213
213
|
@resources
|
214
214
|
end
|
215
215
|
|
216
|
+
# Shortcut for Rack::Utils.escape_html
|
217
|
+
def escape_html(text)
|
218
|
+
Rack::Utils.escape_html(text.to_s)
|
219
|
+
end
|
220
|
+
alias :h :escape_html
|
221
|
+
|
216
222
|
# Returns API key for this source. May return string or hash, depending on
|
217
223
|
# the API.
|
218
224
|
def api_key
|
@@ -54,7 +54,11 @@ 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
|
-
|
57
|
+
message = <<-HTML
|
58
|
+
<p>committed to <code>#{h context["repo"]}</code> in branch <code>#{h context["branch"]}</code>:</p>
|
59
|
+
<pre>#{h commit["message"]}</pre>
|
60
|
+
HTML
|
61
|
+
block.call :activity=>{ :uid=>commit["id"], :html=>message, :url=>commit["url"],
|
58
62
|
:timestamp=>Time.parse(commit["committed_date"]).utc,
|
59
63
|
:person=>{ :name=>committer["name"], :url=>"http://github.com/#{committer["name"]}",
|
60
64
|
:email=>committer["email"] } }
|
data/test/cassettes/github.yml
CHANGED
@@ -104,7 +104,7 @@
|
|
104
104
|
{ "url": "http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d65439",
|
105
105
|
"id": "dd154a9fdd2ac534b62b55b8acac2fd092d65439",
|
106
106
|
"committed_date": "2010-08-06T00:22:01-07:00",
|
107
|
-
"message": "
|
107
|
+
"message": "Third & last",
|
108
108
|
"committer": { "name": "Assaf Arkin", "login": "assaf", "email": "assaf@labnotes.org" } },
|
109
109
|
{ "url": "http://github.com/assaf/vanity/commit/dd154a9fdd2ac534b62b55b8acac2fd092d6543b",
|
110
110
|
"id": "dd154a9fdd2ac534b62b55b8acac2fd092d6543b",
|
data/test/github_test.rb
CHANGED
@@ -125,10 +125,6 @@ test Vanity::Source::Github do
|
|
125
125
|
assert_equal 2, activities.count
|
126
126
|
end
|
127
127
|
|
128
|
-
should "create most recent activity for most recent commit" do
|
129
|
-
assert_equal ["The second commit", "The third commit"], activities.map(&:text)
|
130
|
-
end
|
131
|
-
|
132
128
|
context "activity" do
|
133
129
|
|
134
130
|
should "capture commit URL" do
|
@@ -144,7 +140,10 @@ test Vanity::Source::Github do
|
|
144
140
|
end
|
145
141
|
|
146
142
|
should "capture commit message" do
|
147
|
-
assert_equal
|
143
|
+
assert_equal <<-HTML, activity.html
|
144
|
+
<p>committed to <code>assaf/vanity</code> in branch <code>master</code>:</p>
|
145
|
+
<pre>Third & last</pre>
|
146
|
+
HTML
|
148
147
|
end
|
149
148
|
|
150
149
|
should "capture commit author name" do
|
data/test/test.log
CHANGED
@@ -322,3 +322,31 @@ Backtweets: 200
|
|
322
322
|
Backtweets: 500
|
323
323
|
RubyGems: 200
|
324
324
|
RubyGems: 500
|
325
|
+
Backtweets: 200
|
326
|
+
Backtweets: 500
|
327
|
+
Backtweets: 200
|
328
|
+
Backtweets: 500
|
329
|
+
Backtweets: 200
|
330
|
+
Backtweets: 500
|
331
|
+
Backtweets: 200
|
332
|
+
Backtweets: 500
|
333
|
+
Backtweets: 200
|
334
|
+
Backtweets: 500
|
335
|
+
Backtweets: 200
|
336
|
+
Backtweets: 500
|
337
|
+
Backtweets: 200
|
338
|
+
Backtweets: 500
|
339
|
+
Backtweets: 200
|
340
|
+
Backtweets: 500
|
341
|
+
Backtweets: 500
|
342
|
+
Backtweets: 200
|
343
|
+
Backtweets: 200
|
344
|
+
Backtweets: 500
|
345
|
+
RubyGems: 200
|
346
|
+
RubyGems: 500
|
347
|
+
Backtweets: 500
|
348
|
+
Backtweets: 200
|
349
|
+
Backtweets: 200
|
350
|
+
Backtweets: 500
|
351
|
+
RubyGems: 200
|
352
|
+
RubyGems: 500
|
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 9
|
9
|
+
version: "0.9"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Assaf Arkin
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-25 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -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.9
|
109
109
|
- --main
|
110
110
|
- README.rdoc
|
111
111
|
- --webcvs
|