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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '089dcf7c1b77a594ef0d7362f8d64f9f1df0ac6a8642947c3448299bc21e6680'
4
- data.tar.gz: f890fce6a6fe69416ddfee40cda03a1cf28ee4c70c88c04352712f8d9d373422
3
+ metadata.gz: 98a04bab50075d670df75705579e743dcfa11f8348333ff05071294355303860
4
+ data.tar.gz: e55cc07d8d7167176f3557a1eecf8f99f9c6f6908922fbf4901d97dd10951d70
5
5
  SHA512:
6
- metadata.gz: 4d282b8cf6471125466a80e024e47b4346d2a2be3dc80a7c0ff7e31e60fc25f0efbfc32d2068ed58dabb2f3da862ede4519217b83f2603eb78bedd7367bb4f51
7
- data.tar.gz: 1dc7d16a64011dca99f288001ff787c99efe82ee4b096955fd5f44913b6a5c669817bceab5e001acf94bacdaea19db356f36ec9536232a19dd2d053c9ca3134f
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>', otherwise just package_name" # rubocop:disable Layout/LineLength
53
- c.flag %i[url], desc: 'URL', default_value: defaults[: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 = { owner: 'library', repo: name, url: 'https://registry.hub.docker.com', user: nil,
42
- password: nil }.merge(opts)
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 = { owner: name, repo: name, token: nil }.merge(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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Getv
4
- VERSION = '1.5.1'
4
+ VERSION = '1.6.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - harbottle