agig 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85c3534182243b9ba925a9068dfa6b45e7992643
4
- data.tar.gz: 360327ae6d1e468a68afa2ed31f12f56968428c1
3
+ metadata.gz: b93f4ed4d50aa5b7cab7c8ec61b4c3b54ea1d3f4
4
+ data.tar.gz: 20b66f126aebb992a727d17b5cefa10db6186057
5
5
  SHA512:
6
- metadata.gz: f18dbae633187362b4dfe8f96aafdd3d5ef5be40ee476a96ff3dafbf1e633f1736435b9deb9bb0acef0e7a68783034d6f11338d1b9bfed786339122f13139e45
7
- data.tar.gz: 370b74d5eb2449eff2141bdc11e5e5c1e544675e02800ac3208c2ee39ff14195aec4b2758a101194b286ff4f7006f6f07d2846f402ffb545daf8bbed4e618102
6
+ metadata.gz: 910e7f3bb94854b672b8630fa480fd10376824fda2f398f40fba627bbca30e312c49d7c54b12c1e0c26a1cd2998bef9c8271ee0907c4a7185e9873d41fcd9287
7
+ data.tar.gz: 5c6fb99fd2d246d28d500b2e2df98c869946247dca665d4b90ea1c4e4957be0e53fa443d014253da952faa8b095e8515bb03573eb02e1a34ecdbe7b986969ccc
data/README.md CHANGED
@@ -8,22 +8,9 @@ Modified from original gig.rb:
8
8
  * use open-uri instead of net/https
9
9
  * create new channel, it includes user activities.
10
10
 
11
- ## Installation
12
-
13
- Add this line to your application's Gemfile:
14
-
15
- gem 'agig'
16
-
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
11
+ ## Installation and Usage
22
12
 
23
13
  $ gem install agig
24
-
25
- ## Usage
26
-
27
14
  $ agig -d
28
15
 
29
16
  ## Contributing
@@ -33,3 +20,8 @@ Or install it yourself as:
33
20
  3. Commit your changes (`git commit -am 'Added some feature'`)
34
21
  4. Push to the branch (`git push origin my-new-feature`)
35
22
  5. Create new Pull Request
23
+
24
+ ## Contributor
25
+
26
+ * @morygonzalez
27
+
data/lib/agig/session.rb CHANGED
@@ -54,11 +54,13 @@ class Agig::Session < Net::IRC::Server::Session
54
54
  updated_at = Time.parse(entry.updated_at).utc
55
55
  next if updated_at <= @notification_last_retrieved
56
56
 
57
- post entry.repository.owner.login, PRIVMSG, "#notification", "\0035#{entry.subject.title}\017 \00314#{entry.subject.latest_comment_url}\017"
57
+ reachable_url = reachable_url_for(entry.subject.latest_comment_url)
58
+
59
+ post entry.repository.owner.login, PRIVMSG, "#notification", "\0035#{entry.subject.title}\017 \00314#{reachable_url}\017"
58
60
  @notification_last_retrieved = updated_at
59
61
  end
60
62
 
61
- events = client.received_events('hsbt')
63
+ events = client.received_events(@nick)
62
64
  events.sort_by(&:created_at).reverse_each do |event|
63
65
  next if event.type != "WatchEvent"
64
66
 
@@ -81,4 +83,18 @@ class Agig::Session < Net::IRC::Server::Session
81
83
  end
82
84
  end
83
85
  end
86
+
87
+ def reachable_url_for(latest_comment_url)
88
+ repos_owner = latest_comment_url.match(/repos\/(.+?\/.+?)\//)[1]
89
+ if issue_match = latest_comment_url.match(/(?:issues|pulls)\/(\d+?)$/)
90
+ issue_id = issue_match[1]
91
+ latest_comment = client.issue_comments(repos_owner, issue_id).last
92
+ latest_comment ? latest_comment['html_url'] : latest_comment_url.sub(/api\./, '').sub(/repos\//, '')
93
+ elsif comment_match = latest_comment_url.match(/comments\/(\d+?)$/)
94
+ comment_id = comment_match[1]
95
+ client.issue_comment(repos_owner, comment_id)['html_url']
96
+ else
97
+ nil
98
+ end
99
+ end
84
100
  end
data/lib/agig/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Agig
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agig
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
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-09 00:00:00.000000000 Z
11
+ date: 2013-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-irc
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.0.2
94
+ rubygems_version: 2.0.3
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: agig is another Github IRC Gateway. agig is forked from gig.rb, and contained