octopussy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/changelog.markdown CHANGED
@@ -1,6 +1,8 @@
1
1
  # Changelog
2
-
3
- ## 0.0.2
2
+ ## 0.1.2
3
+ * Added Delete event type
4
+ * Added Public event type
5
+ ## 0.1.1
4
6
  * Added Comment event type
5
7
  ## 0.0.1 Initial version
6
8
  * GitHub v2 API complete
@@ -4,7 +4,7 @@ module Octopussy
4
4
  def self.load_from_atom(entry)
5
5
  entry = entry.to_mash if entry.is_a?(Hash)
6
6
 
7
- event = Hashie::Mash.new({:user => entry.author})
7
+ event = Hashie::Mash.new({:user => entry.author, :title => entry.title})
8
8
  event.published = (entry.published.is_a?(String) ? DateTime.parse(entry.published) : entry.published)
9
9
  event.id = entry.id.split("/").pop.to_i
10
10
 
@@ -32,7 +32,8 @@ module Octopussy
32
32
  event.branch = entry.links.first.split('/').pop
33
33
  when /ForkEvent/
34
34
  event.event_type = 'fork'
35
- event.forked_from = Repo.new(entry.title.split(" forked ").pop)
35
+ segments = entry.title.split(" ")
36
+ event.forked_from = Repo.new(segments.last)
36
37
  when /WatchEvent/
37
38
  event.event_type = 'watch'
38
39
 
@@ -51,10 +52,18 @@ module Octopussy
51
52
  event.page = entry.links.first.split('/').pop
52
53
  when /CommitCommentEvent/
53
54
  event.event_type = 'comment'
55
+ when /DeleteEvent/
56
+ event.event_type = 'delete'
57
+ segments = entry.title.split(' ')
58
+ event.branch = segments[3]
59
+ event.repo = Repo.new(segments[5])
60
+ when /PublicEvent/
61
+ event.event_type = 'public'
62
+ event.repo = Repo.new(entry.title.split(" ")[3])
54
63
  else
55
-
64
+ puts "Unknown event type: #{entry.id}"
56
65
  end
57
- event.repo = Repo.from_url(entry.links.first) unless %w(follow gist).include?(event.event_type)
66
+ event.repo = Repo.from_url(entry.links.first) unless %w(follow gist delete public).include?(event.event_type)
58
67
  event
59
68
  end
60
69
  end
data/octopussy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{octopussy}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wynn Netherland", "Adam Stacoviak"]
12
- s.date = %q{2009-12-15}
12
+ s.date = %q{2009-12-16}
13
13
  s.description = %q{Simple wrapper for the GitHub API v2}
14
14
  s.email = %q{wynn.netherland@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -396,7 +396,7 @@ class TestOctopussy < Test::Unit::TestCase
396
396
 
397
397
  context "when consuming feeds" do
398
398
 
399
- should "should set user and published time for the event" do
399
+ should "should set user, title, and published time for the event" do
400
400
  entry = Hashie::Mash.new({
401
401
  :id => 'tag:github.com,2008:CreateEvent/110645788',
402
402
  :published => '2009-12-12T11:24:14-08:00',
@@ -411,6 +411,7 @@ class TestOctopussy < Test::Unit::TestCase
411
411
  event.published.year.should == 2009
412
412
  event.published.month.should == 12
413
413
  event.id.should == 110645788
414
+ event.title.should == 'pengwynn created tag v0.7.10 at jnunemaker/twitter'
414
415
  end
415
416
 
416
417
  should "should create a repo event from an atom entry" do
@@ -624,6 +625,37 @@ class TestOctopussy < Test::Unit::TestCase
624
625
  event.event_type.should == 'comment'
625
626
  event.repo.name.should == 'resque'
626
627
  end
628
+
629
+ should "should create a delete event from an atom entry" do
630
+ entry = Hashie::Mash.new({
631
+ :id => 'tag:github.com,2008:DeleteEvent/110645788',
632
+ :published => '2009-12-12T11:24:14-08:00',
633
+ :updated => '2009-12-12T11:24:14-08:00',
634
+ :links => ['http://github.com/jinzhu'],
635
+ :title => 'jinzhu deleted branch search at jinzhu/vimlike-smooziee',
636
+ :author => 'jinzhu'
637
+ })
638
+
639
+ event = Octopussy::Event.load_from_atom(entry)
640
+ event.event_type.should == 'delete'
641
+ event.repo.name.should == 'vimlike-smooziee'
642
+ event.branch.should == 'search'
643
+ end
644
+
645
+ should "should create a public event from an atom entry" do
646
+ entry = Hashie::Mash.new({
647
+ :id => 'tag:github.com,2008:PublicEvent/110645788',
648
+ :published => '2009-12-12T11:24:14-08:00',
649
+ :updated => '2009-12-12T11:24:14-08:00',
650
+ :links => ['http://github.com/intalio'],
651
+ :title => 'intalio open sourced bpmn2',
652
+ :author => 'intalio'
653
+ })
654
+
655
+ event = Octopussy::Event.load_from_atom(entry)
656
+ event.event_type.should == 'public'
657
+ event.repo.name.should == 'bpmn2'
658
+ end
627
659
  end
628
660
 
629
661
 
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-15 00:00:00 -06:00
13
+ date: 2009-12-16 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency