puppet-community-rangefinder 0.0.4 → 0.0.5
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/CHANGELOG.md +6 -0
- data/README.md +21 -22
- data/bin/rangefinder +13 -2
- data/lib/rangefinder.rb +1 -1
- data/lib/rangefinder/bigquery.rb +7 -8
- data/lib/rangefinder/version.rb +1 -1
- metadata +3 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5fb940183c9ea99d93b015d05a74475499e9053a720d4e376712b39523fc76e
|
4
|
+
data.tar.gz: 9d609345c22b46ef5018ea80d9bf02e70ff2ce774c2e20d00eca5b62183614b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4c71d46436dd4d7b5032a0da5c2948f687e8c783eb2d701c7aba6a7abdd6dd7e2ce02e7656989bc267fef0c780c73f31c54ae4b379217f6f4acfe7ef2fba52
|
7
|
+
data.tar.gz: cfd912d3b589d22c2533aac92c6f32b410ed2eef460b43f8a8fe802834fba8cde6a4888cdb5386a3de3e7df82c9bdd6bc736ff8c5c73ec70c3c699ca6fcd93ac
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -31,28 +31,6 @@ This currently knows how to interpret and look up:
|
|
31
31
|
|
32
32
|
This is distributed as a Ruby gem. Simply `gem install puppet-community-rangefinder`
|
33
33
|
|
34
|
-
******************************************************************************
|
35
|
-
* Note that this is only useful by members of the Puppet Ecosystem team *
|
36
|
-
* because it uses BigQuery data that's not available publicly. *
|
37
|
-
******************************************************************************
|
38
|
-
|
39
|
-
|
40
|
-
## Configuration
|
41
|
-
|
42
|
-
You must configure BigQuery credentials in the `~/.rangefinder.conf` file.
|
43
|
-
|
44
|
-
Example configuration:
|
45
|
-
|
46
|
-
```
|
47
|
-
---
|
48
|
-
:gcloud:
|
49
|
-
:dataset: <dataset>
|
50
|
-
:project: <project>
|
51
|
-
:keyfile: ~/.rangefinder/credentials.json
|
52
|
-
```
|
53
|
-
|
54
|
-
Contact [me](mailto:ben.ford@puppet.com) for credentials.
|
55
|
-
|
56
34
|
|
57
35
|
## Running
|
58
36
|
|
@@ -397,14 +375,35 @@ Breaking changes to this file MAY impact these modules:
|
|
397
375
|
```
|
398
376
|
|
399
377
|
|
378
|
+
## Configuration
|
379
|
+
|
380
|
+
Rangefinder will use the public dataset by default. If you're developing on the
|
381
|
+
data pipeline, you may configure BigQuery credentials in the `~/.rangefinder.conf`
|
382
|
+
file to point at private datasets instead.
|
383
|
+
|
384
|
+
Example configuration:
|
385
|
+
|
386
|
+
```
|
387
|
+
---
|
388
|
+
:gcloud:
|
389
|
+
:dataset: <dataset>
|
390
|
+
:project: <project>
|
391
|
+
:keyfile: ~/.rangefinder/credentials.json
|
392
|
+
```
|
393
|
+
|
394
|
+
Contact [me](mailto:ben.ford@puppet.com) for credentials.
|
395
|
+
|
396
|
+
|
400
397
|
## Limitations
|
401
398
|
|
402
399
|
This is super early in development and has not yet been battle tested.
|
403
400
|
|
401
|
+
|
404
402
|
## Disclaimer
|
405
403
|
|
406
404
|
I take no liability for the use of this tool.
|
407
405
|
|
406
|
+
|
408
407
|
Contact
|
409
408
|
-------
|
410
409
|
|
data/bin/rangefinder
CHANGED
@@ -6,7 +6,17 @@ require 'optparse'
|
|
6
6
|
require 'rangefinder'
|
7
7
|
|
8
8
|
loglevel = Logger::WARN
|
9
|
-
options
|
9
|
+
options = {
|
10
|
+
:gcloud => {
|
11
|
+
:noinit => true,
|
12
|
+
:dataset => 'community',
|
13
|
+
:project => 'dataops-puppet-public-data',
|
14
|
+
:keyfile => File.join(File.dirname(__FILE__), '..', 'assets', 'read-only-credentials.json')
|
15
|
+
}
|
16
|
+
}
|
17
|
+
overrides = YAML.load_file(File.expand_path('~/.rangefinder.conf')) rescue {}
|
18
|
+
options.merge!(overrides)
|
19
|
+
|
10
20
|
OptionParser.new do |opts|
|
11
21
|
opts.banner = "Usage: rangefinder <paths>
|
12
22
|
|
@@ -46,8 +56,9 @@ Note that non-namespaced items will always be near match only.
|
|
46
56
|
end
|
47
57
|
|
48
58
|
end.parse!
|
59
|
+
options[:gcloud][:keyfile] = File.expand_path(options[:gcloud][:keyfile])
|
49
60
|
options[:filenames] = ARGV.map {|f| File.expand_path f} unless ARGV.empty?
|
50
|
-
options[:filenames] ||= ['manifests
|
61
|
+
options[:filenames] ||= ['manifests']
|
51
62
|
options[:render] ||= :human
|
52
63
|
|
53
64
|
$logger = Logger.new($stderr)
|
data/lib/rangefinder.rb
CHANGED
@@ -12,7 +12,7 @@ class Rangefinder
|
|
12
12
|
@bigquery = Rangefinder::Bigquery.new(options)
|
13
13
|
|
14
14
|
if options[:filenames].size == 1 and File.directory?(options[:filenames].first)
|
15
|
-
options[:filenames] = Dir.glob("#{options[:filenames].first}
|
15
|
+
options[:filenames] = Dir.glob("#{options[:filenames].first}/**/*")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/rangefinder/bigquery.rb
CHANGED
@@ -7,7 +7,6 @@ class Rangefinder::Bigquery
|
|
7
7
|
|
8
8
|
raise "Required gCloud configuration missing" unless gcloud
|
9
9
|
|
10
|
-
gcloud[:keyfile] = File.expand_path(gcloud[:keyfile])
|
11
10
|
@bigquery = Google::Cloud::Bigquery.new(
|
12
11
|
:project_id => gcloud[:project],
|
13
12
|
:credentials => Google::Cloud::Bigquery::Credentials.new(gcloud[:keyfile]),
|
@@ -18,8 +17,8 @@ class Rangefinder::Bigquery
|
|
18
17
|
|
19
18
|
def find(namespace, kind, name)
|
20
19
|
sql = "SELECT DISTINCT module, i.source, m.source AS repo
|
21
|
-
FROM
|
22
|
-
JOIN
|
20
|
+
FROM `#{@dataset.project_id}.#{@dataset.dataset_id}.forge_itemized` AS i
|
21
|
+
JOIN `#{@dataset.project_id}.#{@dataset.dataset_id}.forge_modules` AS m
|
23
22
|
ON m.slug = i.module
|
24
23
|
WHERE kind = @kind AND element = @name"
|
25
24
|
|
@@ -45,14 +44,14 @@ class Rangefinder::Bigquery
|
|
45
44
|
|
46
45
|
def puppetfile_count(modname=nil)
|
47
46
|
if modname
|
48
|
-
sql =
|
49
|
-
FROM
|
50
|
-
WHERE module = @name
|
47
|
+
sql = "SELECT COUNT(DISTINCT repo_name) AS count
|
48
|
+
FROM `#{@dataset.project_id}.#{@dataset.dataset_id}.github_puppetfile_usage`
|
49
|
+
WHERE module = @name"
|
51
50
|
|
52
51
|
data = @dataset.query(sql, params: {name: modname})
|
53
52
|
else
|
54
|
-
sql =
|
55
|
-
FROM
|
53
|
+
sql = "SELECT COUNT(DISTINCT repo_name) AS count
|
54
|
+
FROM `#{@dataset.project_id}.#{@dataset.dataset_id}.github_puppetfile_usage`"
|
56
55
|
|
57
56
|
data = @dataset.query(sql)
|
58
57
|
end
|
data/lib/rangefinder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-community-rangefinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Ford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet
|
@@ -48,11 +48,6 @@ description: |2
|
|
48
48
|
Run this command with a space separated list of file paths in a module and it
|
49
49
|
will infer what each file defines and then tell you what Forge modules use it.
|
50
50
|
|
51
|
-
******************************************************************************
|
52
|
-
* Note that this is only useful by members of the Puppet Ecosystem team *
|
53
|
-
* because it uses BigQuery data that's not available publicly. *
|
54
|
-
******************************************************************************
|
55
|
-
|
56
51
|
Run `rangefinder --help` to get started.
|
57
52
|
email: ben.ford@puppet.com
|
58
53
|
executables:
|
@@ -89,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
84
|
- !ruby/object:Gem::Version
|
90
85
|
version: '0'
|
91
86
|
requirements: []
|
92
|
-
rubygems_version: 3.0.
|
87
|
+
rubygems_version: 3.0.3
|
93
88
|
signing_key:
|
94
89
|
specification_version: 4
|
95
90
|
summary: Predicts downstream impact of breaking file changes.
|