codeinventory-github 0.1.3 → 0.1.4
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 +10 -5
- data/lib/codeinventory/github.rb +4 -4
- 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: aa475a83abe7e0ed44fad39563325a277320f750
|
4
|
+
data.tar.gz: 6387ea4038456551087003decfb0019bcf85b958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c672c99f8c9f63856029014dfcb7f7328813fb1599ae8c11dd8d4967f3aaa89aa2c2ad556fdab87c3303fbf1693cf7d42448edae075aa0ec6e7ae73ddc863caf
|
7
|
+
data.tar.gz: 6c872903b1d5efdebe851c6a0f3cc8fb773b30a36c0552371b95ffdad87fa239dce7f664dbd52a2c5c8f0ca70b3c168fe776088492db040ac8215438ff4b36ab
|
data/README.md
CHANGED
@@ -46,15 +46,20 @@ Basically:
|
|
46
46
|
require "codeinventory"
|
47
47
|
require "codeinventory/github"
|
48
48
|
|
49
|
-
|
49
|
+
auth = { access_token: "GITHUB_ACCESS_TOKEN" }
|
50
|
+
github_source = CodeInventory::GitHub.new(auth, "GITHUB_ORG_NAME")
|
50
51
|
|
51
52
|
inventory = CodeInventory::Inventory.new(github_source)
|
52
53
|
inventory.projects # Returns an array of projects in the GitHub org
|
53
54
|
```
|
54
55
|
|
55
|
-
|
56
|
+
The `codeinventory-github` plugin will then automatically harvest the given organization's repository metadata from GitHub metadata.
|
56
57
|
|
57
|
-
|
58
|
+
### Authentication
|
59
|
+
|
60
|
+
This gem uses the [Octokit](https://github.com/octokit/octokit.rb) GitHub client to interface with the GitHub API.
|
61
|
+
|
62
|
+
For the `auth` parameter when instantiating `CodeInventory::GitHub`, provide any type of [authentication information that Octokit supports](https://github.com/octokit/octokit.rb#authentication). Examples: a basic login/password, [OAuth access token](https://developer.github.com/v3/oauth/), or application authentication.
|
58
63
|
|
59
64
|
### Using inventory files
|
60
65
|
|
@@ -107,7 +112,7 @@ overrides = {
|
|
107
112
|
email: "me@example.com"
|
108
113
|
}
|
109
114
|
}
|
110
|
-
github_source = CodeInventory::GitHub.new(access_token: "GITHUB_ACCESS_TOKEN",
|
115
|
+
github_source = CodeInventory::GitHub.new({ access_token: "GITHUB_ACCESS_TOKEN" }, "GITHUB_ORG_NAME", overrides: overrides)
|
111
116
|
```
|
112
117
|
|
113
118
|
In this example, `codeinventory-github` will set the tags on all your projects to `my-tag-1` and `my-tag-2` also use the contact email you specified on all projects.
|
@@ -118,7 +123,7 @@ You can exclude any repository from scanning.
|
|
118
123
|
|
119
124
|
```ruby
|
120
125
|
exclusions = ["not-a-real-product", "DontScanMe"]
|
121
|
-
github_source = CodeInventory::GitHub.new(access_token: "GITHUB_ACCESS_TOKEN",
|
126
|
+
github_source = CodeInventory::GitHub.new({ access_token: "GITHUB_ACCESS_TOKEN" }, "GITHUB_ORG_NAME", exclude: exclusions)
|
122
127
|
```
|
123
128
|
|
124
129
|
In this example, `codeinventory-github` will ignore the repositories named `not-a-real-product` or `DontScanMe`.
|
data/lib/codeinventory/github.rb
CHANGED
@@ -4,12 +4,12 @@ require "base64"
|
|
4
4
|
|
5
5
|
module CodeInventory
|
6
6
|
class GitHub
|
7
|
-
VERSION = "0.1.
|
7
|
+
VERSION = "0.1.4"
|
8
8
|
attr_accessor :org, :overrides, :exclude
|
9
9
|
|
10
|
-
def initialize(
|
10
|
+
def initialize(auth, org, overrides: {}, exclude: [])
|
11
11
|
Octokit.auto_paginate = true
|
12
|
-
@
|
12
|
+
@auth = auth
|
13
13
|
@org = org
|
14
14
|
@overrides = overrides
|
15
15
|
@exclude = exclude
|
@@ -164,7 +164,7 @@ module CodeInventory
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def client
|
167
|
-
@client ||= Octokit::Client.new(
|
167
|
+
@client ||= Octokit::Client.new(@auth)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeinventory-github
|
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
|
- Jeff Fredrickson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|