gemsurance 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemsurance.rb +3 -1
- data/lib/gemsurance/cli.rb +4 -0
- data/lib/gemsurance/formatters/base.rb +17 -0
- data/lib/gemsurance/formatters/html.rb +10 -0
- data/lib/gemsurance/formatters/yml.rb +10 -0
- data/lib/gemsurance/runner.rb +2 -2
- data/lib/gemsurance/templates/output.html.erb +1 -1
- data/lib/gemsurance/templates/output.yml.erb +25 -0
- data/lib/gemsurance/version.rb +1 -1
- metadata +6 -3
- data/lib/gemsurance/html_formatter.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5e6c4788cfdee5596726a63e3754436543e10d
|
4
|
+
data.tar.gz: 369e502b049c24f560bae6b9e958a625962589ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354aac34c082b8d85e4f344e9fb46eb99d747a8b6a5a9527961cc51e70a2171d1000a7b91a41b9d31022cba9f069464e23b21efbbf7c0a8e2104279eb9203026
|
7
|
+
data.tar.gz: bc326cda646e12e6bf041091f44ed15d034b16fdef2c5af88c7b037c25603db5933e1e97cba5e977e515426dc6908897a34eb1183f70ac75e0b2d1304cf49895
|
data/lib/gemsurance.rb
CHANGED
@@ -4,7 +4,9 @@ require 'erb'
|
|
4
4
|
require 'gems'
|
5
5
|
|
6
6
|
require 'gemsurance/gem_info_retriever'
|
7
|
-
require 'gemsurance/
|
7
|
+
require 'gemsurance/formatters/base'
|
8
|
+
require 'gemsurance/formatters/html'
|
9
|
+
require 'gemsurance/formatters/yml'
|
8
10
|
require 'gemsurance/runner'
|
9
11
|
require 'gemsurance/version'
|
10
12
|
require 'gemsurance/vulnerability'
|
data/lib/gemsurance/cli.rb
CHANGED
@@ -21,6 +21,10 @@ module Gemsurance
|
|
21
21
|
options[:output_file] = file
|
22
22
|
end
|
23
23
|
|
24
|
+
opts.on("--format FORMAT", "Output report to given format (html & yml available). Html by default.") do |format|
|
25
|
+
options[:formatter] = format
|
26
|
+
end
|
27
|
+
|
24
28
|
opts.on_tail("-h", "--help", "Show this help") do
|
25
29
|
puts opts
|
26
30
|
exit
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Gemsurance
|
2
|
+
module Formatters
|
3
|
+
class Base
|
4
|
+
def initialize(gem_infos)
|
5
|
+
@gem_infos = gem_infos
|
6
|
+
end
|
7
|
+
|
8
|
+
def output_path
|
9
|
+
File.join(File.dirname(__FILE__), "../templates/output.#{@extension}.erb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def sorted_gems
|
13
|
+
@gem_infos.sort{ |a, b| a.name.downcase <=> b.name.downcase }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/gemsurance/runner.rb
CHANGED
@@ -2,7 +2,7 @@ module Gemsurance
|
|
2
2
|
class Runner
|
3
3
|
def initialize(options = {})
|
4
4
|
@formatter = options.delete(:formatter) || :html
|
5
|
-
@output_file = options.delete(:output_file) ||
|
5
|
+
@output_file = options.delete(:output_file) || "gemsurance_report.#{@formatter}"
|
6
6
|
@options = options
|
7
7
|
end
|
8
8
|
|
@@ -69,7 +69,7 @@ module Gemsurance
|
|
69
69
|
|
70
70
|
def generate_report(gem_infos)
|
71
71
|
puts "Generating report..."
|
72
|
-
output_data = Gemsurance.const_get(:"#{@formatter.to_s.capitalize}
|
72
|
+
output_data = Gemsurance::Formatters.const_get(:"#{@formatter.to_s.capitalize}").new(gem_infos).format
|
73
73
|
|
74
74
|
File.open(@output_file, "w+") do |file|
|
75
75
|
file.puts output_data
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- sorted_gems.each do |gem_info| -%>
|
2
|
+
<%= gem_info.name %>:
|
3
|
+
in_gem_file: <%= gem_info.in_gem_file %>
|
4
|
+
bundle_version: <%= gem_info.current_version %>
|
5
|
+
newest_version: <%= gem_info.newest_version %>
|
6
|
+
<%- if gem_info.vulnerable? -%>
|
7
|
+
status: vulnerable
|
8
|
+
<%- elsif gem_info.outdated? -%>
|
9
|
+
status: outofdate
|
10
|
+
<%- elsif gem_info.current? -%>
|
11
|
+
status: uptodate
|
12
|
+
<%- else -%>
|
13
|
+
status: unknown
|
14
|
+
<%- end -%>
|
15
|
+
vulnerabilities:
|
16
|
+
<%- gem_info.vulnerabilities.each do |vulnerability| -%>
|
17
|
+
- title: '<%= vulnerability.title %>'
|
18
|
+
cve: <%= vulnerability.cve %>
|
19
|
+
url: <%= vulnerability.url %>
|
20
|
+
patched_versions: <%= (vulnerability.patched_versions || []).join(', ') %>
|
21
|
+
<%- end -%>
|
22
|
+
homepage_url: <%= gem_info.homepage_uri %>
|
23
|
+
source_code_url: <%= gem_info.source_code_uri %>
|
24
|
+
documentation_url: <%= gem_info.documentation_uri %>
|
25
|
+
<%- end -%>
|
data/lib/gemsurance/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemsurance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Kessler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,10 +104,13 @@ files:
|
|
104
104
|
- bin/gemsurance
|
105
105
|
- lib/gemsurance.rb
|
106
106
|
- lib/gemsurance/cli.rb
|
107
|
+
- lib/gemsurance/formatters/base.rb
|
108
|
+
- lib/gemsurance/formatters/html.rb
|
109
|
+
- lib/gemsurance/formatters/yml.rb
|
107
110
|
- lib/gemsurance/gem_info_retriever.rb
|
108
|
-
- lib/gemsurance/html_formatter.rb
|
109
111
|
- lib/gemsurance/runner.rb
|
110
112
|
- lib/gemsurance/templates/output.html.erb
|
113
|
+
- lib/gemsurance/templates/output.yml.erb
|
111
114
|
- lib/gemsurance/version.rb
|
112
115
|
- lib/gemsurance/vulnerability.rb
|
113
116
|
homepage: http://github.com/appfolio/gemsurance
|