deriving_license 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/README.md +3 -1
- data/bin/deriving_license +1 -1
- data/deriving_license.gemspec +1 -1
- data/lib/deriving_license.rb +5 -0
- data/test/requires_scraping_but_invalid_homepage.gemfile +3 -0
- data/test/test_deriving_license.rb +33 -1
- metadata +4 -1
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -9,6 +9,8 @@ Strategies:
|
|
9
9
|
* from\_scraping\_homepage
|
10
10
|
* from\_parsing\_readme
|
11
11
|
|
12
|
+
[![Build Status](https://travis-ci.org/Schwolop/deriving_license.png)](https://travis-ci.org/Schwolop/deriving_license)
|
13
|
+
|
12
14
|
Example output:
|
13
15
|
|
14
16
|
$ deriving_license ~/Code/rails_sample_app/Gemfile
|
@@ -34,4 +36,4 @@ Example output:
|
|
34
36
|
Ruby: Ruby License (6 instances)[http://www.ruby-lang.org/en/about/license.txt]
|
35
37
|
BSD: FreeBSD Copyright (2 instances)[http://www.freebsd.org/copyright/freebsd-license.html]
|
36
38
|
GPL: GNU General Public License (2 instances)[http://en.wikipedia.org/wiki/GNU_General_Public_License]
|
37
|
-
The following dependencies have custom licenses: adt, bcrypt-ruby, bootstrap-sass, rack-protection,
|
39
|
+
The following dependencies have custom licenses: adt, bcrypt-ruby, bootstrap-sass, rack-protection, sqlite3
|
data/bin/deriving_license
CHANGED
data/deriving_license.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'deriving_license'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.9'
|
4
4
|
s.summary = "Deriving Licence finds the license agreements for all gems in your Gemfile"
|
5
5
|
s.description = "Deriving Licence finds the license agreements for all gems in your Gemfile if included in your project, or in a Gemfile passed to the included binary"
|
6
6
|
s.authors = ["Tom Allen"]
|
data/lib/deriving_license.rb
CHANGED
@@ -57,6 +57,11 @@ class DerivingLicense
|
|
57
57
|
raise "Invalid path to gemfile or gemspec."
|
58
58
|
end
|
59
59
|
|
60
|
+
strategies.each do |s|
|
61
|
+
unless @strategies.include?(s)
|
62
|
+
raise "Supplied strategies must be from the following list: [#{@strategies.join(', ')}]"
|
63
|
+
end
|
64
|
+
end unless strategies.nil?
|
60
65
|
available_strategies = strategies.nil? ? @strategies : strategies
|
61
66
|
|
62
67
|
if /(gemspec)+/.match(path.downcase)
|
@@ -40,7 +40,7 @@ class DerivingLicenseTest < Test::Unit::TestCase
|
|
40
40
|
assert_equal( true, DerivingLicense.run("./test/empty.gemfile").empty? )
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def test_run_with_valid_gemfile_arg
|
44
44
|
assert_nothing_raised do
|
45
45
|
output = capture_stdout do
|
46
46
|
@result = DerivingLicense.run("Gemfile")
|
@@ -49,6 +49,23 @@ class DerivingLicenseTest < Test::Unit::TestCase
|
|
49
49
|
assert_equal( true, @result.has_key?("MIT") )
|
50
50
|
end
|
51
51
|
|
52
|
+
def test_run_with_valid_gemspec_arg
|
53
|
+
assert_nothing_raised do
|
54
|
+
output = capture_stdout do
|
55
|
+
@result = DerivingLicense.run("deriving_license.gemspec")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
assert_equal( true, @result.has_key?("MIT") )
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_run_with_non_existant_strategies
|
62
|
+
assert_raise RuntimeError do
|
63
|
+
output = capture_stdout do
|
64
|
+
DerivingLicense.run("Gemfile", ["cheese_strategy"])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
52
69
|
def test_describe_with_known_license
|
53
70
|
output = capture_stdout do
|
54
71
|
DerivingLicense.describe({"MIT" => 1})
|
@@ -66,6 +83,13 @@ class DerivingLicenseTest < Test::Unit::TestCase
|
|
66
83
|
assert_equal( false, /unrecognized/.match( output.string ).nil? )
|
67
84
|
end
|
68
85
|
|
86
|
+
def test_describe_with_custom_license
|
87
|
+
output = capture_stdout do
|
88
|
+
DerivingLicense.describe( {"custom" => ["fake-gem"]} )
|
89
|
+
end
|
90
|
+
assert_equal( false, /have custom license/i.match( output.string ).nil? )
|
91
|
+
end
|
92
|
+
|
69
93
|
def test_from_scraping_strategy
|
70
94
|
output = capture_stdout do
|
71
95
|
@result = DerivingLicense.run("./test/requires_scraping.gemfile", ["from_scraping_homepage"])
|
@@ -73,6 +97,14 @@ class DerivingLicenseTest < Test::Unit::TestCase
|
|
73
97
|
assert_equal( false, @result.empty? )
|
74
98
|
assert_equal( false, /from_scraping_homepage strategy...SUCCESS/.match( output.string ).nil? ) # Should be SUCCESS
|
75
99
|
end
|
100
|
+
|
101
|
+
def test_from_scraping_strategy_with_invalid_homepage
|
102
|
+
output = capture_stdout do
|
103
|
+
@result = DerivingLicense.run("./test/requires_scraping_but_invalid_homepage.gemfile", ["from_scraping_homepage"])
|
104
|
+
end
|
105
|
+
assert_equal( true, @result.empty? )
|
106
|
+
assert_equal( false, /from_scraping_homepage strategy...FAILED/.match( output.string ).nil? ) # Should be FAILED
|
107
|
+
end
|
76
108
|
|
77
109
|
def test_from_license_filename
|
78
110
|
output = capture_stdout do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deriving_license
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -84,6 +84,7 @@ extensions: []
|
|
84
84
|
extra_rdoc_files: []
|
85
85
|
files:
|
86
86
|
- .gitignore
|
87
|
+
- .travis.yml
|
87
88
|
- Gemfile
|
88
89
|
- LICENSE
|
89
90
|
- README.md
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- test/requires_license_filename.gemfile
|
98
99
|
- test/requires_readme_file_parsing.gemfile
|
99
100
|
- test/requires_scraping.gemfile
|
101
|
+
- test/requires_scraping_but_invalid_homepage.gemfile
|
100
102
|
- test/test_deriving_license.rb
|
101
103
|
homepage: http://www.github.com/Schwolop/deriving_license
|
102
104
|
licenses:
|
@@ -130,5 +132,6 @@ test_files:
|
|
130
132
|
- test/requires_license_filename.gemfile
|
131
133
|
- test/requires_readme_file_parsing.gemfile
|
132
134
|
- test/requires_scraping.gemfile
|
135
|
+
- test/requires_scraping_but_invalid_homepage.gemfile
|
133
136
|
- test/test_deriving_license.rb
|
134
137
|
has_rdoc:
|