gh_contrib 0.0.1 → 0.0.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 +4 -4
- data/README.md +52 -0
- data/lib/gh_contrib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e43359d39a497a4385b83845292c774fa452251
|
4
|
+
data.tar.gz: 02a26ec7cde1cc43ff37e1dbe3d3b48880bd6240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8318e9e1d09022e7ca43b178b2237c4d61297cfedaa6ddcf7cef444214ce1ef781dc4d73452284cc0e99df1d2c540f033713c60ba48c4c40ff9dafe23acb8c
|
7
|
+
data.tar.gz: b784b1291b73fa8f1067bc5c2055bcdcc922443bb445b84bf7891560438a00bec702934962838e40cff9e6a715ca09132744e66e3f4150997fa33d41e2a9d19c
|
data/README.md
CHANGED
@@ -1 +1,53 @@
|
|
1
1
|
# gh_contrib
|
2
|
+
|
3
|
+
GitHub has a nice feature of [contributions](https://help.github.com/articles/viewing-contributions-on-your-profile-page/).
|
4
|
+
But unfortunately they don't offer an official API.
|
5
|
+
Now somehow we can get only from here (`https://github.com/users/<username>/contributions`). It returns HTML :cry:.
|
6
|
+
This is just parsing HTML to JSON or returns as Ruby's object.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
### CLI
|
11
|
+
|
12
|
+
```zsh
|
13
|
+
$ gem install gh_contrib
|
14
|
+
|
15
|
+
$ gh_contrib username
|
16
|
+
|
17
|
+
$ echo 'GITHUB_USERNAME=username
|
18
|
+
$ GITHUB_PASSWORD=password' > .env
|
19
|
+
|
20
|
+
# or you can define on shell
|
21
|
+
# export GITHUB_USERNAME=username
|
22
|
+
# export GITHUB_PASSWORD=password
|
23
|
+
|
24
|
+
$ gh_contrib username
|
25
|
+
$ gh_contrib username -d month
|
26
|
+
```
|
27
|
+
|
28
|
+
### API
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'gh_contrib'
|
32
|
+
|
33
|
+
agent = GhContrib::Agent.new
|
34
|
+
puts agent.contributions 'username'
|
35
|
+
|
36
|
+
agent.login 'username', 'password'
|
37
|
+
|
38
|
+
puts agent.contributions 'username'
|
39
|
+
puts agent.contributions_by_month 'username'
|
40
|
+
```
|
41
|
+
|
42
|
+
## Tips
|
43
|
+
|
44
|
+
* Sum all the contributions with [jq](http://stedolan.github.io/jq/).
|
45
|
+
|
46
|
+
```zsh
|
47
|
+
$ gh_contrib banyan | jq 'reduce .[].count as $item (0; . + $item)'
|
48
|
+
4698
|
49
|
+
```
|
50
|
+
|
51
|
+
## Limitations
|
52
|
+
|
53
|
+
* You can't enable two factor authentication for this user if you want to get the data as logged in :cry:.
|
data/lib/gh_contrib/version.rb
CHANGED