getv 2.1.4 → 2.2.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: 734da6050b2676ecb72bdfe549cd08219e2a812826105cf789f9df636aa8f1d2
4
- data.tar.gz: '03095314106f28cb6d9e01ecbb18299702cf344a0618bd4dd43957b0e2be1b80'
3
+ metadata.gz: a61689e83e79890fe34ef8a54fb004fce2ba6afc46f461f15345b0aa5a521e02
4
+ data.tar.gz: 5b85ec535bf555d416fe406b6438f8455c672d87ba76a3a39dfa8bffd113a8b7
5
5
  SHA512:
6
- metadata.gz: da39d5e3e8dfda3d6986b03bdff68bf1fecd45ab27ce744e575dca4bde0ebad0c1ee66fe5c69e03b6b65a2c8b0e9e6019cbe64e3e8445c31f193424f46eeda32
7
- data.tar.gz: 58b26acd07fd0f663d136f2b8162809dfa64d797cee60f94b336b9b9a2e2afc450f3da980deaa94d951b8bf317040bc99a6a4bf0cf60e9a03e6546cbad9a0661
6
+ metadata.gz: f5a88e66bc7a8d8a3c9ab49fed1ac6b19c1477bf3b50a18beeb7a4ccbcab7cecffe43b07ab761f62d661d6c411e6060718979bbb1525e7c6d3fb1f5117cecb7b
7
+ data.tar.gz: 31859e428d224cf9e1cb5741873cbaed2f46653dbc247d582df106fa06284ab3c20f7c97c0ceff9f52e63dba0f960cbf41cd453f3c7ed68fa39314a5aa83f70e
@@ -21,7 +21,7 @@ module Getv
21
21
  { owner: name.split('/')[0], repo: name.split('/')[1],
22
22
  url: 'https://registry.hub.docker.com' }
23
23
  else
24
- { owner: name.split('/')[1], repo: name.split('/')[2..-1].join('/'),
24
+ { owner: name.split('/')[1], repo: name.split('/')[2..].join('/'),
25
25
  url: "https://#{name.split('/')[0]}" }
26
26
  end
27
27
  end
data/lib/getv/package.rb CHANGED
@@ -42,12 +42,13 @@ module Getv
42
42
  @opts = opts
43
43
  end
44
44
 
45
- def defaults
45
+ def defaults # rubocop:disable Metrics/MethodLength
46
46
  {
47
47
  select_search: '^\s*v?(.*)\s*$',
48
48
  select_replace: '\1',
49
49
  reject: nil,
50
50
  semantic_only: true,
51
+ semantic_prefix: nil,
51
52
  semantic_select: ['*'],
52
53
  proxy: nil,
53
54
  versions: nil,
@@ -72,14 +73,22 @@ module Getv
72
73
  versions.select! { |v| v =~ select_pattern }
73
74
  versions.map! { |v| v.sub(select_pattern, opts[:select_replace]) }
74
75
  versions.reject! { |v| v =~ Regexp.new(opts[:reject]) } unless opts[:reject].nil?
76
+
75
77
  if opts[:semantic_only]
76
78
  require 'semantic'
77
79
  require 'semantic/core_ext'
78
- versions.select!(&:is_version?)
80
+
81
+ # remove non semantic version tags
82
+ versions.select! do |v|
83
+ v.sub(/^#{opts[:semantic_prefix]}/, '').is_version? && v.start_with?(opts[:semantic_prefix].to_s)
84
+ end
85
+
79
86
  opts[:semantic_select].each do |comparator|
80
- versions.select! { |v| Semantic::Version.new(v).satisfies?(comparator) }
87
+ versions.select! do |v|
88
+ Semantic::Version.new(v.sub(/^#{opts[:semantic_prefix]}/, '')).satisfies?(comparator)
89
+ end
81
90
  end
82
- versions.sort_by! { |v| Semantic::Version.new(v) }
91
+ versions.sort_by! { |v| Semantic::Version.new(v.sub(/^#{opts[:semantic_prefix]}/, '')) }
83
92
  else
84
93
  versions.sort! unless instance_of?(Getv::Package::GitHub::Commit)
85
94
  end
data/lib/getv/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Getv
4
- VERSION = '2.1.4'
4
+ VERSION = '2.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getv
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - harbottle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-06 00:00:00.000000000 Z
11
+ date: 2022-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli