committer-tools 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/committer-tools.gemspec +1 -1
- data/lib/committer-tools.rb +22 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b286ee5c5cd76c799824efcd9572409d0ff2469
|
4
|
+
data.tar.gz: a535dd5f5c529bfecb356b5ae7cb291b51372a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a2708b43a85a7fea21416f315a2bb4ca37a620f0b83cdc31ef81880d99fca98d5095f1c7d7238973a26965e824fea509ab4468132a8f803e4cce27c7980eb6
|
7
|
+
data.tar.gz: 39e4c9464b32a39731bfb6556a48d3297bc90a0f1fd7053aafeeaa47cd99a063217475bbaf0afca816b86c38b06aa30d79f44cbec359d8568656dc8018226304
|
data/README.md
CHANGED
@@ -12,6 +12,15 @@ gem install committer-tools
|
|
12
12
|
|
13
13
|
### Usage
|
14
14
|
|
15
|
+
In order to use `committer-tools`, you need to create a `.ctconfig` file
|
16
|
+
in your home directory, with the following contents:
|
17
|
+
|
18
|
+
```json
|
19
|
+
{
|
20
|
+
"token": "A GitHub token with user:email scope"
|
21
|
+
}
|
22
|
+
```
|
23
|
+
|
15
24
|
##### `committer-tools land`
|
16
25
|
|
17
26
|
- What this automates:
|
data/committer-tools.gemspec
CHANGED
data/lib/committer-tools.rb
CHANGED
@@ -3,12 +3,18 @@ require 'rest-client'
|
|
3
3
|
|
4
4
|
class HTTPHelper
|
5
5
|
def self.get(url)
|
6
|
-
RestClient.get(url, { params: { access_token:
|
6
|
+
RestClient.get(url, { params: { access_token: @@token } }).body
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.get_json(url)
|
10
10
|
JSON.parse(get(url))
|
11
11
|
end
|
12
|
+
|
13
|
+
def self.with_auth(token, &block)
|
14
|
+
@@token = token
|
15
|
+
yield block
|
16
|
+
@@token = nil
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
class Lander
|
@@ -131,13 +137,26 @@ class MetadataCollector
|
|
131
137
|
end
|
132
138
|
|
133
139
|
class Preparer
|
140
|
+
AUTH_FILE = '.ctconfig'
|
141
|
+
|
134
142
|
def run
|
135
|
-
|
136
|
-
|
143
|
+
HTTPHelper.with_auth(get_auth) do
|
144
|
+
pr = get_pr()
|
145
|
+
get_github_pr(pr)
|
146
|
+
end
|
137
147
|
end
|
138
148
|
|
139
149
|
private
|
140
150
|
|
151
|
+
def get_auth
|
152
|
+
begin
|
153
|
+
auth = File.read("#{ENV['HOME']}/#{AUTH_FILE}")
|
154
|
+
JSON.parse(auth)['token']
|
155
|
+
rescue
|
156
|
+
raise "Unable to load authentication information"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
141
160
|
def get_github_pr(pr)
|
142
161
|
HTTPHelper.get_json(
|
143
162
|
"https://api.github.com/repos/#{pr[:org]}/#{pr[:repo]}/pulls/#{pr[:id]}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: committer-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|