getv 1.3.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/exe/getv +100 -121
- data/lib/getv/package.rb +30 -27
- data/lib/getv/version.rb +1 -1
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '089dcf7c1b77a594ef0d7362f8d64f9f1df0ac6a8642947c3448299bc21e6680'
|
4
|
+
data.tar.gz: f890fce6a6fe69416ddfee40cda03a1cf28ee4c70c88c04352712f8d9d373422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d282b8cf6471125466a80e024e47b4346d2a2be3dc80a7c0ff7e31e60fc25f0efbfc32d2068ed58dabb2f3da862ede4519217b83f2603eb78bedd7367bb4f51
|
7
|
+
data.tar.gz: 1dc7d16a64011dca99f288001ff787c99efe82ee4b096955fd5f44913b6a5c669817bceab5e001acf94bacdaea19db356f36ec9536232a19dd2d053c9ca3134f
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ SYNOPSIS
|
|
39
39
|
|
40
40
|
|
41
41
|
VERSION
|
42
|
-
1.
|
42
|
+
1.5.0
|
43
43
|
|
44
44
|
|
45
45
|
|
@@ -55,9 +55,9 @@ COMMANDS
|
|
55
55
|
docker - Get package versions from a Docker or OCI container image registry
|
56
56
|
gem - Get package versions from RubyGems.org
|
57
57
|
get - Get package versions from text file URL
|
58
|
-
github_commit - Get package versions from GitHub commits
|
59
|
-
github_release - Get package versions from GitHub releases
|
60
|
-
github_tag - Get package versions from GitHub tags
|
58
|
+
github_commit - Get package versions from GitHub commits
|
59
|
+
github_release - Get package versions from GitHub releases
|
60
|
+
github_tag - Get package versions from GitHub tags
|
61
61
|
help - Shows a list of commands or help for one command
|
62
62
|
index - Get package versions from web page of links
|
63
63
|
npm - Get package versions from npm at registry.npmjs.org
|
@@ -70,7 +70,7 @@ Show the latest available version of the `getv` gem:
|
|
70
70
|
|
71
71
|
```console
|
72
72
|
$ getv --latest gem getv
|
73
|
-
1.
|
73
|
+
1.5.0
|
74
74
|
```
|
75
75
|
|
76
76
|
Show all `dep` GitHub release versions in JSON:
|
data/exe/getv
CHANGED
@@ -7,26 +7,16 @@ require 'gli'
|
|
7
7
|
module Getv
|
8
8
|
# cli class
|
9
9
|
class Cli
|
10
|
-
def self.output(package, latest: false, json: false)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
'name' => package.name,
|
16
|
-
'latest_version' => package.latest_version
|
17
|
-
}.to_json)
|
18
|
-
else
|
19
|
-
puts package.latest_version
|
20
|
-
end
|
21
|
-
elsif json
|
10
|
+
def self.output(package, latest: false, json: false)
|
11
|
+
key = latest ? 'latest_version' : 'versions'
|
12
|
+
result = package.send(key)
|
13
|
+
|
14
|
+
if json
|
22
15
|
require 'json'
|
23
|
-
|
24
|
-
'name' => package.name,
|
25
|
-
'versions' => package.versions
|
26
|
-
}.to_json)
|
27
|
-
else
|
28
|
-
puts package.versions
|
16
|
+
result = { 'name' => package.name, key => result }.to_json
|
29
17
|
end
|
18
|
+
|
19
|
+
puts result
|
30
20
|
end
|
31
21
|
end
|
32
22
|
end
|
@@ -44,10 +34,11 @@ class App # rubocop:disable Metrics/ClassLength
|
|
44
34
|
|
45
35
|
switch %i[l latest], desc: 'Latest version', negatable: false
|
46
36
|
switch %i[j json], desc: 'Output in json', negatable: false
|
37
|
+
flag %i[p proxy], desc: 'Web proxy', default_value: nil
|
47
38
|
|
48
39
|
desc 'Get package versions from a Docker or OCI container image registry'
|
49
40
|
arg_name 'package_name'
|
50
|
-
command :docker do |c|
|
41
|
+
command :docker do |c|
|
51
42
|
defaults = (Getv::Package.new 'name', type: c.name.to_s).opts
|
52
43
|
c.flag %i[select_search], desc: 'Regex version selection search', default_value: defaults[:select_search]
|
53
44
|
c.flag %i[select_replace], desc: 'Regex version selection replace', default_value: defaults[:select_replace]
|
@@ -60,19 +51,19 @@ class App # rubocop:disable Metrics/ClassLength
|
|
60
51
|
c.flag %i[repo], desc: 'Repository name',
|
61
52
|
default_value: "'<repo>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
62
53
|
c.flag %i[url], desc: 'URL', default_value: defaults[:url]
|
54
|
+
c.flag %i[user], desc: 'Username', default_value: defaults[:user]
|
55
|
+
c.flag %i[password], desc: 'Password', default_value: defaults[:password]
|
63
56
|
c.action do |global_options, options, args|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
help_now!
|
75
|
-
end
|
57
|
+
help_now! unless args.size == 1
|
58
|
+
|
59
|
+
opts = global_options.merge(options)
|
60
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :owner, :repo,
|
61
|
+
:url, :user, :password, :proxy
|
62
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
63
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
64
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
65
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
66
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
76
67
|
end
|
77
68
|
end
|
78
69
|
|
@@ -87,17 +78,15 @@ class App # rubocop:disable Metrics/ClassLength
|
|
87
78
|
c.flag %i[semantic_select], desc: 'Semantic version selection (comma delimited)',
|
88
79
|
default_value: defaults[:semantic_select]
|
89
80
|
c.action do |global_options, options, args|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
help_now!
|
100
|
-
end
|
81
|
+
help_now! unless args.size == 1
|
82
|
+
|
83
|
+
opts = global_options.merge(options)
|
84
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :proxy
|
85
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
86
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
87
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
88
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
89
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
101
90
|
end
|
102
91
|
end
|
103
92
|
|
@@ -113,21 +102,18 @@ class App # rubocop:disable Metrics/ClassLength
|
|
113
102
|
default_value: defaults[:semantic_select]
|
114
103
|
c.flag %i[url], desc: 'URL', default_value: defaults[:url]
|
115
104
|
c.action do |global_options, options, args|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
else
|
125
|
-
help_now!
|
126
|
-
end
|
105
|
+
help_now! unless args.size == 1
|
106
|
+
|
107
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :url, :proxy
|
108
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
109
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
110
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
111
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
112
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
127
113
|
end
|
128
114
|
end
|
129
115
|
|
130
|
-
desc 'Get package versions from GitHub commits
|
116
|
+
desc 'Get package versions from GitHub commits'
|
131
117
|
arg_name 'package_name'
|
132
118
|
command :github_commit do |c|
|
133
119
|
defaults = (Getv::Package.new 'name', type: c.name.to_s).opts
|
@@ -139,20 +125,19 @@ class App # rubocop:disable Metrics/ClassLength
|
|
139
125
|
c.flag %i[repo], desc: 'Repository name',
|
140
126
|
default_value: "'<repo>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
141
127
|
c.flag %i[branch], desc: 'Repository branch', default_value: defaults[:branch]
|
128
|
+
c.flag %i[token], desc: 'Token', default_value: defaults[:token]
|
142
129
|
c.action do |global_options, options, args|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
help_now!
|
151
|
-
end
|
130
|
+
help_now! unless args.size == 1
|
131
|
+
|
132
|
+
opts = global_options.merge(options)
|
133
|
+
opts = opts.slice :select_search, :select_replace, :reject, :owner, :repo, :branch, :token, :proxy
|
134
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
135
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
136
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
152
137
|
end
|
153
138
|
end
|
154
139
|
|
155
|
-
desc 'Get package versions from GitHub releases
|
140
|
+
desc 'Get package versions from GitHub releases'
|
156
141
|
arg_name 'package_name'
|
157
142
|
command :github_release do |c|
|
158
143
|
defaults = (Getv::Package.new 'name', type: c.name.to_s).opts
|
@@ -166,22 +151,22 @@ class App # rubocop:disable Metrics/ClassLength
|
|
166
151
|
default_value: "'<owner>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
167
152
|
c.flag %i[repo], desc: 'Repository name',
|
168
153
|
default_value: "'<repo>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
154
|
+
c.flag %i[token], desc: 'Token', default_value: defaults[:token]
|
169
155
|
c.action do |global_options, options, args|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
end
|
156
|
+
help_now! unless args.size == 1
|
157
|
+
|
158
|
+
opts = global_options.merge(options)
|
159
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :owner, :repo,
|
160
|
+
:token, :proxy
|
161
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
162
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
163
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
164
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
165
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
181
166
|
end
|
182
167
|
end
|
183
168
|
|
184
|
-
desc 'Get package versions from GitHub tags
|
169
|
+
desc 'Get package versions from GitHub tags'
|
185
170
|
arg_name 'package_name'
|
186
171
|
command :github_tag do |c|
|
187
172
|
defaults = (Getv::Package.new 'name', type: c.name.to_s).opts
|
@@ -195,18 +180,18 @@ class App # rubocop:disable Metrics/ClassLength
|
|
195
180
|
default_value: "'<owner>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
196
181
|
c.flag %i[repo], desc: 'Repository name',
|
197
182
|
default_value: "'<repo>' if package_name is in format '<owner>/<repo>', otherwise just package_name" # rubocop:disable Layout/LineLength
|
183
|
+
c.flag %i[token], desc: 'Token', default_value: defaults[:token]
|
198
184
|
c.action do |global_options, options, args|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
end
|
185
|
+
help_now! unless args.size == 1
|
186
|
+
|
187
|
+
opts = global_options.merge(options)
|
188
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :owner, :repo,
|
189
|
+
:token, :proxy
|
190
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
191
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
192
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
193
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
194
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
210
195
|
end
|
211
196
|
end
|
212
197
|
|
@@ -224,18 +209,16 @@ class App # rubocop:disable Metrics/ClassLength
|
|
224
209
|
c.switch %i[link_value], desc: 'Use the value (target) of links rather than the content (display text)',
|
225
210
|
negatable: false, default_value: false
|
226
211
|
c.action do |global_options, options, args|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
help_now!
|
238
|
-
end
|
212
|
+
help_now! unless args.size == 1
|
213
|
+
|
214
|
+
opts = global_options.merge(options)
|
215
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :url, :proxy
|
216
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
217
|
+
opts[:link] == 'value' if options[:link_value]
|
218
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
219
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
220
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
221
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
239
222
|
end
|
240
223
|
end
|
241
224
|
|
@@ -250,17 +233,15 @@ class App # rubocop:disable Metrics/ClassLength
|
|
250
233
|
c.flag %i[semantic_select], desc: 'Semantic version selection (comma delimited)',
|
251
234
|
default_value: defaults[:semantic_select]
|
252
235
|
c.action do |global_options, options, args|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
help_now!
|
263
|
-
end
|
236
|
+
help_now! unless args.size == 1
|
237
|
+
|
238
|
+
opts = global_options.merge(options)
|
239
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :proxy
|
240
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
241
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
242
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
243
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
244
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
264
245
|
end
|
265
246
|
end
|
266
247
|
|
@@ -275,17 +256,15 @@ class App # rubocop:disable Metrics/ClassLength
|
|
275
256
|
c.flag %i[semantic_select], desc: 'Semantic version selection (comma delimited)',
|
276
257
|
default_value: defaults[:semantic_select]
|
277
258
|
c.action do |global_options, options, args|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
help_now!
|
288
|
-
end
|
259
|
+
help_now! unless args.size == 1
|
260
|
+
|
261
|
+
opts = global_options.merge(options)
|
262
|
+
opts = opts.slice :select_search, :select_replace, :reject, :semantic_only, :semantic_select, :proxy
|
263
|
+
opts = opts.delete_if { |k, v| v.nil? || v == c.flags[k].default_value }
|
264
|
+
opts[:semantic_only] = !options[:invalid_versions]
|
265
|
+
opts[:semantic_select] = opts[:semantic_select].split(',') unless opts.fetch(:semantic_select, nil).nil?
|
266
|
+
package = Getv::Package.new args[0], { type: c.name.to_s }.merge(opts)
|
267
|
+
Getv::Cli.output(package, latest: global_options[:latest], json: global_options[:json])
|
289
268
|
end
|
290
269
|
end
|
291
270
|
|
data/lib/getv/package.rb
CHANGED
@@ -9,11 +9,11 @@ module Getv
|
|
9
9
|
@name = name
|
10
10
|
case name
|
11
11
|
when /rubygem-.*/
|
12
|
-
opts = {
|
12
|
+
opts = { type: 'gem' }.merge(opts)
|
13
13
|
when /nodejs-.*/
|
14
|
-
opts = {
|
14
|
+
opts = { type: 'npm' }.merge(opts)
|
15
15
|
when /python.*-.*/
|
16
|
-
opts = {
|
16
|
+
opts = { type: 'pypi' }.merge(opts)
|
17
17
|
end
|
18
18
|
if opts[:type] == 'github_commit'
|
19
19
|
opts = {
|
@@ -29,6 +29,7 @@ module Getv
|
|
29
29
|
reject: nil,
|
30
30
|
semantic_only: true,
|
31
31
|
semantic_select: ['*'],
|
32
|
+
proxy: nil,
|
32
33
|
versions: nil,
|
33
34
|
latest_version: nil
|
34
35
|
}.merge(opts)
|
@@ -37,17 +38,18 @@ module Getv
|
|
37
38
|
end
|
38
39
|
case opts[:type]
|
39
40
|
when 'docker'
|
40
|
-
opts = { owner: 'library', repo: name, url: 'https://registry.hub.docker.com'
|
41
|
+
opts = { owner: 'library', repo: name, url: 'https://registry.hub.docker.com', user: nil,
|
42
|
+
password: nil }.merge(opts)
|
41
43
|
when 'gem'
|
42
44
|
opts = { gem: name[/rubygem-(.*)/, 1] || name }.merge(opts)
|
43
45
|
when /github.*/
|
44
|
-
opts = { owner: name, repo: name }.merge(opts)
|
46
|
+
opts = { owner: name, repo: name, token: nil }.merge(opts)
|
45
47
|
when 'index'
|
46
48
|
opts = { link: 'content' }.merge(opts)
|
47
49
|
when 'npm'
|
48
50
|
opts = { npm: name[/nodejs-(.*)/, 1] || name }.merge(opts)
|
49
51
|
when 'pypi'
|
50
|
-
opts = {
|
52
|
+
opts = { pypi: name[/python.*-(.*)/, 1] || name }.merge(opts)
|
51
53
|
end
|
52
54
|
@opts = opts
|
53
55
|
end
|
@@ -89,37 +91,45 @@ module Getv
|
|
89
91
|
|
90
92
|
private
|
91
93
|
|
92
|
-
def
|
94
|
+
def get(url)
|
95
|
+
require 'rest-client'
|
96
|
+
RestClient::Request.execute(method: :get, url: url, proxy: opts[:proxy]).body
|
97
|
+
end
|
98
|
+
|
99
|
+
def versions_using_docker # rubocop:disable Metrics/AbcSize
|
93
100
|
require 'docker_registry2'
|
94
|
-
|
101
|
+
docker_opts = {}
|
102
|
+
docker_opts[:http_options] = { proxy: opts[:proxy] } unless opts[:proxy].nil?
|
103
|
+
if opts[:user] && opts[:password]
|
104
|
+
docker_opts[:user] = opts[:user]
|
105
|
+
docker_opts[:password] = opts[:password]
|
106
|
+
end
|
107
|
+
docker = DockerRegistry2.connect(opts[:url], docker_opts)
|
95
108
|
docker.tags("#{opts[:owner]}/#{opts[:repo]}")['tags']
|
96
109
|
end
|
97
110
|
|
98
111
|
def versions_using_gem
|
99
112
|
require 'json'
|
100
|
-
|
101
|
-
require 'net/http'
|
102
|
-
JSON.parse(Net::HTTP.get(URI("https://rubygems.org/api/v1/versions/#{opts[:gem]}.json"))).map do |v|
|
113
|
+
JSON.parse(get("https://rubygems.org/api/v1/versions/#{opts[:gem]}.json")).map do |v|
|
103
114
|
v['number']
|
104
115
|
end
|
105
116
|
end
|
106
117
|
|
107
118
|
def versions_using_get
|
108
|
-
|
109
|
-
require 'net/http'
|
110
|
-
Net::HTTP.get(URI(opts[:url])).split("\n")
|
119
|
+
get(opts[:url]).split("\n")
|
111
120
|
end
|
112
121
|
|
113
|
-
def github
|
122
|
+
def github # rubocop:disable Metrics/MethodLength
|
114
123
|
require 'octokit'
|
115
|
-
if
|
116
|
-
github = Octokit::Client.new(access_token:
|
124
|
+
if opts[:token]
|
125
|
+
github = Octokit::Client.new(access_token: opts[:token])
|
117
126
|
user = github.user
|
118
127
|
user.login
|
119
128
|
else
|
120
129
|
github = Octokit::Client.new
|
121
130
|
end
|
122
131
|
github.auto_paginate = true
|
132
|
+
github.proxy = opts[:proxy]
|
123
133
|
github
|
124
134
|
end
|
125
135
|
|
@@ -137,11 +147,8 @@ module Getv
|
|
137
147
|
end
|
138
148
|
|
139
149
|
def versions_using_index
|
140
|
-
require 'open-uri'
|
141
|
-
require 'net/http'
|
142
150
|
require 'nokogiri'
|
143
|
-
|
144
|
-
Nokogiri::HTML(URI.open(opts[:url])).css('a').map do |a| # rubocop:disable Security/Open
|
151
|
+
Nokogiri::HTML(get(opts[:url])).css('a').map do |a|
|
145
152
|
if opts[:link] == 'value'
|
146
153
|
a.values[0]
|
147
154
|
else
|
@@ -152,16 +159,12 @@ module Getv
|
|
152
159
|
|
153
160
|
def versions_using_npm
|
154
161
|
require 'json'
|
155
|
-
|
156
|
-
require 'net/http'
|
157
|
-
JSON.parse(Net::HTTP.get(URI("https://registry.npmjs.org/#{opts[:npm]}")))['versions'].keys
|
162
|
+
JSON.parse(get("https://registry.npmjs.org/#{opts[:npm]}"))['versions'].keys
|
158
163
|
end
|
159
164
|
|
160
165
|
def versions_using_pypi
|
161
166
|
require 'json'
|
162
|
-
|
163
|
-
require 'net/http'
|
164
|
-
JSON.parse(Net::HTTP.get(URI("https://pypi.org/pypi/#{opts[:pypi]}/json")))['releases'].keys
|
167
|
+
JSON.parse(get("https://pypi.org/pypi/#{opts[:pypi]}/json"))['releases'].keys
|
165
168
|
end
|
166
169
|
end
|
167
170
|
end
|
data/lib/getv/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- harbottle
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -90,6 +90,26 @@ dependencies:
|
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 5.0.0
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rest-client
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.1.0
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.0.0
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.1.0
|
110
|
+
- - "<"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 3.0.0
|
93
113
|
- !ruby/object:Gem::Dependency
|
94
114
|
name: semantic
|
95
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +151,7 @@ metadata:
|
|
131
151
|
homepage_uri: https://github.com/liger1978/getv
|
132
152
|
source_code_uri: https://github.com/liger1978/getv
|
133
153
|
changelog_uri: https://github.com/liger1978/getv
|
134
|
-
post_install_message:
|
154
|
+
post_install_message:
|
135
155
|
rdoc_options: []
|
136
156
|
require_paths:
|
137
157
|
- lib
|
@@ -146,8 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
166
|
- !ruby/object:Gem::Version
|
147
167
|
version: '0'
|
148
168
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
169
|
+
rubygems_version: 3.2.22
|
170
|
+
signing_key:
|
151
171
|
specification_version: 4
|
152
172
|
summary: Pull package version numbers from the web in various ways.
|
153
173
|
test_files: []
|