license_finder 0.4.1 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/.rspec +1 -0
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.markdown +125 -75
- data/Rakefile +9 -0
- data/features/rake_tasks/action_items.feature +13 -0
- data/features/rake_tasks/action_items_ok.feature +20 -0
- data/features/rake_tasks/generate_dependencies.feature +31 -0
- data/features/rake_tasks/init.feature +19 -0
- data/features/step_definitions/steps.rb +131 -0
- data/files/license_finder.yml +3 -2
- data/lib/license_finder.rb +29 -0
- data/lib/license_finder/dependency.rb +13 -14
- data/lib/license_finder/dependency_list.rb +23 -5
- data/lib/license_finder/finder.rb +6 -19
- data/lib/license_finder/gem_spec_details.rb +11 -3
- data/lib/license_finder/license_file.rb +21 -7
- data/lib/templates/ISC-body +2 -0
- data/lib/templates/LGPL-body +165 -0
- data/license_finder.gemspec +11 -16
- data/spec/fixtures/ISC-LICENSE +10 -0
- data/spec/fixtures/isc_licensed_gem/LICENSE +10 -0
- data/spec/fixtures/lgpl_licensed_gem/LICENSE +165 -0
- data/spec/{dependency_list_spec.rb → lib/license_finder/dependency_list_spec.rb} +26 -23
- data/spec/lib/license_finder/dependency_spec.rb +53 -0
- data/spec/{file_parser_spec.rb → lib/license_finder/file_parser_spec.rb} +0 -0
- data/spec/lib/license_finder/finder_spec.rb +36 -0
- data/spec/{gem_spec_details_spec.rb → lib/license_finder/gem_spec_details_spec.rb} +25 -8
- data/spec/{license_file_spec.rb → lib/license_finder/license_file_spec.rb} +38 -22
- data/spec/lib/license_finder_spec.rb +82 -0
- metadata +100 -32
- data/lib/license_finder/version.rb +0 -3
- data/spec/dependency_spec.rb +0 -57
- data/spec/finder_spec.rb +0 -64
data/spec/dependency_spec.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class LicenseFinder::MockGemSpec3
|
4
|
-
def initialize(path = nil)
|
5
|
-
@path = path
|
6
|
-
end
|
7
|
-
|
8
|
-
def name
|
9
|
-
'spec_name'
|
10
|
-
end
|
11
|
-
|
12
|
-
def version
|
13
|
-
'2.1.3'
|
14
|
-
end
|
15
|
-
|
16
|
-
def full_gem_path
|
17
|
-
@path || 'install/path'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
#--
|
22
|
-
# name: activerecord
|
23
|
-
# version: 3.0.5
|
24
|
-
# license: MIT
|
25
|
-
# approved: true
|
26
|
-
# license_url: http://foo.com/README
|
27
|
-
# notes: some notes
|
28
|
-
# license_files:
|
29
|
-
# - path: /Users/pivotal/foo/lic1
|
30
|
-
# - path: /Users/pivotal/bar/lic2
|
31
|
-
# readme_files:
|
32
|
-
# - path: /Users/pivotal/foo/Readme1
|
33
|
-
# - path: /Users/pivotal/bar/Readme2
|
34
|
-
|
35
|
-
describe LicenseFinder::Dependency do
|
36
|
-
|
37
|
-
describe 'from hash' do
|
38
|
-
subject { LicenseFinder::Dependency.from_hash({'name' => "spec_name", 'version' => "2.1.3", 'license' => "MIT", 'approved' => false,
|
39
|
-
'license_url' => 'http://www.apache.org/licenses/LICENSE-2.0.html', 'notes' => 'some notes',
|
40
|
-
'license_files' => [{'path' => '/Users/pivotal/foo/lic1'}, {'path' => '/Users/pivotal/bar/lic2'}],
|
41
|
-
'readme_files' => [{'path' => '/Users/pivotal/foo/Readme1'}, {'path' => '/Users/pivotal/bar/Readme2'}]}) }
|
42
|
-
|
43
|
-
its(:name) { should == 'spec_name' }
|
44
|
-
its(:version) { should == '2.1.3' }
|
45
|
-
its(:license) { should == 'MIT' }
|
46
|
-
its(:approved) { should == false }
|
47
|
-
its(:license_url) { should == "http://www.apache.org/licenses/LICENSE-2.0.html" }
|
48
|
-
its(:notes) { should == "some notes" }
|
49
|
-
its(:license_files) { should == ["/Users/pivotal/foo/lic1", "/Users/pivotal/bar/lic2"] }
|
50
|
-
its(:readme_files) { should == ["/Users/pivotal/foo/Readme1", "/Users/pivotal/bar/Readme2"] }
|
51
|
-
|
52
|
-
its(:to_yaml_entry) {should == "- name: \"spec_name\"\n version: \"2.1.3\"\n license: \"MIT\"\n approved: false\n license_url: \"http://www.apache.org/licenses/LICENSE-2.0.html\"\n notes: \"some notes\"\n license_files:\n - path: \"/Users/pivotal/foo/lic1\"\n - path: \"/Users/pivotal/bar/lic2\"\n readme_files:\n - path: \"/Users/pivotal/foo/Readme1\"\n - path: \"/Users/pivotal/bar/Readme2\"\n"}
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
|
data/spec/finder_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe LicenseFinder::Finder do
|
4
|
-
|
5
|
-
it "should properly initialize whitelist and ignore_groups" do
|
6
|
-
stub(File).exists?('./config/license_finder.yml') {false}
|
7
|
-
finder = LicenseFinder::Finder.new
|
8
|
-
finder.whitelist.should_not be_nil
|
9
|
-
finder.ignore_groups.should_not be_nil
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should generate a yml file and txt file" do
|
13
|
-
stub(File).exists?('./config/license_finder.yml') {false}
|
14
|
-
stub(File).exists?('./dependencies.yml') {false}
|
15
|
-
|
16
|
-
yml_output = StringIO.new
|
17
|
-
txt_output = StringIO.new
|
18
|
-
stub(File).open('./dependencies.yml', 'w+').yields(yml_output)
|
19
|
-
stub(File).open('./dependencies.txt', 'w+').yields(txt_output)
|
20
|
-
stub(LicenseFinder::DependencyList).from_bundler.stub!.to_yaml {"output"}
|
21
|
-
LicenseFinder::Finder.new.write_files
|
22
|
-
yml_output.string.should == "output\n"
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should update an existing yml file' do
|
26
|
-
stub(File).exists?('./config/license_finder.yml') {false}
|
27
|
-
stub(File).exists?('./dependencies.yml') {true}
|
28
|
-
|
29
|
-
yml_output = StringIO.new
|
30
|
-
txt_output = StringIO.new
|
31
|
-
stub(File).open('./dependencies.yml').stub!.readlines {['existing yml']}
|
32
|
-
stub(File).open('./dependencies.yml', 'w+').yields(yml_output)
|
33
|
-
stub(File).open('./dependencies.txt', 'w+').yields(txt_output)
|
34
|
-
|
35
|
-
stub(LicenseFinder::DependencyList).from_yaml.stub!.merge.stub!.to_yaml {"output"}
|
36
|
-
stub(LicenseFinder::DependencyList).from_bundler
|
37
|
-
LicenseFinder::Finder.new.write_files
|
38
|
-
yml_output.string.should == "output\n"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should load a whitelist from license_finder.yml" do
|
42
|
-
stub(File).exists?('./config/license_finder.yml') {true}
|
43
|
-
stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \n- MIT\n- Apache\nignore_groups: \n- test\n- development\n"}
|
44
|
-
LicenseFinder::Finder.new.whitelist.should =~ ['MIT', 'Apache']
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should load an empty whitelist from license_finder.yml when there are no whitelist items" do
|
48
|
-
stub(File).exists?('./config/license_finder.yml') {true}
|
49
|
-
stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \nignore_groups: \n- test\n- development\n"}
|
50
|
-
LicenseFinder::Finder.new.whitelist.should =~ []
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should load a ignore_groups list from license_finder.yml" do
|
54
|
-
stub(File).exists?('./config/license_finder.yml') {true}
|
55
|
-
stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \n- MIT\n- Apache\nignore_groups: \n- test\n- development\n"}
|
56
|
-
LicenseFinder::Finder.new.ignore_groups.should == [:test, :development]
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should load an empty ignore_groups list from license_finder.yml when there are no ignore groups" do
|
60
|
-
stub(File).exists?('./config/license_finder.yml') {true}
|
61
|
-
stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join {"--- \nwhitelist: \n- MIT\n- Apache\nignore_groups:"}
|
62
|
-
LicenseFinder::Finder.new.ignore_groups.should == []
|
63
|
-
end
|
64
|
-
end
|