dependency-timeline-audit 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4fb437a64c2b990372ff5137b6deb79d5405f5522e81b02830108cc43596155
|
4
|
+
data.tar.gz: 9edf8bfe737bb3991802e93c01d272aa786b4bd1dd8a6733c6de17099175b013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e19239773413b37e23d54c21dd22cbbc65f65102f778d5437676da683fb76a202bf197f7b01e6ce874f8ce6761e53ccd7d9e2d9985a4096d46e9a86ae63e769
|
7
|
+
data.tar.gz: e52bc4921722fc2be009aed94f7009917d4034ccc48c4f130c4fac5651af46e482d58765fd0171c87ecdd2abb2431d479926de3be4b6dc9d8c08684cabf37374
|
@@ -1,5 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'dependency-timeline-audit'
|
4
|
+
require 'optparse'
|
4
5
|
|
5
|
-
|
6
|
+
# See: https://docs.ruby-lang.org/en/master/OptionParser.html
|
7
|
+
|
8
|
+
begin
|
9
|
+
options = {}
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: dependency-timeline-audit [options]\n"
|
12
|
+
|
13
|
+
opts.on('-i', '--interactive-ignore', 'Allows interactively generating an ignore file')
|
14
|
+
opts.on('-v', '--verbose', 'Provides more verbose output')
|
15
|
+
opts.on('--lockfile=LOCKFILE', 'Allows overwriting where the lockfile is located (default: "Gemfile.lock")')
|
16
|
+
opts.on('--outdated-threshold=YEARS', Integer, 'Allows overwriting the number of years before a gem is considered outdated (default: 1)')
|
17
|
+
opts.on_tail('-h', '--help', 'Prints this help') do
|
18
|
+
puts opts
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
opts.on('-V', '--version', 'Prints the version of dependency-timeline-audit') do
|
22
|
+
puts "Dependency Timeline Audit (Ruby) - version: #{DependencyTimelineAudit.gem_version}"
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end.parse!(into: options)
|
26
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
27
|
+
puts e.message
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
DependencyTimelineAudit::Check.check(
|
32
|
+
lockfile: options[:lockfile],
|
33
|
+
verbose: options[:verbose]
|
34
|
+
)
|
@@ -8,24 +8,26 @@ module DependencyTimelineAudit
|
|
8
8
|
1.year.ago
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.check(lockfile
|
11
|
+
def self.check(lockfile: 'Gemfile.lock', verbose: true)
|
12
12
|
outdated_versions = []
|
13
13
|
locked_gems.each do |gem|
|
14
14
|
lock_released_at = GemInfo.version_created_at(gem[:name], gem[:locked_version])
|
15
15
|
latest_version = GemInfo.latest_version(gem[:name])
|
16
16
|
outdated_versions.push(gem[:name]) if gem_outdated?(lock_released_at)
|
17
|
-
print_info(gem, lock_released_at, latest_version)
|
17
|
+
print_info(gem, lock_released_at, latest_version) if verbose
|
18
18
|
end
|
19
19
|
|
20
|
+
print "\n" if verbose
|
21
|
+
|
20
22
|
if outdated_versions.any?
|
21
23
|
set_text_color_red
|
22
|
-
puts "
|
24
|
+
puts "Outdated gems detected!"
|
23
25
|
puts " - #{outdated_versions.join(', ')}"
|
24
26
|
|
25
27
|
exit(1) # Failure
|
26
28
|
else
|
27
29
|
reset_text_style
|
28
|
-
puts "
|
30
|
+
puts "All gems are within the accepted threshold!"
|
29
31
|
|
30
32
|
exit(0) # Success
|
31
33
|
end
|
@@ -35,7 +35,7 @@ module DependencyTimelineAudit
|
|
35
35
|
# Find the version that matches the requested version string
|
36
36
|
version_info = versions.find { |v| v['number'] == version }
|
37
37
|
|
38
|
-
version_info['created_at']
|
38
|
+
version_info.present? ? version_info['created_at'] : nil
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependency-timeline-audit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|