hubba 0.7.0 → 1.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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -4
- data/README.md +146 -146
- data/Rakefile +30 -30
- data/lib/hubba/config.rb +51 -51
- data/lib/hubba/github.rb +210 -210
- data/lib/hubba/reposet.rb +83 -83
- data/lib/hubba/stats.rb +284 -246
- data/lib/hubba/update.rb +46 -43
- data/lib/hubba/update_traffic.rb +51 -51
- data/lib/hubba/version.rb +18 -18
- data/lib/hubba.rb +46 -46
- data/test/helper.rb +7 -7
- data/test/test_config.rb +31 -31
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 931ab3ccbc1b2a8ce51eb11b56371bbcb81e0a74fd7072a3a0bf30606f4c2392
|
4
|
+
data.tar.gz: 218fa3616853ba3bed20fdbf149ecea67daf1e7d57fa458a4e6a1aa11f68ea98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec60446a92b16c4e6540ee22892508aad4b14e888639fb46bbd4d2bf25c37cbe1e798142a71d95bf7c66be246c8e0734d91f59ee3f02fe9921a038a16d58243
|
7
|
+
data.tar.gz: b443caa9328aaad4e9a41dd4fcfe91f8ce6a6f2379ec9aa2a98e7b6fd1f92e2bc9c1ad90c47d4cf61e89935da00a810639dece7518dc6672fe44c3f02d5ea6ec
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
###
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
### 1.0.1
|
2
|
+
### 0.0.1 / 2015-11-10
|
3
|
+
|
4
|
+
* Everything is new. First release.
|
5
|
+
|
data/README.md
CHANGED
@@ -1,146 +1,146 @@
|
|
1
|
-
# hubba
|
2
|
-
|
3
|
-
hubba gem - (yet) another (lite) GitHub HTTP API client / library
|
4
|
-
|
5
|
-
* home :: [github.com/rubycoco/git](https://github.com/rubycoco/git)
|
6
|
-
* bugs :: [github.com/rubycoco/git/issues](https://github.com/rubycoco/git/issues)
|
7
|
-
* gem :: [rubygems.org/gems/hubba](https://rubygems.org/gems/hubba)
|
8
|
-
* rdoc :: [rubydoc.info/gems/hubba](http://rubydoc.info/gems/hubba)
|
9
|
-
|
10
|
-
|
11
|
-
## Usage
|
12
|
-
|
13
|
-
|
14
|
-
### Step 0: Secrets, Secrets, Secrets - Your Authentication Token
|
15
|
-
|
16
|
-
Note: Set your GitHub env credentials (personal access token preferred) e.g.
|
17
|
-
|
18
|
-
```
|
19
|
-
set HUBBA_TOKEN=abcdef0123456789
|
20
|
-
# - or -
|
21
|
-
set HUBBA_USER=you
|
22
|
-
set HUBBA_PASSWORD=topsecret
|
23
|
-
```
|
24
|
-
|
25
|
-
|
26
|
-
### Step 1: Get a list of all your repos
|
27
|
-
|
28
|
-
Use the GitHub API to get a list of all your repos:
|
29
|
-
|
30
|
-
``` ruby
|
31
|
-
require 'hubba'
|
32
|
-
|
33
|
-
h = Hubba.reposet( 'geraldb' )
|
34
|
-
pp h
|
35
|
-
|
36
|
-
File.open( './repos.yml', 'w' ) { |f| f.write( h.to_yaml ) }
|
37
|
-
```
|
38
|
-
|
39
|
-
resulting in:
|
40
|
-
|
41
|
-
``` yaml
|
42
|
-
geraldb (11):
|
43
|
-
- austria
|
44
|
-
- catalog
|
45
|
-
- chelitas
|
46
|
-
- geraldb.github.io
|
47
|
-
- logos
|
48
|
-
- sandbox
|
49
|
-
- talks
|
50
|
-
- web-proxy-win
|
51
|
-
- webcomponents
|
52
|
-
- webpub-reader
|
53
|
-
- wine.db.tools
|
54
|
-
|
55
|
-
openfootball (41):
|
56
|
-
- africa-cup
|
57
|
-
- austria
|
58
|
-
- club-world-cup
|
59
|
-
- clubs
|
60
|
-
- confed-cup
|
61
|
-
- copa-america
|
62
|
-
- copa-libertadores
|
63
|
-
- copa-sudamericana
|
64
|
-
- deutschland
|
65
|
-
# ...
|
66
|
-
```
|
67
|
-
|
68
|
-
|
69
|
-
Note: If you have more than one account (e.g. an extra robot account or such)
|
70
|
-
you can add them along e.g.
|
71
|
-
|
72
|
-
|
73
|
-
``` ruby
|
74
|
-
h = Hubba.reposet( 'geraldb', 'yorobot' )
|
75
|
-
pp h
|
76
|
-
```
|
77
|
-
|
78
|
-
|
79
|
-
Note: By default all your repos from organizations get auto-included -
|
80
|
-
use the `orgs: false` option to turn off auto-inclusion.
|
81
|
-
|
82
|
-
Note: By default all (personal) repos, that is, repos in your primary (first)
|
83
|
-
account that are forks get auto-excluded.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
### Step 2: Update repo statistics (daily / weekly / monthly)
|
88
|
-
|
89
|
-
|
90
|
-
#### Basics (commits, stars, forks, topics, etc.)
|
91
|
-
|
92
|
-
Use `update_stats` to
|
93
|
-
to get the latest commit, star count and more for all your repos
|
94
|
-
listed in `./repos.yml` via the GitHub API:
|
95
|
-
|
96
|
-
``` ruby
|
97
|
-
Hubba.update_stats( './repos.yml' )
|
98
|
-
```
|
99
|
-
|
100
|
-
Note: By default the datafiles (one per repo)
|
101
|
-
get stored in the `./data` directory.
|
102
|
-
|
103
|
-
|
104
|
-
#### Traffic (page views, clones, referrers, etc.)
|
105
|
-
|
106
|
-
Use `update_traffic` to
|
107
|
-
to get the latest traffic stats (page views, clones, referrers, etc.)
|
108
|
-
for all your repos listed in `./repos.yml` via the GitHub API.
|
109
|
-
|
110
|
-
``` ruby
|
111
|
-
Hubba.update_traffic( './repos.yml' )
|
112
|
-
```
|
113
|
-
|
114
|
-
Note: Access to traffic statistics via the GitHub API
|
115
|
-
requires push access for your GitHub (personal access) token.
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
### Step 3: Generate some statistics / analytics reports
|
121
|
-
|
122
|
-
|
123
|
-
See the [hubba-reports gem](https://github.com/rubycoco/git/tree/master/hubba-reports) on how to use pre-built/pre-packaged ready-to-use
|
124
|
-
github statistics / analytics reports.
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
That's all for now.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
## Installation
|
133
|
-
|
134
|
-
Use
|
135
|
-
|
136
|
-
gem install hubba
|
137
|
-
|
138
|
-
or add the gem to your Gemfile
|
139
|
-
|
140
|
-
gem 'hubba'
|
141
|
-
|
142
|
-
|
143
|
-
## License
|
144
|
-
|
145
|
-
The `hubba` scripts are dedicated to the public domain.
|
146
|
-
Use it as you please with no restrictions whatsoever.
|
1
|
+
# hubba
|
2
|
+
|
3
|
+
hubba gem - (yet) another (lite) GitHub HTTP API client / library
|
4
|
+
|
5
|
+
* home :: [github.com/rubycoco/git](https://github.com/rubycoco/git)
|
6
|
+
* bugs :: [github.com/rubycoco/git/issues](https://github.com/rubycoco/git/issues)
|
7
|
+
* gem :: [rubygems.org/gems/hubba](https://rubygems.org/gems/hubba)
|
8
|
+
* rdoc :: [rubydoc.info/gems/hubba](http://rubydoc.info/gems/hubba)
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
|
14
|
+
### Step 0: Secrets, Secrets, Secrets - Your Authentication Token
|
15
|
+
|
16
|
+
Note: Set your GitHub env credentials (personal access token preferred) e.g.
|
17
|
+
|
18
|
+
```
|
19
|
+
set HUBBA_TOKEN=abcdef0123456789
|
20
|
+
# - or -
|
21
|
+
set HUBBA_USER=you
|
22
|
+
set HUBBA_PASSWORD=topsecret
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
### Step 1: Get a list of all your repos
|
27
|
+
|
28
|
+
Use the GitHub API to get a list of all your repos:
|
29
|
+
|
30
|
+
``` ruby
|
31
|
+
require 'hubba'
|
32
|
+
|
33
|
+
h = Hubba.reposet( 'geraldb' )
|
34
|
+
pp h
|
35
|
+
|
36
|
+
File.open( './repos.yml', 'w' ) { |f| f.write( h.to_yaml ) }
|
37
|
+
```
|
38
|
+
|
39
|
+
resulting in:
|
40
|
+
|
41
|
+
``` yaml
|
42
|
+
geraldb (11):
|
43
|
+
- austria
|
44
|
+
- catalog
|
45
|
+
- chelitas
|
46
|
+
- geraldb.github.io
|
47
|
+
- logos
|
48
|
+
- sandbox
|
49
|
+
- talks
|
50
|
+
- web-proxy-win
|
51
|
+
- webcomponents
|
52
|
+
- webpub-reader
|
53
|
+
- wine.db.tools
|
54
|
+
|
55
|
+
openfootball (41):
|
56
|
+
- africa-cup
|
57
|
+
- austria
|
58
|
+
- club-world-cup
|
59
|
+
- clubs
|
60
|
+
- confed-cup
|
61
|
+
- copa-america
|
62
|
+
- copa-libertadores
|
63
|
+
- copa-sudamericana
|
64
|
+
- deutschland
|
65
|
+
# ...
|
66
|
+
```
|
67
|
+
|
68
|
+
|
69
|
+
Note: If you have more than one account (e.g. an extra robot account or such)
|
70
|
+
you can add them along e.g.
|
71
|
+
|
72
|
+
|
73
|
+
``` ruby
|
74
|
+
h = Hubba.reposet( 'geraldb', 'yorobot' )
|
75
|
+
pp h
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
Note: By default all your repos from organizations get auto-included -
|
80
|
+
use the `orgs: false` option to turn off auto-inclusion.
|
81
|
+
|
82
|
+
Note: By default all (personal) repos, that is, repos in your primary (first)
|
83
|
+
account that are forks get auto-excluded.
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
### Step 2: Update repo statistics (daily / weekly / monthly)
|
88
|
+
|
89
|
+
|
90
|
+
#### Basics (commits, stars, forks, topics, etc.)
|
91
|
+
|
92
|
+
Use `update_stats` to
|
93
|
+
to get the latest commit, star count and more for all your repos
|
94
|
+
listed in `./repos.yml` via the GitHub API:
|
95
|
+
|
96
|
+
``` ruby
|
97
|
+
Hubba.update_stats( './repos.yml' )
|
98
|
+
```
|
99
|
+
|
100
|
+
Note: By default the datafiles (one per repo)
|
101
|
+
get stored in the `./data` directory.
|
102
|
+
|
103
|
+
|
104
|
+
#### Traffic (page views, clones, referrers, etc.)
|
105
|
+
|
106
|
+
Use `update_traffic` to
|
107
|
+
to get the latest traffic stats (page views, clones, referrers, etc.)
|
108
|
+
for all your repos listed in `./repos.yml` via the GitHub API.
|
109
|
+
|
110
|
+
``` ruby
|
111
|
+
Hubba.update_traffic( './repos.yml' )
|
112
|
+
```
|
113
|
+
|
114
|
+
Note: Access to traffic statistics via the GitHub API
|
115
|
+
requires push access for your GitHub (personal access) token.
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
### Step 3: Generate some statistics / analytics reports
|
121
|
+
|
122
|
+
|
123
|
+
See the [hubba-reports gem](https://github.com/rubycoco/git/tree/master/hubba-reports) on how to use pre-built/pre-packaged ready-to-use
|
124
|
+
github statistics / analytics reports.
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
That's all for now.
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
## Installation
|
133
|
+
|
134
|
+
Use
|
135
|
+
|
136
|
+
gem install hubba
|
137
|
+
|
138
|
+
or add the gem to your Gemfile
|
139
|
+
|
140
|
+
gem 'hubba'
|
141
|
+
|
142
|
+
|
143
|
+
## License
|
144
|
+
|
145
|
+
The `hubba` scripts are dedicated to the public domain.
|
146
|
+
Use it as you please with no restrictions whatsoever.
|
data/Rakefile
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'hoe'
|
2
|
-
require './lib/hubba/version.rb'
|
3
|
-
|
4
|
-
Hoe.spec 'hubba' do
|
5
|
-
|
6
|
-
self.version = Hubba::VERSION
|
7
|
-
|
8
|
-
self.summary = 'hubba - (yet) another (lite) GitHub HTTP API client / library'
|
9
|
-
self.description = summary
|
10
|
-
|
11
|
-
self.urls = { home: 'https://github.com/rubycoco/git' }
|
12
|
-
|
13
|
-
self.author = 'Gerald Bauer'
|
14
|
-
self.email = 'ruby-talk@ruby-lang.org'
|
15
|
-
|
16
|
-
# switch extension to .markdown for gihub formatting
|
17
|
-
self.readme_file = 'README.md'
|
18
|
-
self.history_file = 'CHANGELOG.md'
|
19
|
-
|
20
|
-
self.extra_deps = [
|
21
|
-
['webclient', '>= 0.1.1']
|
22
|
-
]
|
23
|
-
|
24
|
-
self.licenses = ['Public Domain']
|
25
|
-
|
26
|
-
self.spec_extras = {
|
27
|
-
required_ruby_version: '>= 2.2.2'
|
28
|
-
}
|
29
|
-
|
30
|
-
end
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/hubba/version.rb'
|
3
|
+
|
4
|
+
Hoe.spec 'hubba' do
|
5
|
+
|
6
|
+
self.version = Hubba::VERSION
|
7
|
+
|
8
|
+
self.summary = 'hubba - (yet) another (lite) GitHub HTTP API client / library'
|
9
|
+
self.description = summary
|
10
|
+
|
11
|
+
self.urls = { home: 'https://github.com/rubycoco/git' }
|
12
|
+
|
13
|
+
self.author = 'Gerald Bauer'
|
14
|
+
self.email = 'ruby-talk@ruby-lang.org'
|
15
|
+
|
16
|
+
# switch extension to .markdown for gihub formatting
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'CHANGELOG.md'
|
19
|
+
|
20
|
+
self.extra_deps = [
|
21
|
+
['webclient', '>= 0.1.1']
|
22
|
+
]
|
23
|
+
|
24
|
+
self.licenses = ['Public Domain']
|
25
|
+
|
26
|
+
self.spec_extras = {
|
27
|
+
required_ruby_version: '>= 2.2.2'
|
28
|
+
}
|
29
|
+
|
30
|
+
end
|
data/lib/hubba/config.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
module Hubba
|
2
|
-
|
3
|
-
class Configuration
|
4
|
-
def data_dir() @data_dir || './data'; end
|
5
|
-
def data_dir=( value ) @data_dir = value; end
|
6
|
-
|
7
|
-
### todo/check: rename to/use tmp_dir - why? why not?
|
8
|
-
def cache_dir() @cache_dir || './cache'; end
|
9
|
-
def cache_dir=( value ) @cache_dir = value; end
|
10
|
-
|
11
|
-
|
12
|
-
# try default setup via ENV variables
|
13
|
-
def token() @token || ENV[ 'HUBBA_TOKEN' ]; end
|
14
|
-
def token=( value ) @token = value; end
|
15
|
-
|
16
|
-
# todo/check: use HUBBA_LOGIN - why? why not?
|
17
|
-
def user() @user || ENV[ 'HUBBA_USER' ]; end
|
18
|
-
def password() @password || ENV[ 'HUBBA_PASSWORD' ]; end
|
19
|
-
def user=( value ) @user = value; end
|
20
|
-
def password=( value ) @password = value; end
|
21
|
-
|
22
|
-
end # class Configuration
|
23
|
-
|
24
|
-
|
25
|
-
## lets you use
|
26
|
-
## Hubba.configure do |config|
|
27
|
-
## config.token = 'secret'
|
28
|
-
## -or-
|
29
|
-
## config.user = 'testdada'
|
30
|
-
## config.password = 'secret'
|
31
|
-
## end
|
32
|
-
##
|
33
|
-
## move configure block to GitHub class - why? why not?
|
34
|
-
## e.g. GitHub.configure do |config|
|
35
|
-
## ...
|
36
|
-
## end
|
37
|
-
|
38
|
-
|
39
|
-
def self.configuration
|
40
|
-
@configuration ||= Configuration.new
|
41
|
-
end
|
42
|
-
class << self
|
43
|
-
alias_method :config, :configuration
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
def self.configure
|
48
|
-
yield( configuration )
|
49
|
-
end
|
50
|
-
|
51
|
-
end # module Hubba
|
1
|
+
module Hubba
|
2
|
+
|
3
|
+
class Configuration
|
4
|
+
def data_dir() @data_dir || './data'; end
|
5
|
+
def data_dir=( value ) @data_dir = value; end
|
6
|
+
|
7
|
+
### todo/check: rename to/use tmp_dir - why? why not?
|
8
|
+
def cache_dir() @cache_dir || './cache'; end
|
9
|
+
def cache_dir=( value ) @cache_dir = value; end
|
10
|
+
|
11
|
+
|
12
|
+
# try default setup via ENV variables
|
13
|
+
def token() @token || ENV[ 'HUBBA_TOKEN' ]; end
|
14
|
+
def token=( value ) @token = value; end
|
15
|
+
|
16
|
+
# todo/check: use HUBBA_LOGIN - why? why not?
|
17
|
+
def user() @user || ENV[ 'HUBBA_USER' ]; end
|
18
|
+
def password() @password || ENV[ 'HUBBA_PASSWORD' ]; end
|
19
|
+
def user=( value ) @user = value; end
|
20
|
+
def password=( value ) @password = value; end
|
21
|
+
|
22
|
+
end # class Configuration
|
23
|
+
|
24
|
+
|
25
|
+
## lets you use
|
26
|
+
## Hubba.configure do |config|
|
27
|
+
## config.token = 'secret'
|
28
|
+
## -or-
|
29
|
+
## config.user = 'testdada'
|
30
|
+
## config.password = 'secret'
|
31
|
+
## end
|
32
|
+
##
|
33
|
+
## move configure block to GitHub class - why? why not?
|
34
|
+
## e.g. GitHub.configure do |config|
|
35
|
+
## ...
|
36
|
+
## end
|
37
|
+
|
38
|
+
|
39
|
+
def self.configuration
|
40
|
+
@configuration ||= Configuration.new
|
41
|
+
end
|
42
|
+
class << self
|
43
|
+
alias_method :config, :configuration
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def self.configure
|
48
|
+
yield( configuration )
|
49
|
+
end
|
50
|
+
|
51
|
+
end # module Hubba
|