organization_gem_dependencies 0.1.0 → 0.2.0
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 +98 -0
- data/lib/organization_gem_dependencies.rb +1 -0
- data/lib/organization_gem_dependencies/cli.rb +13 -7
- data/lib/organization_gem_dependencies/version.rb +1 -1
- 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: 4417535dea7895998e8e89f8c4c1bce3c00a98ad
|
4
|
+
data.tar.gz: d0acb5e478eef3f405cb2e155eb3240534f54b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712b8fb611a5a7beb8f96fe6916953eb5a0c8027188497e4a0836b0e008671b9f626135b01af2e76f8461b19759beaab133bb2f42b6ddbc4cc9278a927c5b390
|
7
|
+
data.tar.gz: 64c6a76d8c24f9e2c9134c65ef2278e3ca257d58407c36dd8c4a42ae0053b48416ee85cc331180fb3cef1848e5688d541587113ae83f0db4bb1106f2c384e8fe
|
data/README.md
CHANGED
@@ -1 +1,99 @@
|
|
1
1
|
# organization_gem_dependencies
|
2
|
+
|
3
|
+
This gem installs a command line utility `organization_gem_dependencies`, that
|
4
|
+
outputs a json file with a reverse dependency tree.
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```sh
|
10
|
+
gem install organization_gem_dependencies
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```sh
|
16
|
+
organization_gem_dependencies [--direct] GITHUB_ORGANIZATION
|
17
|
+
```
|
18
|
+
|
19
|
+
For example, running `organization_gem_dependencies -d rails` produces output
|
20
|
+
like the following:
|
21
|
+
|
22
|
+
```json
|
23
|
+
{
|
24
|
+
...,
|
25
|
+
"rails": {
|
26
|
+
"4.0.0.beta": [
|
27
|
+
"routing_concerns/Gemfile.lock"
|
28
|
+
],
|
29
|
+
"4.2.10": [
|
30
|
+
"rails-docs-server/test/fixtures/releases/v4.2.10/Gemfile.lock"
|
31
|
+
],
|
32
|
+
"5.1.1": [
|
33
|
+
"actioncable-examples/Gemfile.lock"
|
34
|
+
],
|
35
|
+
"5.2.0": [
|
36
|
+
"rails-contributors/Gemfile.lock",
|
37
|
+
"webpacker/Gemfile.lock"
|
38
|
+
],
|
39
|
+
"6.0.0.alpha": [
|
40
|
+
"rails/Gemfile.lock"
|
41
|
+
]
|
42
|
+
},
|
43
|
+
"rails-controller-testing": {
|
44
|
+
"1.0.2": [
|
45
|
+
"rails-contributors/Gemfile.lock"
|
46
|
+
]
|
47
|
+
},
|
48
|
+
"rails-dom-testing": {
|
49
|
+
"2.0.2": [
|
50
|
+
"rails-dom-testing/Gemfile.lock"
|
51
|
+
]
|
52
|
+
},
|
53
|
+
"rails-perftest": {
|
54
|
+
"0.0.7": [
|
55
|
+
"rails-perftest/Gemfile.lock"
|
56
|
+
]
|
57
|
+
},
|
58
|
+
"railties": {
|
59
|
+
"4.2.1": [
|
60
|
+
"rails-perftest/Gemfile.lock"
|
61
|
+
],
|
62
|
+
"5.1.4": [
|
63
|
+
"globalid/Gemfile.lock"
|
64
|
+
]
|
65
|
+
},
|
66
|
+
"rake": {
|
67
|
+
"0.9.2.2": [
|
68
|
+
"commands/Gemfile.lock",
|
69
|
+
"etagger/Gemfile.lock",
|
70
|
+
"routing_concerns/Gemfile.lock"
|
71
|
+
],
|
72
|
+
"10.0.3": [
|
73
|
+
"strong_parameters/Gemfile.lock"
|
74
|
+
],
|
75
|
+
"10.0.4": [
|
76
|
+
"cache_digests/Gemfile.lock"
|
77
|
+
],
|
78
|
+
"10.3.2": [
|
79
|
+
"activemodel-globalid/Gemfile.lock"
|
80
|
+
],
|
81
|
+
"10.4.2": [
|
82
|
+
"jquery-ujs/Gemfile.lock",
|
83
|
+
"record_tag_helper/Gemfile.lock"
|
84
|
+
],
|
85
|
+
"12.0.0": [
|
86
|
+
"rails-docs-server/test/fixtures/releases/v4.2.10/Gemfile.lock",
|
87
|
+
"rails-dom-testing/Gemfile.lock"
|
88
|
+
],
|
89
|
+
"12.1.0": [
|
90
|
+
"globalid/Gemfile.lock"
|
91
|
+
],
|
92
|
+
"12.3.1": [
|
93
|
+
"rails/Gemfile.lock",
|
94
|
+
"webpacker/Gemfile.lock"
|
95
|
+
]
|
96
|
+
},
|
97
|
+
...
|
98
|
+
}
|
99
|
+
```
|
@@ -10,17 +10,25 @@ require 'octokit'
|
|
10
10
|
module OrganizationGemDependencies
|
11
11
|
# Define the command line interface.
|
12
12
|
class Cli
|
13
|
-
SEARCH_TERM = 'org
|
13
|
+
SEARCH_TERM = 'org:%s filename:Gemfile.lock'
|
14
|
+
USAGE = <<~USAGE
|
15
|
+
Usage: organization_gem_dependencies [options] GITHUB_ORGANIZATION
|
16
|
+
USAGE
|
14
17
|
|
15
18
|
def run
|
16
19
|
parse_options
|
20
|
+
if ARGV.size != 1
|
21
|
+
STDERR.puts USAGE
|
22
|
+
return 1
|
23
|
+
end
|
24
|
+
github_organization = ARGV[0]
|
17
25
|
|
18
26
|
access_token = ENV['GITHUB_ACCESS_TOKEN'] || \
|
19
27
|
STDIN.getpass('GitHub Personal Access Token: ')
|
20
28
|
github = Octokit::Client.new(access_token: access_token)
|
21
29
|
|
22
30
|
gems = {}
|
23
|
-
gemfiles(github) do |gemfile|
|
31
|
+
gemfiles(github, github_organization) do |gemfile|
|
24
32
|
STDERR.puts "Processing #{gemfile.repository.name}/#{gemfile.path}"
|
25
33
|
content = nil
|
26
34
|
sleep_time = 0
|
@@ -45,8 +53,8 @@ module OrganizationGemDependencies
|
|
45
53
|
|
46
54
|
private
|
47
55
|
|
48
|
-
def gemfiles(github)
|
49
|
-
github.search_code(SEARCH_TERM, per_page: 1000)
|
56
|
+
def gemfiles(github, organization)
|
57
|
+
github.search_code(SEARCH_TERM % organization, per_page: 1000)
|
50
58
|
last_response = github.last_response
|
51
59
|
|
52
60
|
matches = last_response.data.items
|
@@ -91,9 +99,7 @@ module OrganizationGemDependencies
|
|
91
99
|
def parse_options
|
92
100
|
@options = { direct: false }
|
93
101
|
OptionParser.new do |config|
|
94
|
-
config.banner =
|
95
|
-
Usage: organization_gem_dependencies [options]
|
96
|
-
USAGE
|
102
|
+
config.banner = USAGE
|
97
103
|
config.on('-d', '--direct',
|
98
104
|
'Consider only direct dependencies.') do |direct|
|
99
105
|
@options[:direct] = direct
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organization_gem_dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Boe
|
@@ -92,5 +92,5 @@ rubyforge_project:
|
|
92
92
|
rubygems_version: 2.6.14
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
|
-
summary: Discover all ruby gem
|
95
|
+
summary: Discover all ruby gem dependencies for a github organization.
|
96
96
|
test_files: []
|