gem_version_check 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/gem_version_check/cli.rb +4 -0
- data/lib/gem_version_check/project.rb +10 -3
- data/lib/gem_version_check/report.rb +3 -2
- data/lib/gem_version_check/version.rb +1 -1
- data/spec/project_spec.rb +39 -12
- data/spec/report_spec.rb +2 -2
- 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: c03eea86fa0f3b9e3756ce66dd8a772a41a57cff
|
4
|
+
data.tar.gz: c3b3089a5be7c6e47ef5b81fd9ae6ff77b534a15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa06d9b640dfc253f48e6fdb0f0cf72379d855f0490c9b83607f9ba5e4b9466d01e1f651d3e7928c532c2fba93c54bf5208c7e9daca9e79a367b393f836ae70
|
7
|
+
data.tar.gz: 1337d3a96d01edeee344bebb8939e920c8759bf100cc61e240a33a6b2561ac06f9ab2aae239df78f082c2d8580d92e49573971302717ec1a646657e30d555204
|
data/README.md
CHANGED
@@ -28,6 +28,10 @@ Use --only option if you want to specify the list of gems
|
|
28
28
|
|
29
29
|
gem_version_check fdietz/team_dashboard --only activesupport,rspec
|
30
30
|
|
31
|
+
Use --except option if you want to exclude certain gems from the check
|
32
|
+
|
33
|
+
gem_version_check fdietz/team_dashboard --except activesupport,rspec
|
34
|
+
|
31
35
|
Use --output-format if you want different formats
|
32
36
|
|
33
37
|
gem_version_check fdietz/team_dashboard --output-format=json
|
@@ -29,6 +29,10 @@ module GemVersionCheck
|
|
29
29
|
options[:only] = list
|
30
30
|
end
|
31
31
|
|
32
|
+
opts.on("--except gem1,gem2,gem3", Array, "List of ruby gems") do |list|
|
33
|
+
options[:except] = list
|
34
|
+
end
|
35
|
+
|
32
36
|
opts.on("--host github.com", String, "Github host name") do |host|
|
33
37
|
options[:host] = host
|
34
38
|
end
|
@@ -5,9 +5,10 @@ require "net/https"
|
|
5
5
|
module GemVersionCheck
|
6
6
|
class Project
|
7
7
|
|
8
|
-
def initialize(project,
|
8
|
+
def initialize(project, options = {})
|
9
9
|
@project = project
|
10
|
-
@
|
10
|
+
@only = options[:only] || []
|
11
|
+
@except = options[:except] || []
|
11
12
|
end
|
12
13
|
|
13
14
|
def name
|
@@ -66,7 +67,13 @@ module GemVersionCheck
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def spec_names
|
69
|
-
@
|
70
|
+
if @only.any?
|
71
|
+
@only
|
72
|
+
elsif @except.any?
|
73
|
+
all_spec_names - @except
|
74
|
+
else
|
75
|
+
all_spec_names
|
76
|
+
end
|
70
77
|
end
|
71
78
|
|
72
79
|
def all_spec_names
|
@@ -5,12 +5,13 @@ module GemVersionCheck
|
|
5
5
|
@project_names = project_names
|
6
6
|
@options = options
|
7
7
|
@only = options[:only] || []
|
8
|
+
@except = options[:except] || []
|
8
9
|
end
|
9
10
|
|
10
11
|
def generate
|
11
12
|
@check_failed = false
|
12
13
|
@project_names.inject([]) do |result, project_name|
|
13
|
-
project = Project.new(project_name, @only)
|
14
|
+
project = Project.new(project_name, only: @only, except: @except)
|
14
15
|
project.report
|
15
16
|
@check_failed = true if project.check_failed?
|
16
17
|
result << project
|
@@ -22,4 +23,4 @@ module GemVersionCheck
|
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
25
|
-
end
|
26
|
+
end
|
data/spec/project_spec.rb
CHANGED
@@ -6,34 +6,61 @@ module GemVersionCheck
|
|
6
6
|
let(:url) { "https://github.com/toadkicker/teststrap/raw/master/Gemfile.lock" }
|
7
7
|
let(:redirect_url) { "https://raw.github.com/toadkicker/teststrap/master/Gemfile.lock" }
|
8
8
|
let(:lock_file) { Lockfile.new(lock_file_content("rails_app_example.lock")) }
|
9
|
+
let(:options) { {} }
|
9
10
|
let(:project) do
|
10
11
|
Dependency.any_instance.stubs(:latest_version).returns("1.0")
|
11
|
-
project = Project.new("toadkicker/teststrap",
|
12
|
+
project = Project.new("toadkicker/teststrap", options)
|
12
13
|
project.stubs(:lock_file).returns(lock_file)
|
13
14
|
project
|
14
15
|
end
|
15
16
|
|
16
17
|
context "#report" do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
context "with whitelisted gems" do
|
19
|
+
let(:options) { { only: %w(actionpack not_existing) } }
|
20
|
+
|
21
|
+
it "returns array of given dependencies" do
|
22
|
+
project.report.size.should == 2
|
23
|
+
project.report.first.name.should == "actionpack"
|
24
|
+
project.report.last.name.should == "not_existing"
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
context "with blacklisted gems" do
|
29
|
+
let(:options) { { except: %w(actionpack not_existing) } }
|
30
|
+
|
31
|
+
it "returns array of all dependencies except the given ones" do
|
32
|
+
project.report.size.should == 46
|
33
|
+
project.report.map(&:name).should_not include("actionpack")
|
34
|
+
end
|
35
|
+
end
|
27
36
|
|
28
|
-
|
37
|
+
context "without black- or whitelisting" do
|
38
|
+
it "returns array of all dependencies" do
|
39
|
+
project.report.size.should == 47
|
40
|
+
end
|
29
41
|
end
|
30
42
|
end
|
31
43
|
|
32
|
-
|
44
|
+
shared_examples "check_failed" do
|
33
45
|
it "returns true if at least one dependency is not up to date or non existing" do
|
34
46
|
project.check_failed? == true
|
35
47
|
end
|
36
48
|
end
|
37
49
|
|
50
|
+
context "#check_failed?" do
|
51
|
+
context "with whitelisted gems" do
|
52
|
+
let(:options) { { only: "actionpack" } }
|
53
|
+
include_examples "check_failed"
|
54
|
+
end
|
55
|
+
|
56
|
+
context "with blacklisted gems" do
|
57
|
+
let(:options) { { except: "actionpack" } }
|
58
|
+
include_examples "check_failed"
|
59
|
+
end
|
60
|
+
|
61
|
+
context "without black- or whitelisting" do
|
62
|
+
include_examples "check_failed"
|
63
|
+
end
|
64
|
+
end
|
38
65
|
end
|
39
|
-
end
|
66
|
+
end
|
data/spec/report_spec.rb
CHANGED
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederik Dietz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.8
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Check your gem dependencies
|