stratify-github 0.1.1 → 0.1.2
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/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stratify-github (0.1)
|
4
|
+
stratify-github (0.1.2)
|
5
5
|
actionpack (~> 3.2.0)
|
6
6
|
railties (~> 3.2.0)
|
7
7
|
rinku (~> 1.0.0)
|
@@ -10,20 +10,20 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionpack (3.2.
|
14
|
-
activemodel (= 3.2.
|
15
|
-
activesupport (= 3.2.
|
13
|
+
actionpack (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
16
|
builder (~> 3.0.0)
|
17
17
|
erubis (~> 2.7.0)
|
18
|
-
journey (~> 1.0.
|
18
|
+
journey (~> 1.0.1)
|
19
19
|
rack (~> 1.4.0)
|
20
20
|
rack-cache (~> 1.2)
|
21
21
|
rack-test (~> 0.6.1)
|
22
|
-
sprockets (~> 2.1.
|
23
|
-
activemodel (3.2.
|
24
|
-
activesupport (= 3.2.
|
22
|
+
sprockets (~> 2.1.2)
|
23
|
+
activemodel (3.2.3)
|
24
|
+
activesupport (= 3.2.3)
|
25
25
|
builder (~> 3.0.0)
|
26
|
-
activesupport (3.2.
|
26
|
+
activesupport (3.2.3)
|
27
27
|
i18n (~> 0.6)
|
28
28
|
multi_json (~> 1.0)
|
29
29
|
bson (1.6.4)
|
@@ -37,14 +37,14 @@ GEM
|
|
37
37
|
hike (1.2.1)
|
38
38
|
i18n (0.6.0)
|
39
39
|
journey (1.0.4)
|
40
|
-
json (1.7.
|
40
|
+
json (1.7.0)
|
41
41
|
mongo (1.6.2)
|
42
42
|
bson (~> 1.6.2)
|
43
43
|
mongoid (2.4.12)
|
44
44
|
activemodel (~> 3.1)
|
45
45
|
mongo (<= 1.6.2)
|
46
46
|
tzinfo (~> 0.3.22)
|
47
|
-
multi_json (1.3.
|
47
|
+
multi_json (1.3.4)
|
48
48
|
rack (1.4.1)
|
49
49
|
rack-cache (1.2)
|
50
50
|
rack (>= 0.4)
|
@@ -52,13 +52,13 @@ GEM
|
|
52
52
|
rack
|
53
53
|
rack-test (0.6.1)
|
54
54
|
rack (>= 1.0)
|
55
|
-
railties (3.2.
|
56
|
-
actionpack (= 3.2.
|
57
|
-
activesupport (= 3.2.
|
55
|
+
railties (3.2.3)
|
56
|
+
actionpack (= 3.2.3)
|
57
|
+
activesupport (= 3.2.3)
|
58
58
|
rack-ssl (~> 1.3.2)
|
59
59
|
rake (>= 0.8.7)
|
60
60
|
rdoc (~> 3.4)
|
61
|
-
thor (
|
61
|
+
thor (~> 0.14.6)
|
62
62
|
rake (0.9.2.2)
|
63
63
|
rdoc (3.12)
|
64
64
|
json (~> 1.4)
|
@@ -79,7 +79,7 @@ GEM
|
|
79
79
|
bson_ext (~> 1.6.0)
|
80
80
|
mongoid (~> 2.4.0)
|
81
81
|
tilt (~> 1.3.2)
|
82
|
-
thor (0.
|
82
|
+
thor (0.14.6)
|
83
83
|
tilt (1.3.3)
|
84
84
|
tzinfo (0.3.33)
|
85
85
|
vcr (1.10.3)
|
Binary file
|
@@ -7,9 +7,14 @@ module Stratify
|
|
7
7
|
truncate(text, :length => length)
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
def self.repo_url(event_url)
|
11
|
+
# 'http://github.com/dhh/rails/commit/662bd00' => 'http://github.com/dhh/rails'
|
12
|
+
event_url.split('/')[0..4].join('/')
|
13
|
+
end
|
14
|
+
|
15
|
+
class CommitCommentEvent < Event
|
11
16
|
def self.make(activity, api_hash)
|
12
|
-
activity.repository = api_hash['url']
|
17
|
+
activity.repository = repo_url(api_hash['url'])
|
13
18
|
activity
|
14
19
|
end
|
15
20
|
def self.text(activity)
|
@@ -17,7 +22,7 @@ module Stratify
|
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
20
|
-
class CreateEvent
|
25
|
+
class CreateEvent < Event
|
21
26
|
def self.make(activity, api_hash)
|
22
27
|
activity.ref = api_hash['payload']['ref']
|
23
28
|
activity.ref_type = api_hash['payload']['ref_type']
|
@@ -25,7 +30,7 @@ module Stratify
|
|
25
30
|
if activity.ref_type == 'repository'
|
26
31
|
activity.repository = api_hash['url']
|
27
32
|
else
|
28
|
-
activity.repository = api_hash['url']
|
33
|
+
activity.repository = repo_url(api_hash['url'])
|
29
34
|
end
|
30
35
|
activity
|
31
36
|
end
|
@@ -187,7 +192,7 @@ module Stratify
|
|
187
192
|
def self.make(activity, api_hash)
|
188
193
|
activity.action = "pushed"
|
189
194
|
activity.ref = api_hash['payload']['ref']
|
190
|
-
activity.repository = api_hash['repository']['url']
|
195
|
+
activity.repository = api_hash['repository']['url'] rescue nil
|
191
196
|
activity.payload = api_hash['payload']['shas'][0][2]
|
192
197
|
activity
|
193
198
|
end
|
@@ -13,7 +13,8 @@ module Stratify
|
|
13
13
|
activity.event_type = api_hash['type']
|
14
14
|
activity.url = api_hash['url']
|
15
15
|
activity.actor = api_hash['actor']
|
16
|
-
activity.created_at =
|
16
|
+
activity.created_at = api_hash['created_at']
|
17
|
+
|
17
18
|
activity.checksum = Digest::MD5.hexdigest(activity)
|
18
19
|
|
19
20
|
begin
|
@@ -23,6 +23,13 @@ describe Stratify::GitHub::Activity do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'translation' do
|
26
|
+
it 'properly interprets the incoming created_at field' do
|
27
|
+
data = DM({'type' => 'WatchEvent',
|
28
|
+
'created_at' => '2012-08-01T09:35:11-07:00'})
|
29
|
+
event = Stratify::GitHub::Activity.from_api_hash(data)
|
30
|
+
event.created_at.should == DateTime.parse('2012-08-01T09:35:11-07:00')
|
31
|
+
end
|
32
|
+
|
26
33
|
it 'raises an error when the API passes an unknown event type' do
|
27
34
|
fields = {'type' => 'BendGirderEvent'}
|
28
35
|
lambda {Stratify::GitHub::Activity.from_api_hash(fields)}.should raise_error(GitHubApiError)
|
@@ -231,6 +238,19 @@ describe Stratify::GitHub::Activity do
|
|
231
238
|
event.payload.should == 'Fix all the things'
|
232
239
|
end
|
233
240
|
|
241
|
+
it 'produces correct fields for a PushEvent without a repository' do
|
242
|
+
data = DM({'type' => 'PushEvent',
|
243
|
+
'payload' => {
|
244
|
+
'ref' => 'refs/head/master',
|
245
|
+
'shas' => [[nil, nil, 'Fix all the things']]}})
|
246
|
+
event = Stratify::GitHub::Activity.from_api_hash(data)
|
247
|
+
event.action.should == 'pushed'
|
248
|
+
event.event_type.should == 'PushEvent'
|
249
|
+
event.ref.should == 'refs/head/master'
|
250
|
+
event.repository.should be_nil
|
251
|
+
event.payload.should == 'Fix all the things'
|
252
|
+
end
|
253
|
+
|
234
254
|
it 'produces correct fields for a WatchEvent' do
|
235
255
|
data = DM({'type' => 'WatchEvent'})
|
236
256
|
event = Stratify::GitHub::Activity.from_api_hash(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stratify-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -207,8 +207,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
209
|
rubyforge_project: stratify-github
|
210
|
-
rubygems_version: 1.8.
|
210
|
+
rubygems_version: 1.8.24
|
211
211
|
signing_key:
|
212
212
|
specification_version: 3
|
213
213
|
summary: GitHub plugin for Stratify
|
214
|
-
test_files:
|
214
|
+
test_files:
|
215
|
+
- spec/mongoid.yml
|
216
|
+
- spec/spec_helper.rb
|
217
|
+
- spec/stratify-github/activity_spec.rb
|
218
|
+
- spec/stratify-github/integration_spec.rb
|
219
|
+
- spec/stratify-github/presenter_spec.rb
|
220
|
+
- spec/support/vcr_setup.rb
|