gh_contrib 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -0
  3. data/lib/gh_contrib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae090cc95a0b2f79c232e8f54e419dfa3ae0ae73
4
- data.tar.gz: 35919919f0b58ab5b5a411fc1edc354779d360bf
3
+ metadata.gz: 0e43359d39a497a4385b83845292c774fa452251
4
+ data.tar.gz: 02a26ec7cde1cc43ff37e1dbe3d3b48880bd6240
5
5
  SHA512:
6
- metadata.gz: 7ebe8e4812c3f681c8ed5ec3dcba6bf052e9001c2a8f7d5fb4aea1821944ea4ba59da86a60d221627d9eee8c7089eb54448c1affeaa8bf3aad3bdfce3424f223
7
- data.tar.gz: a5b0f293c6357a9377285baf886b79122fc6752cdc47f7ff98f59507b4bea6aba75435619f68871bc3cc79d2c1fe726362afaaf4fb9561cdeb01670a44fb0d91
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:.
@@ -1,3 +1,3 @@
1
1
  module GhContrib
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh_contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Hasegawa