getv 0.2.1 → 1.1.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: 9df93ffa722415bb043482dba77b19857d451eab5fffb02bd932d1bfd879ba94
4
- data.tar.gz: c46cb7df95c3f650b5fb51f000b06c737a11ed9855d001ecdbd0b58659e4abe3
3
+ metadata.gz: 8b7033c123fd837edd23f202973d20c313932df2e35bb8eb680c2ecd4aa3f674
4
+ data.tar.gz: 5e66336327fc70676fba92f92eb56398b00bdfcc780cf4ec54365c38bf1edce3
5
5
  SHA512:
6
- metadata.gz: 9c367895cb0b222da896d0a73defbcba5cd3aeb3a27be19260d6f16ef848a75858d07ffc331ac8233ad8b7bd87a2e51f6fab9a92575ff84075b3ff36d822fe92
7
- data.tar.gz: ce6a117fa358863a15695120f9975b802125cde13bf8439dac6de2a06531c22f0f4afb259ac7366d54b6ef7a7c20be46b5cc4cada2b8a1061569afaa8a0d8796
6
+ metadata.gz: cf6eb57389b7cf24b99177a8dba23da0095719da908672489b5e137e4c89aee948fd134f28bba952785098db43f60cf2645b2bf0bfaffcb81be849382c26db5b
7
+ data.tar.gz: 1b24a3216e4b33febabe870994c901c48e17108718f5d5d86dee79f0dabd77936e26b20a3b19ea41160a7774e8eb2e27ae69a31d32fd887d192a6c2ba52e7ffb
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /bin/
1
2
  /bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
@@ -7,6 +8,8 @@
7
8
  /spec/reports/
8
9
  /tmp/
9
10
  /*.gem
11
+ /vendor
12
+ Gemfile.lock
10
13
 
11
14
  # rspec failure tracking
12
15
  .rspec_status
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ ---
2
+ AllCops:
3
+ Exclude:
4
+ - 'bin/**/*'
5
+ - 'bundle/**/*'
6
+ - '*.gemspec'
7
+ NewCops: enable
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - 'Rakefile'
12
+ - '**/*.rake'
13
+ - 'test/**/*.rb'
14
+ - 'spec/**/*_spec.rb'
data/Gemfile CHANGED
@@ -1,13 +1,20 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in getv.gemspec
4
6
  gemspec
5
7
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
8
- gem "nokogiri", "~> 1.13"
9
- gem "irb", "~> 1.4"
10
- gem "rdoc", "~> 6.4"
11
- gem "octokit", "~> 4.21"
12
- gem "semantic", "~> 1.6"
13
- gem "docker_registry2", "~> 1.10"
8
+ gem 'docker_registry2', '~> 1.10'
9
+ gem 'irb', '~> 1.4'
10
+ gem 'nokogiri', '~> 1.13'
11
+ gem 'octokit', '~> 4.21'
12
+ gem 'rake', '~> 12.0'
13
+ gem 'rdoc', '~> 6.4'
14
+ gem 'rspec', '~> 3.0'
15
+ gem 'rubocop', '~> 1.24', require: false
16
+ gem 'rubocop-rake', '~> 0.6', require: false
17
+ gem 'rubocop-rspec', '~> 2.7', require: false
18
+ gem 'semantic', '~> 1.6'
19
+ gem 'vcr', '~> 6.0'
20
+ gem 'webmock', '~> 3.0'
data/README.md CHANGED
@@ -21,13 +21,13 @@ Or install it yourself as:
21
21
  ## Usage
22
22
 
23
23
  ```
24
- irb(main):024:0> superset = Getv::Package.new('superset',{:type => 'docker', :owner => 'apache', :reject => '-'})
24
+ irb(main):024:0> superset = Getv::Package.new('superset', type: 'docker', owner: 'apache', reject: '-')
25
25
  =>
26
26
  #<Getv::Package:0x000055b6d2326f20
27
27
  ...
28
- irb(main):025:0> superset.get_versions
28
+ irb(main):025:0> superset.versions
29
29
  => ["1.0.0", "1.0.1", "1.1.0", "1.2.0", "1.3.0", "1.3.1", "1.3.2"]
30
- irb(main):026:0> superset.get_latest_version
30
+ irb(main):026:0> superset.latest_version
31
31
  => "1.3.2"
32
32
  irb(main):027:0> superset
33
33
  =>
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/getv.gemspec CHANGED
@@ -1,31 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/getv/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
4
- spec.name = "getv"
6
+ spec.name = 'getv'
5
7
  spec.version = Getv::VERSION
6
- spec.authors = ["harbottle"]
7
- spec.email = ["harbottle@room3d3.com"]
8
+ spec.authors = ['harbottle']
9
+ spec.email = ['harbottle@room3d3.com']
8
10
 
9
- spec.summary = "Pull package version numbers from the web in various ways."
10
- spec.description = "Pull package version numbers from the web in various ways."
11
- spec.homepage = "https://github.com/liger1978/getv"
12
- spec.license = "MIT"
11
+ spec.summary = 'Pull package version numbers from the web in various ways.'
12
+ spec.description = 'Pull package version numbers from the web in various ways.'
13
+ spec.homepage = 'https://github.com/liger1978/getv'
14
+ spec.license = 'MIT'
13
15
 
14
- spec.metadata["homepage_uri"] = spec.homepage
15
- spec.metadata["source_code_uri"] = "https://github.com/liger1978/getv"
16
- spec.metadata["changelog_uri"] = "https://github.com/liger1978/getv"
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/liger1978/getv'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/liger1978/getv'
17
19
 
18
20
  # Specify which files should be added to the gem when it is released.
19
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
24
  end
23
- spec.bindir = "exe"
25
+ spec.bindir = 'exe'
24
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
- spec.require_paths = ["lib"]
27
+ spec.require_paths = ['lib']
26
28
 
27
- spec.add_dependency("nokogiri", ">= 1.0.0", "< 2.0.0")
28
- spec.add_dependency("octokit", ">= 3.0.0", "< 5.0.0")
29
- spec.add_dependency("semantic", ">= 1.0.0", "< 2.0.0")
30
- spec.add_dependency("docker_registry2", ">= 1.0.0", "< 2.0.0")
29
+ spec.add_dependency('docker_registry2', '>= 1.0.0', '< 2.0.0')
30
+ spec.add_dependency('nokogiri', '>= 1.0.0', '< 2.0.0')
31
+ spec.add_dependency('octokit', '>= 3.0.0', '< 5.0.0')
32
+ spec.add_dependency('semantic', '>= 1.0.0', '< 2.0.0')
31
33
  end
data/lib/getv/package.rb CHANGED
@@ -1,179 +1,167 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Getv
2
- class Package
4
+ # package class
5
+ class Package # rubocop:disable Metrics/ClassLength
3
6
  attr_accessor :name, :opts
4
7
 
5
- def initialize(name, opts={})
8
+ def initialize(name, opts = {}) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
6
9
  @name = name
7
- if /rubygem-.*/.match?(name)
8
- opts = {'type' => 'gem'}.merge(opts)
9
- elsif /nodejs-.*/.match?(name)
10
- opts = {'type' => 'npm'}.merge(opts)
11
- elsif /python.*-.*/.match?(name)
12
- opts = {'type' => 'pypi'}.merge(opts)
10
+ case name
11
+ when /rubygem-.*/
12
+ opts = { 'type' => 'gem' }.merge(opts)
13
+ when /nodejs-.*/
14
+ opts = { 'type' => 'npm' }.merge(opts)
15
+ when /python.*-.*/
16
+ opts = { 'type' => 'pypi' }.merge(opts)
13
17
  end
14
18
  if opts[:type] == 'github_commit'
15
19
  opts = {
16
- :select_search => '^((\d{8})(\d{6}),(([a-z\d]{7})(.*)))$',
17
- :semantic_only => false
20
+ branch: 'master',
21
+ select_search: '^((\d{8})(\d{6}),(([a-z\d]{7})(.*)))$',
22
+ semantic_only: false
18
23
  }.merge(opts)
19
24
  end
20
25
  opts = {
21
- :type => 'github_release',
22
- :select_search => '^\s*v?((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)\s*$',
23
- :select_replace => '\1',
24
- :reject => nil,
25
- :semantic_only => true,
26
- :semantic_select => ['*'],
27
- :versions => nil,
28
- :latest_version => nil,
26
+ type: 'github_release',
27
+ select_search: '^\s*v?((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)\s*$', # rubocop:disable Layout/LineLength
28
+ select_replace: '\1',
29
+ reject: nil,
30
+ semantic_only: true,
31
+ semantic_select: ['*'],
32
+ versions: nil,
33
+ latest_version: nil
29
34
  }.merge(opts)
35
+ if (opts[:type] == 'docker' || opts[:type] =~ /github.*/) && (name.count('/') == 1)
36
+ opts = { owner: name.split('/')[0], repo: name.split('/')[1] }.merge(opts)
37
+ end
30
38
  case opts[:type]
31
39
  when 'docker'
32
- opts = {:owner => 'library', :repo => name, :url=> 'https://registry.hub.docker.com'}.merge(opts)
40
+ opts = { owner: 'library', repo: name, url: 'https://registry.hub.docker.com' }.merge(opts)
33
41
  when 'gem'
34
- opts = {:gem => name[/rubygem-(.*)/, 1] || name}.merge(opts)
42
+ opts = { gem: name[/rubygem-(.*)/, 1] || name }.merge(opts)
35
43
  when /github.*/
36
- opts = {:owner => name, :repo => name,}.merge(opts)
44
+ opts = { owner: name, repo: name }.merge(opts)
37
45
  when 'index'
38
- opts = {:link => 'content'}.merge(opts)
46
+ opts = { link: 'content' }.merge(opts)
39
47
  when 'npm'
40
- opts = {:npm => name[/nodejs-(.*)/, 1] || name}.merge(opts)
48
+ opts = { npm: name[/nodejs-(.*)/, 1] || name }.merge(opts)
41
49
  when 'pypi'
42
- opts = {:npm => name[/python.*-(.*)/, 1] || name}.merge(opts)
50
+ opts = { npm: name[/python.*-(.*)/, 1] || name }.merge(opts)
43
51
  end
44
52
  @opts = opts
45
53
  end
46
-
47
- def get_latest_version
48
- if opts[:latest_version] == nil
49
- self.update_versions
50
- end
54
+
55
+ def latest_version
56
+ update_versions if opts[:latest_version].nil?
51
57
  opts[:latest_version]
52
58
  end
53
59
 
54
- def get_versions
55
- if opts[:version] == nil
56
- self.update_versions
57
- end
60
+ def versions
61
+ update_versions if opts[:versions].nil?
58
62
  opts[:versions]
59
63
  end
60
64
 
61
- def update_versions
62
- case opts[:type]
63
- when 'docker'
64
- versions = get_versions_using_docker
65
- when 'gem'
66
- versions = get_versions_using_gem
67
- when 'get'
68
- versions = get_versions_using_get
69
- when 'github_commit'
70
- versions = get_versions_using_github('commit')
71
- when 'github_release'
72
- versions = get_versions_using_github('release')
73
- when 'github_tag'
74
- versions = get_versions_using_github('tag')
75
- when 'index'
76
- versions = get_versions_using_index
77
- when 'npm'
78
- versions = get_versions_using_npm
79
- when 'pypi'
80
- versions = get_versions_using_pypi
81
- end
82
- if opts[:type] == 'github_commit'
83
- versions.sort!
84
- end
65
+ def update_versions # rubocop:disable Metrics/PerceivedComplexity,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/AbcSize
66
+ method = opts[:type].split('_')
67
+ method[0] = "versions_using_#{method[0]}"
68
+
69
+ versions = send(*method)
70
+ versions.sort! if opts[:type] == 'github_commit'
85
71
  select_pattern = Regexp.new(opts[:select_search])
86
- versions.select! {|v| v =~ select_pattern}
87
- versions.map! {|v| v.sub(select_pattern, opts[:select_replace])}
88
- unless opts[:reject].nil?
89
- versions.reject! {|v| v =~ Regexp.new(opts[:reject])}
90
- end
72
+ versions.select! { |v| v =~ select_pattern }
73
+ versions.map! { |v| v.sub(select_pattern, opts[:select_replace]) }
74
+ versions.reject! { |v| v =~ Regexp.new(opts[:reject]) } unless opts[:reject].nil?
91
75
  if opts[:semantic_only]
92
76
  require 'semantic'
93
77
  require 'semantic/core_ext'
94
- versions.select! {|v| v.is_version?}
78
+ versions.select!(&:is_version?)
95
79
  opts[:semantic_select].each do |comparator|
96
- versions.select! {|v| Semantic::Version.new(v).satisfies?(comparator)}
80
+ versions.select! { |v| Semantic::Version.new(v).satisfies?(comparator) }
97
81
  end
98
- versions.sort_by! {|v| Semantic::Version.new(v)}
82
+ versions.sort_by! { |v| Semantic::Version.new(v) }
99
83
  else
100
- unless opts[:type] == 'github_commit'
101
- versions.sort!
102
- end
103
- end
104
- opts[:versions] = versions
105
- unless opts[:versions].empty?
106
- opts[:latest_version] = opts[:versions][-1]
84
+ versions.sort! unless opts[:type] == 'github_commit'
107
85
  end
86
+ opts[:versions] = versions.uniq
87
+ opts[:latest_version] = opts[:versions][-1] unless opts[:versions].empty?
108
88
  end
109
89
 
110
90
  private
111
91
 
112
- def get_versions_using_docker
92
+ def versions_using_docker
113
93
  require 'docker_registry2'
114
94
  docker = DockerRegistry2.connect(opts[:url])
115
- return docker.tags("#{opts[:owner]}/#{opts[:repo]}")['tags']
95
+ docker.tags("#{opts[:owner]}/#{opts[:repo]}")['tags']
116
96
  end
117
97
 
118
- def get_versions_using_gem
98
+ def versions_using_gem
119
99
  require 'json'
120
100
  require 'open-uri'
121
101
  require 'net/http'
122
- return JSON.parse(Net::HTTP.get(URI("https://rubygems.org/api/v1/versions/#{opts[:gem]}.json"))).map {|v| v['number']}
102
+ JSON.parse(Net::HTTP.get(URI("https://rubygems.org/api/v1/versions/#{opts[:gem]}.json"))).map do |v|
103
+ v['number']
104
+ end
123
105
  end
124
106
 
125
- def get_versions_using_get
107
+ def versions_using_get
126
108
  require 'open-uri'
127
109
  require 'net/http'
128
- return Net::HTTP.get(URI(opts[:url])).split("\n")
110
+ Net::HTTP.get(URI(opts[:url])).split("\n")
129
111
  end
130
112
 
131
- def get_versions_using_github(method)
113
+ def github
132
114
  require 'octokit'
133
115
  if ENV['GITHUB_TOKEN']
134
- github = Octokit::Client.new(:access_token => ENV['GITHUB_TOKEN'])
116
+ github = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
135
117
  user = github.user
136
118
  user.login
137
119
  else
138
- github = Octokit::Client.new()
120
+ github = Octokit::Client.new
139
121
  end
140
122
  github.auto_paginate = true
141
- if method == 'release'
142
- return github.releases("#{opts[:owner]}/#{opts[:repo]}").map{|r| r.tag_name}
143
- elsif method == 'commit'
144
- return github.commits("#{opts[:owner]}/#{opts[:repo]}").map { |c|
123
+ github
124
+ end
125
+
126
+ def versions_using_github(method) # rubocop:disable Metrics/AbcSize
127
+ case method
128
+ when 'release'
129
+ github.releases("#{opts[:owner]}/#{opts[:repo]}").map(&:tag_name)
130
+ when 'commit'
131
+ github.commits("#{opts[:owner]}/#{opts[:repo]}", opts[:branch]).map do |c|
145
132
  "#{DateTime.parse(c[:commit][:author][:date].to_s).strftime('%Y%m%d%H%M%S')},#{c[:sha]}"
146
- }
133
+ end
147
134
  else
148
- return github.tags("#{opts[:owner]}/#{opts[:repo]}").map{|t| t[:name]}
135
+ github.tags("#{opts[:owner]}/#{opts[:repo]}").map { |t| t[:name] }
149
136
  end
150
137
  end
151
138
 
152
- def get_versions_using_index
139
+ def versions_using_index
153
140
  require 'open-uri'
154
141
  require 'net/http'
155
142
  require 'nokogiri'
156
- if opts[:link] == 'value'
157
- versions = Nokogiri::HTML(URI.open(opts[:url])).css('a').map{|a| a.values[0]}
158
- else
159
- versions = Nokogiri::HTML(URI.open(opts[:url])).css('a').map{|a| a.public_send(opts[:link])}
143
+
144
+ Nokogiri::HTML(URI.open(opts[:url])).css('a').map do |a| # rubocop:disable Security/Open
145
+ if opts[:link] == 'value'
146
+ a.values[0]
147
+ else
148
+ a.public_send(opts[:link])
149
+ end
160
150
  end
161
- return versions
162
151
  end
163
152
 
164
- def get_versions_using_npm
153
+ def versions_using_npm
165
154
  require 'json'
166
155
  require 'open-uri'
167
156
  require 'net/http'
168
- return JSON.parse(Net::HTTP.get(URI("https://registry.npmjs.org/#{opts[:npm]}")))['versions'].keys
157
+ JSON.parse(Net::HTTP.get(URI("https://registry.npmjs.org/#{opts[:npm]}")))['versions'].keys
169
158
  end
170
159
 
171
- def get_versions_using_pypi
160
+ def versions_using_pypi
172
161
  require 'json'
173
162
  require 'open-uri'
174
163
  require 'net/http'
175
- return JSON.parse(Net::HTTP.get(URI("https://pypi.org/pypi/#{opts[:pypi]}/json")))['releases'].keys
164
+ JSON.parse(Net::HTTP.get(URI("https://pypi.org/pypi/#{opts[:pypi]}/json")))['releases'].keys
176
165
  end
177
-
178
166
  end
179
167
  end
data/lib/getv/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Getv
2
- VERSION = "0.2.1"
4
+ VERSION = '1.1.0'
3
5
  end
data/lib/getv.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "getv/version"
2
- require "getv/package"
1
+ # frozen_string_literal: true
2
+
3
+ require 'getv/version'
4
+ require 'getv/package'
3
5
 
4
6
  module Getv
5
7
  class Error < StandardError; end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.1.0
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-15 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nokogiri
14
+ name: docker_registry2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -31,47 +31,47 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.0.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: octokit
34
+ name: nokogiri
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 3.0.0
39
+ version: 1.0.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 5.0.0
42
+ version: 2.0.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 3.0.0
49
+ version: 1.0.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 5.0.0
52
+ version: 2.0.0
53
53
  - !ruby/object:Gem::Dependency
54
- name: semantic
54
+ name: octokit
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.0.0
59
+ version: 3.0.0
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.0
62
+ version: 5.0.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.0.0
69
+ version: 3.0.0
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: 2.0.0
72
+ version: 5.0.0
73
73
  - !ruby/object:Gem::Dependency
74
- name: docker_registry2
74
+ name: semantic
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="
@@ -100,25 +100,12 @@ files:
100
100
  - ".bundle/config"
101
101
  - ".gitignore"
102
102
  - ".rspec"
103
+ - ".rubocop.yml"
103
104
  - ".travis.yml"
104
105
  - Gemfile
105
- - Gemfile.lock
106
106
  - LICENSE.txt
107
107
  - README.md
108
108
  - Rakefile
109
- - bin/bundle
110
- - bin/console
111
- - bin/htmldiff
112
- - bin/irb
113
- - bin/ldiff
114
- - bin/nokogiri
115
- - bin/racc
116
- - bin/rake
117
- - bin/rdoc
118
- - bin/restclient
119
- - bin/ri
120
- - bin/rspec
121
- - bin/setup
122
109
  - getv.gemspec
123
110
  - lib/getv.rb
124
111
  - lib/getv/package.rb
@@ -130,7 +117,7 @@ metadata:
130
117
  homepage_uri: https://github.com/liger1978/getv
131
118
  source_code_uri: https://github.com/liger1978/getv
132
119
  changelog_uri: https://github.com/liger1978/getv
133
- post_install_message:
120
+ post_install_message:
134
121
  rdoc_options: []
135
122
  require_paths:
136
123
  - lib
@@ -145,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
132
  - !ruby/object:Gem::Version
146
133
  version: '0'
147
134
  requirements: []
148
- rubygems_version: 3.2.22
149
- signing_key:
135
+ rubygems_version: 3.0.3
136
+ signing_key:
150
137
  specification_version: 4
151
138
  summary: Pull package version numbers from the web in various ways.
152
139
  test_files: []
data/Gemfile.lock DELETED
@@ -1,113 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- getv (0.2.1)
5
- docker_registry2 (>= 1.0.0, < 2.0.0)
6
- nokogiri (>= 1.0.0, < 2.0.0)
7
- octokit (>= 3.0.0, < 5.0.0)
8
- semantic (>= 1.0.0, < 2.0.0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.8.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
- diff-lcs (1.5.0)
16
- docker_registry2 (1.10.0)
17
- rest-client (>= 1.8.0)
18
- domain_name (0.5.20190701)
19
- unf (>= 0.0.5, < 1.0.0)
20
- faraday (1.9.3)
21
- faraday-em_http (~> 1.0)
22
- faraday-em_synchrony (~> 1.0)
23
- faraday-excon (~> 1.1)
24
- faraday-httpclient (~> 1.0)
25
- faraday-multipart (~> 1.0)
26
- faraday-net_http (~> 1.0)
27
- faraday-net_http_persistent (~> 1.0)
28
- faraday-patron (~> 1.0)
29
- faraday-rack (~> 1.0)
30
- faraday-retry (~> 1.0)
31
- ruby2_keywords (>= 0.0.4)
32
- faraday-em_http (1.0.0)
33
- faraday-em_synchrony (1.0.0)
34
- faraday-excon (1.1.0)
35
- faraday-httpclient (1.0.1)
36
- faraday-multipart (1.0.3)
37
- multipart-post (>= 1.2, < 3)
38
- faraday-net_http (1.0.1)
39
- faraday-net_http_persistent (1.2.0)
40
- faraday-patron (1.0.0)
41
- faraday-rack (1.0.0)
42
- faraday-retry (1.0.3)
43
- http-accept (1.7.0)
44
- http-cookie (1.0.4)
45
- domain_name (~> 0.5)
46
- io-console (0.5.11)
47
- irb (1.4.1)
48
- reline (>= 0.3.0)
49
- mime-types (3.4.1)
50
- mime-types-data (~> 3.2015)
51
- mime-types-data (3.2022.0105)
52
- mini_portile2 (2.7.1)
53
- multipart-post (2.1.1)
54
- netrc (0.11.0)
55
- nokogiri (1.13.0)
56
- mini_portile2 (~> 2.7.0)
57
- racc (~> 1.4)
58
- octokit (4.21.0)
59
- faraday (>= 0.9)
60
- sawyer (~> 0.8.0, >= 0.5.3)
61
- psych (4.0.3)
62
- stringio
63
- public_suffix (4.0.6)
64
- racc (1.6.0)
65
- rake (12.3.3)
66
- rdoc (6.4.0)
67
- psych (>= 4.0.0)
68
- reline (0.3.1)
69
- io-console (~> 0.5)
70
- rest-client (2.1.0)
71
- http-accept (>= 1.7.0, < 2.0)
72
- http-cookie (>= 1.0.2, < 2.0)
73
- mime-types (>= 1.16, < 4.0)
74
- netrc (~> 0.8)
75
- rspec (3.10.0)
76
- rspec-core (~> 3.10.0)
77
- rspec-expectations (~> 3.10.0)
78
- rspec-mocks (~> 3.10.0)
79
- rspec-core (3.10.1)
80
- rspec-support (~> 3.10.0)
81
- rspec-expectations (3.10.1)
82
- diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.10.0)
84
- rspec-mocks (3.10.2)
85
- diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.10.0)
87
- rspec-support (3.10.3)
88
- ruby2_keywords (0.0.5)
89
- sawyer (0.8.2)
90
- addressable (>= 2.3.5)
91
- faraday (> 0.8, < 2.0)
92
- semantic (1.6.1)
93
- stringio (3.0.1)
94
- unf (0.1.4)
95
- unf_ext
96
- unf_ext (0.0.8)
97
-
98
- PLATFORMS
99
- ruby
100
-
101
- DEPENDENCIES
102
- docker_registry2 (~> 1.10)
103
- getv!
104
- irb (~> 1.4)
105
- nokogiri (~> 1.13)
106
- octokit (~> 4.21)
107
- rake (~> 12.0)
108
- rdoc (~> 6.4)
109
- rspec (~> 3.0)
110
- semantic (~> 1.6)
111
-
112
- BUNDLED WITH
113
- 2.2.22
data/bin/bundle DELETED
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'bundle' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "rubygems"
12
-
13
- m = Module.new do
14
- module_function
15
-
16
- def invoked_as_script?
17
- File.expand_path($0) == File.expand_path(__FILE__)
18
- end
19
-
20
- def env_var_version
21
- ENV["BUNDLER_VERSION"]
22
- end
23
-
24
- def cli_arg_version
25
- return unless invoked_as_script? # don't want to hijack other binstubs
26
- return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
- bundler_version = nil
28
- update_index = nil
29
- ARGV.each_with_index do |a, i|
30
- if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
- bundler_version = a
32
- end
33
- next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
- bundler_version = $1
35
- update_index = i
36
- end
37
- bundler_version
38
- end
39
-
40
- def gemfile
41
- gemfile = ENV["BUNDLE_GEMFILE"]
42
- return gemfile if gemfile && !gemfile.empty?
43
-
44
- File.expand_path("../../Gemfile", __FILE__)
45
- end
46
-
47
- def lockfile
48
- lockfile =
49
- case File.basename(gemfile)
50
- when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
- else "#{gemfile}.lock"
52
- end
53
- File.expand_path(lockfile)
54
- end
55
-
56
- def lockfile_version
57
- return unless File.file?(lockfile)
58
- lockfile_contents = File.read(lockfile)
59
- return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
- Regexp.last_match(1)
61
- end
62
-
63
- def bundler_version
64
- @bundler_version ||=
65
- env_var_version || cli_arg_version ||
66
- lockfile_version
67
- end
68
-
69
- def bundler_requirement
70
- return "#{Gem::Requirement.default}.a" unless bundler_version
71
-
72
- bundler_gem_version = Gem::Version.new(bundler_version)
73
-
74
- requirement = bundler_gem_version.approximate_recommendation
75
-
76
- return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
-
78
- requirement += ".a" if bundler_gem_version.prerelease?
79
-
80
- requirement
81
- end
82
-
83
- def load_bundler!
84
- ENV["BUNDLE_GEMFILE"] ||= gemfile
85
-
86
- activate_bundler
87
- end
88
-
89
- def activate_bundler
90
- gem_error = activation_error_handling do
91
- gem "bundler", bundler_requirement
92
- end
93
- return if gem_error.nil?
94
- require_error = activation_error_handling do
95
- require "bundler/version"
96
- end
97
- return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
- warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
- exit 42
100
- end
101
-
102
- def activation_error_handling
103
- yield
104
- nil
105
- rescue StandardError, LoadError => e
106
- e
107
- end
108
- end
109
-
110
- m.load_bundler!
111
-
112
- if m.invoked_as_script?
113
- load Gem.bin_path("bundler", "bundle")
114
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "getv"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/htmldiff DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'htmldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/irb DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'irb' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("irb", "irb")
data/bin/ldiff DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'ldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "ldiff")
data/bin/nokogiri DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'nokogiri' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("nokogiri", "nokogiri")
data/bin/racc DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'racc' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("racc", "racc")
data/bin/rake DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rake' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rake", "rake")
data/bin/rdoc DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rdoc' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rdoc", "rdoc")
data/bin/restclient DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'restclient' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rest-client", "restclient")
data/bin/ri DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'ri' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rdoc", "ri")
data/bin/rspec DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rspec-core", "rspec")
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here