github-watching 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE.txt +20 -0
  3. data/README.md +33 -0
  4. data/bin/github-watching +60 -0
  5. metadata +89 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1906c90134ac15cb85202507a6331cf269966aa3
4
+ data.tar.gz: bc05c38253eed5f77db6c363aadaba7291c66eb6
5
+ SHA512:
6
+ metadata.gz: 846cd7e818357c37ae0332f43393aedef85c30b4a055838d559fad26197e36663ecc256479589ef4d74a8eb913c19973edc075a9c7fd1f96c6f86c3699ff730c
7
+ data.tar.gz: 24c8944ba1d5ca84ff50e3d00ce89eaa17b45b329afcf43c37dfb05c1179a4df2c66580f14a06e3ab80fef353ea500d857dd47c05ce7ef32c5a6503db051c35d
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2016 Michael Grosser <michael@grosser.it>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ Manage your github watchings
2
+
3
+ - create a [application token](https://github.com/settings/applications) with read access
4
+ - `gem install github-watching`
5
+ - `github-watching sub-command arguments`
6
+ - follow instructions
7
+
8
+ ```
9
+ bundle
10
+
11
+ # list unwatched owned repos
12
+ github-watching unwatched grosser
13
+ Loading /users/grosser/subscriptions page 1
14
+ ...
15
+ Loading /users/grosser/subscriptions page 4
16
+ Loading /users/grosser/repos page 1
17
+ ...
18
+ Loading /users/grosser/repos page 5
19
+ 122 unwatched repos
20
+ grosser/active_record-comments
21
+ grosser/addressable
22
+ grosser/airbrake_tools
23
+ grosser/air_man
24
+
25
+ # TODO: more features
26
+ ```
27
+
28
+ Author
29
+ ======
30
+
31
+ [Michael Grosser](http://grosser.it)<br/>
32
+ michael@grosser.it<br/>
33
+ License: MIT
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cgi'
3
+ require 'json'
4
+
5
+ def usage
6
+ puts <<-TEXT.gsub(/^ /, "")
7
+ Setup
8
+ -----
9
+ # create a new token at https://github.com/settings/tokens/new with repo access
10
+ git config github.token NEW_TOKEN --local
11
+
12
+ Usage
13
+ -----
14
+ #{$0} unwatched username # list your unwatched repos
15
+ TEXT
16
+ exit 1
17
+ end
18
+
19
+ def all(path)
20
+ per_page = 100
21
+ page = 1
22
+ all = []
23
+
24
+ loop do
25
+ response = page(path, page, per_page)
26
+ $stderr.puts "Loading #{path} page #{page}"
27
+ all.concat response
28
+ break if response.size < per_page
29
+ page += 1
30
+ end
31
+
32
+ all
33
+ end
34
+
35
+ def page(path, page, per_page)
36
+ github_token = `git config github.token`.strip
37
+ usage if github_token.empty?
38
+
39
+ url = "https://api.github.com#{path}?per_page=#{per_page}&page=#{page}"
40
+ command = "curl --silent --fail -H 'Authorization: token #{github_token}' -H 'Accept: application/vnd.github.v3.text-match+json' '#{url}'"
41
+ response = `#{command}`
42
+ raise "ERROR Request failed, reply was: #{response.inspect}" unless $?.success?
43
+
44
+ JSON.load(response)
45
+ end
46
+
47
+ command = ARGV.shift
48
+ username = ARGV.shift
49
+ usage if ARGV.size != 0
50
+
51
+ case command
52
+ when 'unwatched'
53
+ subs = all("/users/#{username}/subscriptions").map { |s| s['full_name'] }
54
+ repos = all("/users/#{username}/repos").map { |r| r['full_name'] }
55
+ unwatched = repos - subs
56
+ $stderr.puts "#{unwatched.size} unwatched repos"
57
+ puts unwatched
58
+ else
59
+ usage
60
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github-watching
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Grosser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bump
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email: michael@grosser.it
57
+ executables:
58
+ - github-watching
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE.txt
63
+ - README.md
64
+ - bin/github-watching
65
+ homepage: https://github.com/grosser/github-watching
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.0.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.5.1
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Watching manager
89
+ test_files: []