gemsurance 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gemsurance +2 -26
- data/lib/gemsurance.rb +2 -1
- data/lib/gemsurance/cli.rb +40 -0
- data/lib/gemsurance/gem_info_retriever.rb +14 -4
- data/lib/gemsurance/templates/output.html.erb +24 -0
- data/lib/gemsurance/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1bc4eb78cfaa346bb8b5e3c1396227e9db62a28
|
4
|
+
data.tar.gz: 7e5f0ea26909a7789226282822c80cf79bb32f6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e4ae40728a4dae3f06dcf71d8e6528251af1861bf34ca9695ad8b494827deecee34c5c3089f13e01e99972e6331c7d4c8da0b94182bbb0cb6e44d3622ecf30
|
7
|
+
data.tar.gz: 8678ca329cdaf138d632dfbbcb80be6ec68f6ab66bf33de02cc0c961c76df013b04af4b5416df51df7b3f58a95df9cbbf45abfb3a5b84c2b5e12bbee2145799f
|
data/bin/gemsurance
CHANGED
@@ -1,31 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'gemsurance'
|
4
|
-
require '
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
|
8
|
-
opts = OptionParser.new do |opts|
|
9
|
-
opts.banner = "Usage: gemsurance [options]"
|
10
|
-
|
11
|
-
opts.separator ""
|
12
|
-
opts.separator "Options:"
|
13
|
-
|
14
|
-
opts.on("--pre", "Consider pre-release gem versions") do |lib|
|
15
|
-
options[:pre] = true
|
16
|
-
end
|
17
|
-
|
18
|
-
opts.on_tail("-h", "--help", "Show this help") do
|
19
|
-
puts opts
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
|
23
|
-
opts.on_tail("--version", "Show version") do
|
24
|
-
puts "Gemsurance version #{Gemsurance::VERSION}"
|
25
|
-
exit
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
opts.parse!(ARGV)
|
4
|
+
require 'gemsurance/cli'
|
30
5
|
|
6
|
+
options = Gemsurance::Cli.parse(ARGV)
|
31
7
|
Gemsurance::Runner.new(options).run
|
data/lib/gemsurance.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'git'
|
3
3
|
require 'erb'
|
4
|
+
require 'gems'
|
4
5
|
|
5
6
|
require 'gemsurance/gem_info_retriever'
|
6
7
|
require 'gemsurance/html_formatter'
|
7
8
|
require 'gemsurance/runner'
|
8
9
|
require 'gemsurance/version'
|
9
|
-
require 'gemsurance/vulnerability'
|
10
|
+
require 'gemsurance/vulnerability'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Gemsurance
|
4
|
+
class Cli
|
5
|
+
class << self
|
6
|
+
def parse(*argv)
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
opts = OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: gemsurance [options]"
|
12
|
+
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Options:"
|
15
|
+
|
16
|
+
opts.on("--pre", "Consider pre-release gem versions") do |lib|
|
17
|
+
options[:pre] = true
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("--output FILE", "Output report to given file") do |file|
|
21
|
+
options[:output_file] = file
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on_tail("-h", "--help", "Show this help") do
|
25
|
+
puts opts
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on_tail("--version", "Show version") do
|
30
|
+
puts "Gemsurance version #{Gemsurance::VERSION}"
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.parse!(argv)
|
36
|
+
options
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -5,14 +5,19 @@ module Gemsurance
|
|
5
5
|
STATUS_CURRENT = 'current'
|
6
6
|
STATUS_VULNERABLE = 'vulnerable'
|
7
7
|
|
8
|
-
attr_reader :name, :current_version, :newest_version, :vulnerabilities
|
8
|
+
attr_reader :name, :current_version, :newest_version, :vulnerabilities,
|
9
|
+
:homepage_uri, :source_code_uri, :documentation_uri
|
9
10
|
|
10
|
-
def initialize(name, current_version, newest_version, status = STATUS_CURRENT)
|
11
|
+
def initialize(name, current_version, newest_version, homepage_uri, source_code_uri, documentation_uri, status = STATUS_CURRENT)
|
11
12
|
@name = name
|
12
13
|
@current_version = current_version
|
13
14
|
@newest_version = newest_version
|
15
|
+
@homepage_uri = homepage_uri
|
16
|
+
@documentation_uri = documentation_uri
|
17
|
+
@source_code_uri = source_code_uri
|
14
18
|
@status = status
|
15
19
|
@vulnerabilities = []
|
20
|
+
|
16
21
|
end
|
17
22
|
|
18
23
|
def add_vulnerability!(vulnerability)
|
@@ -62,13 +67,18 @@ module Gemsurance
|
|
62
67
|
gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
|
63
68
|
git_outdated = current_spec.git_version != active_spec.git_version
|
64
69
|
|
70
|
+
info = ::Gems.info(active_spec.name)
|
71
|
+
homepage_uri = info['homepage_uri']
|
72
|
+
documentation_uri = info['documentation_uri']
|
73
|
+
source_code_uri = info['source_code_uri']
|
74
|
+
|
65
75
|
# TODO: handle git versions
|
66
76
|
# spec_version = "#{active_spec.version}#{active_spec.git_version}"
|
67
77
|
# current_version = "#{current_spec.version}#{current_spec.git_version}"
|
68
78
|
if gem_outdated || git_outdated
|
69
|
-
gem_infos << GemInfo.new(active_spec.name, current_spec.version, active_spec.version, GemInfo::STATUS_OUTDATED)
|
79
|
+
gem_infos << GemInfo.new(active_spec.name, current_spec.version, active_spec.version, homepage_uri, documentation_uri, source_code_uri, GemInfo::STATUS_OUTDATED)
|
70
80
|
else
|
71
|
-
gem_infos << GemInfo.new(active_spec.name, current_spec.version, current_spec.version)
|
81
|
+
gem_infos << GemInfo.new(active_spec.name, current_spec.version, current_spec.version, homepage_uri, documentation_uri, source_code_uri)
|
72
82
|
end
|
73
83
|
end
|
74
84
|
gem_infos
|
@@ -734,6 +734,18 @@
|
|
734
734
|
margin: 0 auto;
|
735
735
|
width: 980px;
|
736
736
|
}
|
737
|
+
|
738
|
+
a.link {
|
739
|
+
display: inline-block;
|
740
|
+
width: 16px;
|
741
|
+
height: 16px;
|
742
|
+
}
|
743
|
+
|
744
|
+
/* Images are from http://ionicons.com: home, code, document */
|
745
|
+
a.link.homepage_uri { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAVFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8UXluqAAAAGnRSTlMABANvWfBB4i3SHb4RpwJw7heQ4H+PHOMPH4aZIH0AAAABYktHRBsCYNSkAAAAaUlEQVQY032MWQ6AIAwFQQRXNkHRd/+DqghRYnQ+ms4kLSEfUFp6xVhVhJrz+umiARpxe9vhoGuz9wMiQ3/5KJGQ4+lKmxyMVmewE8Cd48BkVbzxwLwsM+DTUx9X/xN0CDrPyLpta55vdqg9CJWGTyKrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE0LTAyLTE0VDE1OjEzOjM0LTA4OjAwwk+TXgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNC0wMi0xNFQxNToxMzozNC0wODowMLMSK+IAAAAASUVORK5CYII="); }
|
746
|
+
a.link.source_code_uri { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMA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y0wODowMOSFGQoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTQtMDItMTRUMTU6MTk6MzctMDg6MDCV2KG2AAAAAElFTkSuQmCC"); }
|
748
|
+
|
737
749
|
</style>
|
738
750
|
</head>
|
739
751
|
<body>
|
@@ -747,6 +759,7 @@
|
|
747
759
|
<th>Newest Version</th>
|
748
760
|
<th>Status</th>
|
749
761
|
<th>Detailed Status</th>
|
762
|
+
<th>Links</th>
|
750
763
|
</tr>
|
751
764
|
</thead>
|
752
765
|
<tbody>
|
@@ -794,6 +807,17 @@
|
|
794
807
|
<% end %>
|
795
808
|
</div>
|
796
809
|
</td>
|
810
|
+
<td>
|
811
|
+
<% unless gem_info.homepage_uri.to_s.empty? %>
|
812
|
+
<a href="<%= gem_info.homepage_uri %>" target="_blank" class="link homepage_uri" title="Homepage"></a>
|
813
|
+
<% end %>
|
814
|
+
<% unless gem_info.source_code_uri.to_s.empty? %>
|
815
|
+
<a href="<%= gem_info.source_code_uri %>" target="_blank" class="link source_code_uri" title="Source"></a>
|
816
|
+
<% end %>
|
817
|
+
<% unless gem_info.documentation_uri.to_s.empty? %>
|
818
|
+
<a href="<%= gem_info.documentation_uri %>" target="_blank" class="link documentation_uri" title="Docs"></a>
|
819
|
+
<% end %>
|
820
|
+
</td>
|
797
821
|
</tr>
|
798
822
|
<% end %>
|
799
823
|
</tbody>
|
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.2.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: 2014-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gems
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.8'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.8'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: mocha
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,6 +103,7 @@ extra_rdoc_files: []
|
|
89
103
|
files:
|
90
104
|
- bin/gemsurance
|
91
105
|
- lib/gemsurance.rb
|
106
|
+
- lib/gemsurance/cli.rb
|
92
107
|
- lib/gemsurance/gem_info_retriever.rb
|
93
108
|
- lib/gemsurance/html_formatter.rb
|
94
109
|
- lib/gemsurance/runner.rb
|