octopussy 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -1
- data/README.markdown +5 -1
- data/VERSION +1 -1
- data/lib/octopussy/event.rb +58 -0
- data/lib/octopussy/repo.rb +42 -26
- data/lib/octopussy.rb +1 -0
- data/octopussy.gemspec +101 -0
- data/test/test_octopussy.rb +217 -0
- data/test/test_repo.rb +14 -5
- metadata +3 -1
data/.document
CHANGED
data/README.markdown
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# octopussy
|
3
2
|
|
4
3
|
<img src='http://upload.wikimedia.org/wikipedia/en/b/bb/007Octopussyposter.jpg' style='float: right; margin: 0 0 10px 10px'/>
|
@@ -44,6 +43,11 @@ Some methods require authentication so you'll need to pass a login and an api_to
|
|
44
43
|
|
45
44
|
Read the full [docs](http://rdoc.info/projects/pengwynn/octopussy) or check out the [examples](http://github.com/pengwynn/octopussy/tree/master/examples)
|
46
45
|
|
46
|
+
## TODO
|
47
|
+
|
48
|
+
* Feed parsing
|
49
|
+
* More examples
|
50
|
+
|
47
51
|
## Note on Patches/Pull Requests
|
48
52
|
|
49
53
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Octopussy
|
2
|
+
class Event
|
3
|
+
|
4
|
+
def self.load_from_atom(entry)
|
5
|
+
entry = entry.to_mash if entry.is_a?(Hash)
|
6
|
+
|
7
|
+
event = Hashie::Mash.new({:user => entry.author})
|
8
|
+
event.published = (entry.published.is_a?(String) ? DateTime.parse(entry.published) : entry.published)
|
9
|
+
|
10
|
+
case entry.id
|
11
|
+
when /CreateEvent/
|
12
|
+
case entry.title
|
13
|
+
when /created tag/
|
14
|
+
event.event_type = 'create_tag'
|
15
|
+
event.tag = entry.links.first.split('/').pop
|
16
|
+
when /created branch/
|
17
|
+
event.event_type = 'create_branch'
|
18
|
+
event.branch = entry.links.first.split('/').pop
|
19
|
+
when /created repository/
|
20
|
+
event.event_type = 'create_repo'
|
21
|
+
end
|
22
|
+
|
23
|
+
when /MemberEvent/
|
24
|
+
event.event_type = 'member'
|
25
|
+
event.target_user = entry.title.split(" ")[2]
|
26
|
+
when /PushEvent/
|
27
|
+
event.event_type = 'push'
|
28
|
+
event.branch = entry.links.first.split('/').pop
|
29
|
+
when /ForkApplyEvent/
|
30
|
+
event.event_type = 'fork_apply'
|
31
|
+
event.branch = entry.links.first.split('/').pop
|
32
|
+
when /ForkEvent/
|
33
|
+
event.event_type = 'fork'
|
34
|
+
event.forked_from = Repo.new(entry.title.split(" forked ").pop)
|
35
|
+
when /WatchEvent/
|
36
|
+
event.event_type = 'watch'
|
37
|
+
|
38
|
+
when /FollowEvent/
|
39
|
+
event.event_type = 'follow'
|
40
|
+
event.target_user = entry.links.first.split("/").pop
|
41
|
+
when /IssuesEvent/
|
42
|
+
event.event_type = 'issue'
|
43
|
+
event.action = entry.title[/closed|opened|reopened/]
|
44
|
+
event.issue_number = entry.title[/\s\d+\s/].strip.to_i
|
45
|
+
when /GistEvent/
|
46
|
+
event.event_type = 'gist'
|
47
|
+
event.gist_number = entry.links.first.split('/').pop.to_i
|
48
|
+
when /WikiEvent/
|
49
|
+
event.event_type = 'wiki'
|
50
|
+
event.page = entry.links.first.split('/').pop
|
51
|
+
else
|
52
|
+
|
53
|
+
end
|
54
|
+
event.repo = Repo.from_url(entry.links.first) unless %w(follow gist).include?(event.event_type)
|
55
|
+
event
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/octopussy/repo.rb
CHANGED
@@ -1,33 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
module Octopussy
|
2
|
+
class Repo
|
3
|
+
attr_accessor :username, :name
|
4
|
+
|
5
|
+
def initialize(repo)
|
6
|
+
if repo.is_a?(String)
|
7
|
+
repo = repo.split("/")
|
8
|
+
@name = repo.pop
|
9
|
+
@username = repo.pop
|
10
|
+
elsif repo.is_a?(Repo)
|
11
|
+
@username = repo.username
|
12
|
+
@name = repo.name
|
13
|
+
elsif repo.is_a?(Hash)
|
14
|
+
@name = repo[:repo] ||= repo[:name]
|
15
|
+
@username = repo[:username] ||= repo[:user] ||= repo[:owner]
|
16
|
+
end
|
15
17
|
end
|
16
|
-
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
def slug
|
20
|
+
"#{@username}/#{@name}"
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def to_s
|
24
|
+
self.slug
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
def url
|
28
|
+
"http://github.com/#{slug}"
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
def user
|
32
|
+
@username
|
33
|
+
end
|
34
|
+
|
35
|
+
def repo
|
36
|
+
@name
|
37
|
+
end
|
38
|
+
|
39
|
+
def user=(val)
|
40
|
+
@username = val
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.from_url(url)
|
44
|
+
return if url.nil?
|
45
|
+
username, name = url.gsub("http://github.com/", "").split("/")
|
46
|
+
Repo.new("#{username}/#{name}")
|
47
|
+
end
|
32
48
|
end
|
33
49
|
end
|
data/lib/octopussy.rb
CHANGED
data/octopussy.gemspec
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{octopussy}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Wynn Netherland", "Adam Stacoviak"]
|
12
|
+
s.date = %q{2009-12-12}
|
13
|
+
s.description = %q{Simple wrapper for the GitHub API v2}
|
14
|
+
s.email = %q{wynn.netherland@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.markdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"changelog.markdown",
|
27
|
+
"lib/octopussy.rb",
|
28
|
+
"lib/octopussy/client.rb",
|
29
|
+
"lib/octopussy/event.rb",
|
30
|
+
"lib/octopussy/repo.rb",
|
31
|
+
"octopussy.gemspec",
|
32
|
+
"test/fixtures/blob.json",
|
33
|
+
"test/fixtures/branches.json",
|
34
|
+
"test/fixtures/close_issue.json",
|
35
|
+
"test/fixtures/collaborators.json",
|
36
|
+
"test/fixtures/comment.json",
|
37
|
+
"test/fixtures/emails.json",
|
38
|
+
"test/fixtures/followers.json",
|
39
|
+
"test/fixtures/full_user.json",
|
40
|
+
"test/fixtures/issue.json",
|
41
|
+
"test/fixtures/issues.json",
|
42
|
+
"test/fixtures/keys.json",
|
43
|
+
"test/fixtures/labels.json",
|
44
|
+
"test/fixtures/languages.json",
|
45
|
+
"test/fixtures/network.json",
|
46
|
+
"test/fixtures/network_data.json",
|
47
|
+
"test/fixtures/network_meta.json",
|
48
|
+
"test/fixtures/open_issue.json",
|
49
|
+
"test/fixtures/raw_git_data.json",
|
50
|
+
"test/fixtures/reopen_issue.json",
|
51
|
+
"test/fixtures/repo.json",
|
52
|
+
"test/fixtures/repo_search.json",
|
53
|
+
"test/fixtures/repos.json",
|
54
|
+
"test/fixtures/search.json",
|
55
|
+
"test/fixtures/tags.json",
|
56
|
+
"test/fixtures/trees.json",
|
57
|
+
"test/fixtures/user.json",
|
58
|
+
"test/helper.rb",
|
59
|
+
"test/test_octopussy.rb",
|
60
|
+
"test/test_repo.rb"
|
61
|
+
]
|
62
|
+
s.homepage = %q{http://github.com/pengwynn/octopussy}
|
63
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
64
|
+
s.require_paths = ["lib"]
|
65
|
+
s.rubygems_version = %q{1.3.5}
|
66
|
+
s.summary = %q{Simple wrapper for the GitHub API}
|
67
|
+
s.test_files = [
|
68
|
+
"test/helper.rb",
|
69
|
+
"test/test_octopussy.rb",
|
70
|
+
"test/test_repo.rb"
|
71
|
+
]
|
72
|
+
|
73
|
+
if s.respond_to? :specification_version then
|
74
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
75
|
+
s.specification_version = 3
|
76
|
+
|
77
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
78
|
+
s.add_runtime_dependency(%q<hashie>, ["~> 0.1.3"])
|
79
|
+
s.add_runtime_dependency(%q<httparty>, ["~> 0.4.5"])
|
80
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
|
81
|
+
s.add_development_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
82
|
+
s.add_development_dependency(%q<mocha>, ["= 0.9.4"])
|
83
|
+
s.add_development_dependency(%q<fakeweb>, [">= 1.2.5"])
|
84
|
+
else
|
85
|
+
s.add_dependency(%q<hashie>, ["~> 0.1.3"])
|
86
|
+
s.add_dependency(%q<httparty>, ["~> 0.4.5"])
|
87
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
|
88
|
+
s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
89
|
+
s.add_dependency(%q<mocha>, ["= 0.9.4"])
|
90
|
+
s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
|
91
|
+
end
|
92
|
+
else
|
93
|
+
s.add_dependency(%q<hashie>, ["~> 0.1.3"])
|
94
|
+
s.add_dependency(%q<httparty>, ["~> 0.4.5"])
|
95
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
|
96
|
+
s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
|
97
|
+
s.add_dependency(%q<mocha>, ["= 0.9.4"])
|
98
|
+
s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
data/test/test_octopussy.rb
CHANGED
@@ -394,4 +394,221 @@ class TestOctopussy < Test::Unit::TestCase
|
|
394
394
|
|
395
395
|
end
|
396
396
|
|
397
|
+
context "when consuming feeds" do
|
398
|
+
|
399
|
+
should "should set user and published time for the event" do
|
400
|
+
entry = Hashie::Mash.new({
|
401
|
+
:id => 'tag:github.com,2008:CreateEvent/110645788',
|
402
|
+
:published => '2009-12-12T11:24:14-08:00',
|
403
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
404
|
+
:links => ['http://github.com/jnunemaker/twitter/tree/v0.7.10'],
|
405
|
+
:title => 'pengwynn created tag v0.7.10 at jnunemaker/twitter',
|
406
|
+
:author => 'pengwynn'
|
407
|
+
})
|
408
|
+
|
409
|
+
event = Octopussy::Event.load_from_atom(entry)
|
410
|
+
event.user.should == 'pengwynn'
|
411
|
+
event.published.year.should == 2009
|
412
|
+
event.published.month.should == 12
|
413
|
+
end
|
414
|
+
|
415
|
+
should "should create a create_repo event from an atom entry" do
|
416
|
+
entry = Hashie::Mash.new({
|
417
|
+
:id => 'tag:github.com,2008:CreateEvent/110645788',
|
418
|
+
:published => '2009-12-12T11:24:14-08:00',
|
419
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
420
|
+
:links => ['http://github.com/Tanner/Team-1261---Java'],
|
421
|
+
:title => 'Tanner created repository Team-1261---Java',
|
422
|
+
:author => 'Tanner'
|
423
|
+
})
|
424
|
+
|
425
|
+
event = Octopussy::Event.load_from_atom(entry)
|
426
|
+
event.event_type.should == 'create_repo'
|
427
|
+
event.repo.username.should == 'Tanner'
|
428
|
+
event.repo.name.should == 'Team-1261---Java'
|
429
|
+
end
|
430
|
+
|
431
|
+
should "should create a create_tag event from an atom entry" do
|
432
|
+
entry = Hashie::Mash.new({
|
433
|
+
:id => 'tag:github.com,2008:CreateEvent/110645788',
|
434
|
+
:published => '2009-12-12T11:24:14-08:00',
|
435
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
436
|
+
:links => ['http://github.com/jnunemaker/twitter/tree/v0.7.10'],
|
437
|
+
:title => 'pengwynn created tag v0.7.10 at jnunemaker/twitter',
|
438
|
+
:author => 'pengwynn'
|
439
|
+
})
|
440
|
+
|
441
|
+
event = Octopussy::Event.load_from_atom(entry)
|
442
|
+
event.event_type.should == 'create_tag'
|
443
|
+
event.repo.username.should == 'jnunemaker'
|
444
|
+
event.repo.name.should == 'twitter'
|
445
|
+
event.tag.should == 'v0.7.10'
|
446
|
+
end
|
447
|
+
|
448
|
+
should "should create a create_branch event from an atom entry" do
|
449
|
+
entry = Hashie::Mash.new({
|
450
|
+
:id => 'tag:github.com,2008:CreateEvent/110645788',
|
451
|
+
:published => '2009-12-12T11:24:14-08:00',
|
452
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
453
|
+
:links => ['http://github.com/Fabi/cwcore/tree/cwcore-0.1'],
|
454
|
+
:title => 'cwcore created branch cwcore-0.1 at Fabi/cwcore',
|
455
|
+
:author => 'cwcore'
|
456
|
+
})
|
457
|
+
|
458
|
+
event = Octopussy::Event.load_from_atom(entry)
|
459
|
+
event.event_type.should == 'create_branch'
|
460
|
+
event.repo.username.should == 'Fabi'
|
461
|
+
event.repo.name.should == 'cwcore'
|
462
|
+
event.user.should == 'cwcore'
|
463
|
+
event.branch.should == 'cwcore-0.1'
|
464
|
+
end
|
465
|
+
|
466
|
+
should "should create a push event from an atom entry" do
|
467
|
+
entry = Hashie::Mash.new({
|
468
|
+
:id => 'tag:github.com,2008:PushEvent/110645788',
|
469
|
+
:published => '2009-12-12T11:24:14-08:00',
|
470
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
471
|
+
:links => ['http://github.com/jnunemaker/twitter/commits/master'],
|
472
|
+
:title => 'pengwynn pushed to master at jnunemaker/twitter',
|
473
|
+
:author => 'pengwynn'
|
474
|
+
})
|
475
|
+
|
476
|
+
event = Octopussy::Event.load_from_atom(entry)
|
477
|
+
event.event_type.should == 'push'
|
478
|
+
event.repo.name.should == 'twitter'
|
479
|
+
event.branch.should == 'master'
|
480
|
+
end
|
481
|
+
|
482
|
+
should "should create a fork event from an atom entry" do
|
483
|
+
entry = Hashie::Mash.new({
|
484
|
+
:id => 'tag:github.com,2008:ForkEvent/110645788',
|
485
|
+
:published => '2009-12-12T11:24:14-08:00',
|
486
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
487
|
+
:links => ['http://github.com/klauge/aeon/'],
|
488
|
+
:title => 'klauge forked djh/aeon',
|
489
|
+
:author => 'klauge'
|
490
|
+
})
|
491
|
+
|
492
|
+
event = Octopussy::Event.load_from_atom(entry)
|
493
|
+
event.event_type.should == 'fork'
|
494
|
+
event.repo.username.should == 'klauge'
|
495
|
+
event.repo.name.should == 'aeon'
|
496
|
+
event.forked_from.username.should == 'djh'
|
497
|
+
end
|
498
|
+
|
499
|
+
should "should create a watch event from an atom entry" do
|
500
|
+
entry = Hashie::Mash.new({
|
501
|
+
:id => 'tag:github.com,2008:WatchEvent/110645788',
|
502
|
+
:published => '2009-12-12T11:24:14-08:00',
|
503
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
504
|
+
:links => ['http://github.com/bogolisk/egg'],
|
505
|
+
:title => 'jpablobr started watching bogolisk/egg',
|
506
|
+
:author => 'jpablobr'
|
507
|
+
})
|
508
|
+
|
509
|
+
event = Octopussy::Event.load_from_atom(entry)
|
510
|
+
event.event_type.should == 'watch'
|
511
|
+
event.repo.username.should == 'bogolisk'
|
512
|
+
event.repo.name.should == 'egg'
|
513
|
+
end
|
514
|
+
|
515
|
+
should "should create a follow event from an atom entry" do
|
516
|
+
entry = Hashie::Mash.new({
|
517
|
+
:id => 'tag:github.com,2008:FollowEvent/110645788',
|
518
|
+
:published => '2009-12-12T11:24:14-08:00',
|
519
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
520
|
+
:links => ['http://github.com/swistak'],
|
521
|
+
:title => 'pengwynn started following swistak',
|
522
|
+
:author => 'pengwynn'
|
523
|
+
})
|
524
|
+
|
525
|
+
event = Octopussy::Event.load_from_atom(entry)
|
526
|
+
event.event_type.should == 'follow'
|
527
|
+
event.repo.should == nil
|
528
|
+
event.target_user.should == 'swistak'
|
529
|
+
end
|
530
|
+
|
531
|
+
should "should create an issues event from an atom entry" do
|
532
|
+
entry = Hashie::Mash.new({
|
533
|
+
:id => 'tag:github.com,2008:IssuesEvent/110645788',
|
534
|
+
:published => '2009-12-12T11:24:14-08:00',
|
535
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
536
|
+
:links => ['http://github.com/jnunemaker/twitter/issues/19/find'],
|
537
|
+
:title => 'pengwynn closed issue 19 on jnunemaker/twitter',
|
538
|
+
:author => 'pengwynn'
|
539
|
+
})
|
540
|
+
|
541
|
+
event = Octopussy::Event.load_from_atom(entry)
|
542
|
+
event.event_type.should == 'issue'
|
543
|
+
event.repo.name.should == 'twitter'
|
544
|
+
event.action.should == 'closed'
|
545
|
+
event.issue_number.should == 19
|
546
|
+
end
|
547
|
+
|
548
|
+
should "should create a gist event from an atom entry" do
|
549
|
+
entry = Hashie::Mash.new({
|
550
|
+
:id => 'tag:github.com,2008:GistEvent/110645788',
|
551
|
+
:published => '2009-12-12T11:24:14-08:00',
|
552
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
553
|
+
:links => ['http://gist.github.com/253987'],
|
554
|
+
:title => 'pengwynn created gist: 253987',
|
555
|
+
:author => 'pengwynn'
|
556
|
+
})
|
557
|
+
|
558
|
+
event = Octopussy::Event.load_from_atom(entry)
|
559
|
+
event.event_type.should == 'gist'
|
560
|
+
event.repo.should == nil
|
561
|
+
event.gist_number.should == 253987
|
562
|
+
end
|
563
|
+
|
564
|
+
should "should create a member event from an atom entry" do
|
565
|
+
entry = Hashie::Mash.new({
|
566
|
+
:id => 'tag:github.com,2008:MemberEvent/110645788',
|
567
|
+
:published => '2009-12-12T11:24:14-08:00',
|
568
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
569
|
+
:links => ['http://github.com/pengwynn/octopussy'],
|
570
|
+
:title => 'pengwynn added adamstac to octopussy',
|
571
|
+
:author => 'pengwynn'
|
572
|
+
})
|
573
|
+
|
574
|
+
event = Octopussy::Event.load_from_atom(entry)
|
575
|
+
event.event_type.should == 'member'
|
576
|
+
event.repo.name.should == 'octopussy'
|
577
|
+
event.target_user.should == 'adamstac'
|
578
|
+
end
|
579
|
+
|
580
|
+
should "should create a fork_apply event from an atom entry" do
|
581
|
+
entry = Hashie::Mash.new({
|
582
|
+
:id => 'tag:github.com,2008:ForkApplyEvent/110645788',
|
583
|
+
:published => '2009-12-12T11:24:14-08:00',
|
584
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
585
|
+
:links => ['http://github.com/pengwynn/linkedin/tree/integration'],
|
586
|
+
:title => 'pengwynn applied fork commits to linkedin/integration',
|
587
|
+
:author => 'pengwynn'
|
588
|
+
})
|
589
|
+
|
590
|
+
event = Octopussy::Event.load_from_atom(entry)
|
591
|
+
event.event_type.should == 'fork_apply'
|
592
|
+
event.repo.name.should == 'linkedin'
|
593
|
+
event.branch.should == 'integration'
|
594
|
+
end
|
595
|
+
|
596
|
+
should "should create a wiki event from an atom entry" do
|
597
|
+
entry = Hashie::Mash.new({
|
598
|
+
:id => 'tag:github.com,2008:WikiEvent/110645788',
|
599
|
+
:published => '2009-12-12T11:24:14-08:00',
|
600
|
+
:updated => '2009-12-12T11:24:14-08:00',
|
601
|
+
:links => ['http://github.com/dxw/Fammel/wikis/documentation'],
|
602
|
+
:title => 'dxw edited a page in the dxw/Fammel wiki',
|
603
|
+
:author => 'dxw'
|
604
|
+
})
|
605
|
+
|
606
|
+
event = Octopussy::Event.load_from_atom(entry)
|
607
|
+
event.event_type.should == 'wiki'
|
608
|
+
event.repo.name.should == 'Fammel'
|
609
|
+
event.page.should == 'documentation'
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
|
397
614
|
end
|
data/test/test_repo.rb
CHANGED
@@ -3,7 +3,7 @@ require 'helper'
|
|
3
3
|
class TestRepo < Test::Unit::TestCase
|
4
4
|
context "when passed a string containg a forward slash" do
|
5
5
|
setup do
|
6
|
-
@repo = Repo.new("pengwynn/linkedin")
|
6
|
+
@repo = Octopussy::Repo.new("pengwynn/linkedin")
|
7
7
|
end
|
8
8
|
|
9
9
|
should "set the username and repo name" do
|
@@ -16,12 +16,21 @@ class TestRepo < Test::Unit::TestCase
|
|
16
16
|
@repo.user.should == "pengwynn"
|
17
17
|
end
|
18
18
|
|
19
|
+
should "render slug as string" do
|
20
|
+
@repo.slug.should == "pengwynn/linkedin"
|
21
|
+
@repo.to_s.should == @repo.slug
|
22
|
+
end
|
23
|
+
|
24
|
+
should "render url as string" do
|
25
|
+
@repo.url.should == 'http://github.com/pengwynn/linkedin'
|
26
|
+
end
|
27
|
+
|
19
28
|
end
|
20
29
|
|
21
30
|
context "when passed a hash" do
|
22
31
|
|
23
32
|
should "should set username and repo" do
|
24
|
-
repo =
|
33
|
+
repo = Octopussy::Repo.new({:username => 'pengwynn', :name => 'linkedin'})
|
25
34
|
repo.name.should == "linkedin"
|
26
35
|
repo.username.should == "pengwynn"
|
27
36
|
end
|
@@ -29,13 +38,13 @@ class TestRepo < Test::Unit::TestCase
|
|
29
38
|
|
30
39
|
context "when passed a Repo" do
|
31
40
|
|
32
|
-
should "
|
33
|
-
repo =
|
41
|
+
should "set username and repo" do
|
42
|
+
repo = Octopussy::Repo.new( Octopussy::Repo.new('pengwynn/linkedin'))
|
34
43
|
repo.name.should == "linkedin"
|
35
44
|
repo.username.should == "pengwynn"
|
36
45
|
end
|
37
46
|
end
|
38
|
-
|
47
|
+
|
39
48
|
|
40
49
|
|
41
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopussy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -92,7 +92,9 @@ files:
|
|
92
92
|
- changelog.markdown
|
93
93
|
- lib/octopussy.rb
|
94
94
|
- lib/octopussy/client.rb
|
95
|
+
- lib/octopussy/event.rb
|
95
96
|
- lib/octopussy/repo.rb
|
97
|
+
- octopussy.gemspec
|
96
98
|
- test/fixtures/blob.json
|
97
99
|
- test/fixtures/branches.json
|
98
100
|
- test/fixtures/close_issue.json
|