getv 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/getv +5 -4
- data/lib/getv/package.rb +18 -6
- data/lib/getv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a04bab50075d670df75705579e743dcfa11f8348333ff05071294355303860
|
4
|
+
data.tar.gz: e55cc07d8d7167176f3557a1eecf8f99f9c6f6908922fbf4901d97dd10951d70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b93e911ecd136a22555e97fcd0c62986a862adc4809b37a5c1cd1d047a8bdfd1f663fb7159548b2d4bb3f9558fcd9643831e4b91791b696a90313aa81af8388
|
7
|
+
data.tar.gz: 0a3a86b63ff5250f3b07bd419d5ecbafca05fe0f63384e12178675411d9ab0fb25f4c56a614d39cb34058d967b09b4b6414ef277a05e565930cc36e7f0bc440a
|
data/exe/getv
CHANGED
@@ -38,7 +38,7 @@ class App # rubocop:disable Metrics/ClassLength
|
|
38
38
|
|
39
39
|
desc 'Get package versions from a Docker or OCI container image registry'
|
40
40
|
arg_name 'package_name'
|
41
|
-
command :docker do |c|
|
41
|
+
command :docker do |c| # rubocop:disable Metrics/BlockLength
|
42
42
|
defaults = (Getv::Package.new 'name', type: c.name.to_s).opts
|
43
43
|
c.flag %i[select_search], desc: 'Regex version selection search', default_value: defaults[:select_search]
|
44
44
|
c.flag %i[select_replace], desc: 'Regex version selection replace', default_value: defaults[:select_replace]
|
@@ -47,10 +47,11 @@ class App # rubocop:disable Metrics/ClassLength
|
|
47
47
|
c.flag %i[semantic_select], desc: 'Semantic version selection (comma delimited)',
|
48
48
|
default_value: defaults[:semantic_select]
|
49
49
|
c.flag %i[owner], desc: 'Repository owner',
|
50
|
-
default_value: "'<owner>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
50
|
+
default_value: "'<owner>' if package_name is in format '<registry>/<owner>/<repo>' or '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
51
51
|
c.flag %i[repo], desc: 'Repository name',
|
52
|
-
default_value: "'<repo>' if package_name is in format '<owner>/<repo>'
|
53
|
-
c.flag %i[url], desc: 'URL',
|
52
|
+
default_value: "'<repo>' if package_name is in format '<registry>/<owner>/<repo>' or <owner>/<repo>, otherwise just package_name" # rubocop:disable Layout/LineLength
|
53
|
+
c.flag %i[url], desc: 'URL',
|
54
|
+
default_value: "'https://<registry>' if package_name is in format '<registry>/<owner>/<repo>', otherwise #{defaults[:url]}" # rubocop:disable Layout/LineLength
|
54
55
|
c.flag %i[user], desc: 'Username', default_value: defaults[:user]
|
55
56
|
c.flag %i[password], desc: 'Password', default_value: defaults[:password]
|
56
57
|
c.action do |global_options, options, args|
|
data/lib/getv/package.rb
CHANGED
@@ -33,17 +33,29 @@ module Getv
|
|
33
33
|
versions: nil,
|
34
34
|
latest_version: nil
|
35
35
|
}.merge(opts)
|
36
|
-
if (opts[:type] == 'docker' || opts[:type] =~ /github.*/) && (name.count('/') == 1)
|
37
|
-
opts = { owner: name.split('/')[0], repo: name.split('/')[1] }.merge(opts)
|
38
|
-
end
|
39
36
|
case opts[:type]
|
40
37
|
when 'docker'
|
41
|
-
opts = {
|
42
|
-
|
38
|
+
opts = { user: nil, password: nil }.merge(opts)
|
39
|
+
opts = case name.count('/')
|
40
|
+
when 0
|
41
|
+
{ owner: 'library', repo: name, url: 'https://registry.hub.docker.com' }.merge(opts)
|
42
|
+
when 1
|
43
|
+
{ owner: name.split('/')[0], repo: name.split('/')[1],
|
44
|
+
url: 'https://registry.hub.docker.com' }.merge(opts)
|
45
|
+
else
|
46
|
+
{ owner: name.split('/')[1], repo: name.split('/')[2..-1].join('/'),
|
47
|
+
url: "https://#{name.split('/')[0]}" }.merge(opts)
|
48
|
+
end
|
43
49
|
when 'gem'
|
44
50
|
opts = { gem: name[/rubygem-(.*)/, 1] || name }.merge(opts)
|
45
51
|
when /github.*/
|
46
|
-
opts = {
|
52
|
+
opts = { token: nil }.merge(opts)
|
53
|
+
opts = case name.count('/')
|
54
|
+
when 1
|
55
|
+
{ owner: name.split('/')[0], repo: name.split('/')[1] }.merge(opts)
|
56
|
+
else
|
57
|
+
{ owner: name, repo: name }.merge(opts)
|
58
|
+
end
|
47
59
|
when 'index'
|
48
60
|
opts = { link: 'content' }.merge(opts)
|
49
61
|
when 'npm'
|
data/lib/getv/version.rb
CHANGED