gns 0.0.1

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.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ log/*.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gns.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Mitsutaka Mimura
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # gns
2
+
3
+ GitHub personalized feed Notification Service use Mountain Lion Notification Center.
4
+
5
+ ## Installation
6
+
7
+ Or install it yourself as:
8
+
9
+ ```
10
+ $ gem install gns
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ 1. `rake build` & `gem install pkg/gns.gem`
16
+ 1. copy from sample/gnsrc to ~/.gncrc
17
+ 2. edit private atom at gncrc
18
+
19
+ ## Usage
20
+
21
+ ### Start
22
+
23
+ ```
24
+ $ gns
25
+ ```
26
+
27
+ ### Stop
28
+
29
+ ```
30
+ $ gns stop
31
+ ```
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/gns ADDED
@@ -0,0 +1,23 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'yaml'
5
+ require 'forever'
6
+ require 'terminal-notifier'
7
+ require_relative '../lib/gns'
8
+
9
+ GNS_RC_FILE = '~/.gnsrc'
10
+
11
+ Forever.run do
12
+ before :all do
13
+ rc_file_path = Pathname.new(GNS_RC_FILE).expand_path
14
+ @settings = YAML.load_file(rc_file_path)
15
+ @github_atom = Gns::GithubAtom.new(@settings[:private_atom_url])
16
+ end
17
+
18
+ every 1.minutes do
19
+ @github_atom.recent_items.each do |item|
20
+ TerminalNotifier.notify item.title, title: item.repo, open: item.url
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gns/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "gns"
8
+ gem.version = Gns::VERSION
9
+ gem.authors = ["Mitsutaka Mimura"]
10
+ gem.email = ["takkanm@gmail.com"]
11
+ gem.description = %q{GitHub personalized feed Notifications Service}
12
+ gem.summary = %q{GitHub personalized feed Notifications Service}
13
+ gem.homepage = "https://github.com/takkanm/gns"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ gem.add_dependency 'foreverb'
20
+ gem.add_dependency 'terminal-notifier'
21
+ end
@@ -0,0 +1,5 @@
1
+ require_relative "./gns/version"
2
+ require_relative "./gns/github_atom"
3
+
4
+ module Gns
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'rss'
2
+ require 'openssl'
3
+ require 'open-uri'
4
+
5
+ module Gns
6
+ class GithubAtom
7
+ def initialize(url, start_time = Time.now)
8
+ @url = url
9
+ @last_updated = start_time
10
+ end
11
+
12
+ def recent_items
13
+ get_atom_items.find_all {|item|
14
+ item.updated > @last_updated
15
+ }.tap {|items|
16
+ @last_updated = items.first.updated if items.first
17
+ }
18
+ end
19
+
20
+ def get_atom_items
21
+ RSS::Parser.parse(open(@url, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)).items.map {|item|
22
+ GithubItem.new(item)
23
+ }
24
+ end
25
+ end
26
+
27
+ class GithubItem
28
+ attr_reader :updated, :title, :url, :body, :repo
29
+
30
+ def initialize(atom_item)
31
+ @updated = atom_item.updated.content
32
+ @title = atom_item.title.content
33
+ @url = atom_item.link.href
34
+ atom_item.content.content =~ /<p>(.*)<\/p>/
35
+ @body = $1
36
+ atom_item.content.content =~ /<a.*>(.*)<\/a>/
37
+ @repo = $1
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module Gns
2
+ VERSION = "0.0.1"
3
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ ---
2
+ # personalized GitHub feed in https://github.com
3
+ :private_atom_url: https://github.com/#{username}.private.atom?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gns
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mitsutaka Mimura
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: foreverb
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: terminal-notifier
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: GitHub personalized feed Notifications Service
47
+ email:
48
+ - takkanm@gmail.com
49
+ executables:
50
+ - gns
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - bin/gns
60
+ - gns.gemspec
61
+ - lib/gns.rb
62
+ - lib/gns/github_atom.rb
63
+ - lib/gns/version.rb
64
+ - log/.gitkeep
65
+ - sample/gnsrc.sample
66
+ homepage: https://github.com/takkanm/gns
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.24
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: GitHub personalized feed Notifications Service
90
+ test_files: []