gem_version_check 0.4.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/gem_version_check/cli.rb +29 -23
- data/lib/gem_version_check/configuration.rb +6 -5
- data/lib/gem_version_check/lockfile_fetcher.rb +6 -2
- data/lib/gem_version_check/version.rb +1 -1
- data/spec/configuration_spec.rb +4 -3
- data/spec/spec_helper.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca4555e0f6aa6c50880e033511160aff7734589e
|
4
|
+
data.tar.gz: 920cf30fe393e38b8c5ce21cb5bd33f2e1442d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9469d853daa9133b2febff950eb91631b6b3e3d70084841acee92dda12b342eda56c408b2d472b4ac7151754566eb254bed924dc20c91da4fd0a2f9383d47231
|
7
|
+
data.tar.gz: e78b2e6557f2d8260981a297ce417eaa6c0c4730fbe8874091cc8b911d0bb50cffbaca1711bab57d1d8fb219f3da442b257c2f3bdb8ea0894cc937ad98d23b14
|
data/Rakefile
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'optparse'
|
2
4
|
|
3
5
|
module GemVersionCheck
|
4
6
|
module Cli
|
@@ -6,10 +8,10 @@ module GemVersionCheck
|
|
6
8
|
|
7
9
|
def run(params)
|
8
10
|
project_names, options = parse(params)
|
9
|
-
if project_names.
|
11
|
+
if !project_names.empty?
|
10
12
|
generate_report(project_names, options)
|
11
13
|
else
|
12
|
-
puts
|
14
|
+
puts 'Missing params: gem_version_check my-gh-name/my-project gem1 gem2 gem3'
|
13
15
|
exit(1)
|
14
16
|
end
|
15
17
|
end
|
@@ -20,49 +22,53 @@ module GemVersionCheck
|
|
20
22
|
options = {}
|
21
23
|
option_parser = nil
|
22
24
|
project_names = OptionParser.new do |opts|
|
23
|
-
opts.banner =
|
25
|
+
opts.banner = 'Usage: gem_version_check project [options]'
|
24
26
|
|
25
|
-
opts.separator
|
26
|
-
opts.separator
|
27
|
+
opts.separator ''
|
28
|
+
opts.separator 'Specific options:'
|
27
29
|
|
28
|
-
opts.on(
|
30
|
+
opts.on('--only gem1,gem2,gem3', Array, 'List of ruby gems') do |list|
|
29
31
|
options[:only] = list
|
30
32
|
end
|
31
33
|
|
32
|
-
opts.on(
|
34
|
+
opts.on('--except gem1,gem2,gem3', Array, 'List of ruby gems') do |list|
|
33
35
|
options[:except] = list
|
34
36
|
end
|
35
37
|
|
36
|
-
opts.on(
|
38
|
+
opts.on('--host github.com', String, 'Github host name') do |host|
|
37
39
|
options[:host] = host
|
38
40
|
end
|
39
41
|
|
40
|
-
opts.on(
|
42
|
+
opts.on('--token access-token', String, 'Github access token') do |token|
|
43
|
+
options[:token] = token
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.on('--sources my.gems.org,rubygems.org', String, 'Sources to check for new gems versions') do |sources|
|
41
47
|
options[:sources] = sources
|
42
48
|
end
|
43
49
|
|
44
|
-
opts.on(
|
50
|
+
opts.on('--disable-progress-bar', 'Disable progress bar') do |disable_progress_bar|
|
45
51
|
options[:disable_progress_bar] = disable_progress_bar
|
46
52
|
end
|
47
53
|
|
48
|
-
opts.on(
|
54
|
+
opts.on('--ignore-major-version-change', 'Ignore changes of the major version') do |ignore_major_version_change|
|
49
55
|
options[:ignore_major_version_change] = ignore_major_version_change
|
50
56
|
end
|
51
57
|
|
52
|
-
opts.on(
|
58
|
+
opts.on('--allow-prerelease-dependencies', 'Allow dependencies to be prereleases') do |allow_prerelease_dependencies|
|
53
59
|
options[:allow_prerelease_dependencies] = allow_prerelease_dependencies
|
54
60
|
end
|
55
61
|
|
56
|
-
opts.on(
|
62
|
+
opts.on('--output-format FORMAT', %w[json pretty], 'Output format') do |output_format|
|
57
63
|
options[:output_format] = output_format
|
58
64
|
end
|
59
65
|
|
60
|
-
opts.on_tail(
|
66
|
+
opts.on_tail('--version', 'Show version') do
|
61
67
|
puts GemVersionCheck::VERSION
|
62
68
|
exit
|
63
69
|
end
|
64
70
|
|
65
|
-
opts.on_tail(
|
71
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
66
72
|
puts opts
|
67
73
|
exit
|
68
74
|
end
|
@@ -71,11 +77,12 @@ module GemVersionCheck
|
|
71
77
|
end.parse!(params)
|
72
78
|
|
73
79
|
GemVersionCheck.configuration = {
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
80
|
+
github_host: options[:host],
|
81
|
+
sources: options[:sources],
|
82
|
+
show_progress_bar: !options[:disable_progress_bar],
|
83
|
+
ignore_major_version_change: options[:ignore_major_version_change],
|
84
|
+
allow_prerelease_dependencies: options[:allow_prerelease_dependencies],
|
85
|
+
token: options[:token]
|
79
86
|
}
|
80
87
|
|
81
88
|
[Array(project_names), options]
|
@@ -89,7 +96,7 @@ module GemVersionCheck
|
|
89
96
|
report = Report.new(project_names, options)
|
90
97
|
|
91
98
|
case options[:output_format]
|
92
|
-
when
|
99
|
+
when 'json'
|
93
100
|
puts Formatter::JSON.new(report.generate).format
|
94
101
|
else
|
95
102
|
puts Formatter::PrettyPrint.new(report.generate).format
|
@@ -100,6 +107,5 @@ module GemVersionCheck
|
|
100
107
|
puts "Can't find Gemfile.lock for #{e}"
|
101
108
|
exit(1)
|
102
109
|
end
|
103
|
-
|
104
110
|
end
|
105
111
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module GemVersionCheck
|
2
2
|
class Configuration
|
3
|
-
attr_reader :github_host, :sources, :show_progress_bar, :ignore_major_version_change, :allow_prerelease_dependencies
|
3
|
+
attr_reader :github_host, :sources, :show_progress_bar, :ignore_major_version_change, :allow_prerelease_dependencies, :token
|
4
4
|
|
5
5
|
def initialize(settings = {})
|
6
|
-
@github_host
|
7
|
-
@sources
|
8
|
-
@show_progress_bar
|
9
|
-
@ignore_major_version_change
|
6
|
+
@github_host = settings[:github_host] || "github.com"
|
7
|
+
@sources = settings[:sources]
|
8
|
+
@show_progress_bar = settings[:show_progress_bar] || false
|
9
|
+
@ignore_major_version_change = settings[:ignore_major_version_change] || false
|
10
10
|
@allow_prerelease_dependencies = settings[:allow_prerelease_dependencies] || false
|
11
|
+
@token = settings[:token]
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -28,10 +28,11 @@ module GemVersionCheck
|
|
28
28
|
# github enterprise does not redirect
|
29
29
|
# TODO: change if github enterprise redirects too
|
30
30
|
def gemfile_lock_url
|
31
|
+
host = GemVersionCheck.configuration.github_host
|
31
32
|
if GemVersionCheck.configuration.github_host == "github.com"
|
32
|
-
"https://raw.#{
|
33
|
+
"https://raw.#{host}/#{@project}/master/Gemfile.lock"
|
33
34
|
else
|
34
|
-
"https://#{
|
35
|
+
"https://#{host}/raw/#{@project}/master/Gemfile.lock"
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -39,6 +40,9 @@ module GemVersionCheck
|
|
39
40
|
http = Net::HTTP.new(uri.host, uri.port)
|
40
41
|
http.use_ssl = true if uri.scheme == 'https'
|
41
42
|
request = Net::HTTP::Get.new(uri.request_uri)
|
43
|
+
if token = GemVersionCheck.configuration.token
|
44
|
+
request.basic_auth token, 'x-oauth-basic'
|
45
|
+
end
|
42
46
|
response = http.request(request)
|
43
47
|
if response.code == "200"
|
44
48
|
response.body
|
data/spec/configuration_spec.rb
CHANGED
@@ -5,14 +5,15 @@ module GemVersionCheck
|
|
5
5
|
describe Configuration do
|
6
6
|
after do
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
it "returns github.com as default github_host" do
|
10
10
|
GemVersionCheck.configuration.github_host.should == "github.com"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "returns specified value if set" do
|
14
|
-
GemVersionCheck.configuration = { :github_host => "test" }
|
14
|
+
GemVersionCheck.configuration = { :github_host => "test", token: 'teeest' }
|
15
15
|
GemVersionCheck.configuration.github_host.should == "test"
|
16
|
+
GemVersionCheck.configuration.token.should == 'teeest'
|
16
17
|
end
|
17
18
|
end
|
18
|
-
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "gem_version_check"
|
4
|
-
require "mocha/api"
|
1
|
+
require 'gem_version_check'
|
2
|
+
require 'mocha/api'
|
5
3
|
|
6
4
|
def lock_file_content(filename)
|
7
5
|
IO.read(File.expand_path("../stubs/#{filename}", __FILE__))
|
@@ -10,6 +8,6 @@ end
|
|
10
8
|
RSpec.configure do |config|
|
11
9
|
config.mock_framework = :mocha
|
12
10
|
config.before do
|
13
|
-
GemVersionCheck.configuration = { :
|
11
|
+
GemVersionCheck.configuration = { github_host: 'github.com', token: 'testtoken' }
|
14
12
|
end
|
15
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_version_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederik Dietz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.6.
|
139
|
+
rubygems_version: 2.6.14
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Check your gem dependencies
|