license_finder 0.8.0-java

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.
Files changed (128) hide show
  1. data/.gitignore +12 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +15 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +22 -0
  6. data/Rakefile +21 -0
  7. data/bin/license_finder +54 -0
  8. data/db/migrate/201303290935_create_dependencies.rb +14 -0
  9. data/db/migrate/201303291155_create_licenses.rb +13 -0
  10. data/db/migrate/201303291402_create_approvals.rb +13 -0
  11. data/db/migrate/201303291456_create_ancestries.rb +9 -0
  12. data/db/migrate/201303291519_create_bundler_groups.rb +13 -0
  13. data/db/migrate/201303291720_move_manual_from_approvals_to_licenses.rb +11 -0
  14. data/db/migrate/201303291753_allow_null_license_names.rb +7 -0
  15. data/db/migrate/201304011027_allow_null_dependency_version.rb +7 -0
  16. data/db/migrate/201304020947_change_table_name_licenses_to_license_aliases.rb +5 -0
  17. data/features/approve_dependencies.feature +14 -0
  18. data/features/html_report.feature +38 -0
  19. data/features/ignore_bundle_groups.feature +11 -0
  20. data/features/license_finder.feature +47 -0
  21. data/features/license_finder_rake_task.feature +37 -0
  22. data/features/rails_rake.feature +9 -0
  23. data/features/set_license.feature +12 -0
  24. data/features/step_definitions/license_finder_steps.rb +25 -0
  25. data/features/step_definitions/steps.rb +376 -0
  26. data/features/text_report.feature +27 -0
  27. data/features/whitelist.feature +24 -0
  28. data/files/license_finder.yml +8 -0
  29. data/lib/data/licenses/Apache2.txt +172 -0
  30. data/lib/data/licenses/BSD.txt +24 -0
  31. data/lib/data/licenses/GPLv2.txt +339 -0
  32. data/lib/data/licenses/ISC.txt +2 -0
  33. data/lib/data/licenses/LGPL.txt +165 -0
  34. data/lib/data/licenses/MIT.txt +9 -0
  35. data/lib/data/licenses/NewBSD.txt +21 -0
  36. data/lib/data/licenses/Ruby.txt +52 -0
  37. data/lib/data/licenses/SimplifiedBSD.txt +23 -0
  38. data/lib/license_finder.rb +47 -0
  39. data/lib/license_finder/bundle.rb +48 -0
  40. data/lib/license_finder/bundle_syncer.rb +11 -0
  41. data/lib/license_finder/bundled_gem.rb +48 -0
  42. data/lib/license_finder/cli.rb +49 -0
  43. data/lib/license_finder/configuration.rb +71 -0
  44. data/lib/license_finder/dependency_report.rb +30 -0
  45. data/lib/license_finder/gem_saver.rb +69 -0
  46. data/lib/license_finder/html_report.rb +14 -0
  47. data/lib/license_finder/license.rb +90 -0
  48. data/lib/license_finder/license/apache2.rb +8 -0
  49. data/lib/license_finder/license/bsd.rb +4 -0
  50. data/lib/license_finder/license/gplv2.rb +4 -0
  51. data/lib/license_finder/license/isc.rb +3 -0
  52. data/lib/license_finder/license/lgpl.rb +3 -0
  53. data/lib/license_finder/license/mit.rb +23 -0
  54. data/lib/license_finder/license/new_bsd.rb +8 -0
  55. data/lib/license_finder/license/ruby.rb +11 -0
  56. data/lib/license_finder/license/simplified_bsd.rb +8 -0
  57. data/lib/license_finder/license_files.rb +36 -0
  58. data/lib/license_finder/license_url.rb +12 -0
  59. data/lib/license_finder/platform.rb +32 -0
  60. data/lib/license_finder/possible_license_file.rb +32 -0
  61. data/lib/license_finder/railtie.rb +7 -0
  62. data/lib/license_finder/reporter.rb +20 -0
  63. data/lib/license_finder/tables.rb +7 -0
  64. data/lib/license_finder/tables/approval.rb +4 -0
  65. data/lib/license_finder/tables/bundler_group.rb +4 -0
  66. data/lib/license_finder/tables/dependency.rb +31 -0
  67. data/lib/license_finder/tables/license_alias.rb +22 -0
  68. data/lib/license_finder/text_report.rb +9 -0
  69. data/lib/license_finder/yml_to_sql.rb +127 -0
  70. data/lib/tasks/license_finder.rake +7 -0
  71. data/lib/templates/html_report.erb +111 -0
  72. data/lib/templates/text_report.erb +3 -0
  73. data/license_finder.gemspec +36 -0
  74. data/readme.md +115 -0
  75. data/spec/fixtures/APACHE-2-LICENSE +202 -0
  76. data/spec/fixtures/GPLv2 +339 -0
  77. data/spec/fixtures/ISC-LICENSE +10 -0
  78. data/spec/fixtures/MIT-LICENSE +22 -0
  79. data/spec/fixtures/MIT-LICENSE-with-varied-disclaimer +22 -0
  80. data/spec/fixtures/README-with-MIT-LICENSE +222 -0
  81. data/spec/fixtures/license_directory/COPYING +0 -0
  82. data/spec/fixtures/license_directory/LICENSE/BSD-2-Clause.txt +25 -0
  83. data/spec/fixtures/license_directory/LICENSE/GPL-2.0.txt +339 -0
  84. data/spec/fixtures/license_directory/LICENSE/LICENSE +191 -0
  85. data/spec/fixtures/license_directory/LICENSE/MIT.txt +21 -0
  86. data/spec/fixtures/license_directory/LICENSE/RUBY.txt +60 -0
  87. data/spec/fixtures/license_names/COPYING.txt +0 -0
  88. data/spec/fixtures/license_names/LICENSE +0 -0
  89. data/spec/fixtures/license_names/Licence.rdoc +0 -0
  90. data/spec/fixtures/license_names/Mit-License +0 -0
  91. data/spec/fixtures/license_names/README.rdoc +0 -0
  92. data/spec/fixtures/mit_licensed_gem/LICENSE +22 -0
  93. data/spec/fixtures/nested_gem/vendor/LICENSE +0 -0
  94. data/spec/fixtures/nested_readme/vendor/README +0 -0
  95. data/spec/fixtures/other_licensed_gem/LICENSE +3 -0
  96. data/spec/fixtures/readme/Project ReadMe b/data/spec/fixtures/readme/Project → ReadMe +0 -0
  97. data/spec/fixtures/readme/README +0 -0
  98. data/spec/fixtures/readme/Readme.markdown +0 -0
  99. data/spec/fixtures/utf8_gem/README +210 -0
  100. data/spec/lib/license_finder/bundle_spec.rb +61 -0
  101. data/spec/lib/license_finder/bundle_syncer_spec.rb +16 -0
  102. data/spec/lib/license_finder/bundled_gem_spec.rb +62 -0
  103. data/spec/lib/license_finder/cli_spec.rb +38 -0
  104. data/spec/lib/license_finder/configuration_spec.rb +70 -0
  105. data/spec/lib/license_finder/gem_saver_spec.rb +155 -0
  106. data/spec/lib/license_finder/html_report_spec.rb +84 -0
  107. data/spec/lib/license_finder/license/apache_spec.rb +7 -0
  108. data/spec/lib/license_finder/license/bsd_spec.rb +41 -0
  109. data/spec/lib/license_finder/license/gplv2_spec.rb +7 -0
  110. data/spec/lib/license_finder/license/isc_spec.rb +7 -0
  111. data/spec/lib/license_finder/license/lgpl_spec.rb +7 -0
  112. data/spec/lib/license_finder/license/mit_spec.rb +33 -0
  113. data/spec/lib/license_finder/license/new_bsd_spec.rb +35 -0
  114. data/spec/lib/license_finder/license/ruby_spec.rb +19 -0
  115. data/spec/lib/license_finder/license/simplified_bsd_spec.rb +7 -0
  116. data/spec/lib/license_finder/license_files_spec.rb +50 -0
  117. data/spec/lib/license_finder/license_spec.rb +45 -0
  118. data/spec/lib/license_finder/license_url_spec.rb +20 -0
  119. data/spec/lib/license_finder/possible_license_file_spec.rb +37 -0
  120. data/spec/lib/license_finder/reporter_spec.rb +4 -0
  121. data/spec/lib/license_finder/tables/dependency_spec.rb +102 -0
  122. data/spec/lib/license_finder/tables/license_alias_spec.rb +54 -0
  123. data/spec/lib/license_finder/text_report_spec.rb +31 -0
  124. data/spec/lib/license_finder/yml_to_sql_spec.rb +99 -0
  125. data/spec/lib/license_finder_spec.rb +82 -0
  126. data/spec/spec_helper.rb +31 -0
  127. data/spec/support/license_examples.rb +30 -0
  128. metadata +435 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
@@ -0,0 +1,60 @@
1
+ The Ruby License
2
+
3
+ Ruby is copyrighted free software by <COPYRIGHT HOLDER>.
4
+ You can redistribute it and/or modify it under either the terms of the GPL
5
+ (see COPYING.txt file), or the conditions below:
6
+
7
+ 1. You may make and give away verbatim copies of the source form of the
8
+ software without restriction, provided that you duplicate all of the
9
+ original copyright notices and associated disclaimers.
10
+
11
+ 2. You may modify your copy of the software in any way, provided that
12
+ you do at least ONE of the following:
13
+
14
+ a) place your modifications in the Public Domain or otherwise
15
+ make them Freely Available, such as by posting said
16
+ modifications to Usenet or an equivalent medium, or by allowing
17
+ the author to include your modifications in the software.
18
+
19
+ b) use the modified software only within your corporation or
20
+ organization.
21
+
22
+ c) rename any non-standard executables so the names do not conflict
23
+ with standard executables, which must also be provided.
24
+
25
+ d) make other distribution arrangements with the author.
26
+
27
+ 3. You may distribute the software in object code or executable
28
+ form, provided that you do at least ONE of the following:
29
+
30
+ a) distribute the executables and library files of the software,
31
+ together with instructions (in the manual page or equivalent)
32
+ on where to get the original distribution.
33
+
34
+ b) accompany the distribution with the machine-readable source of
35
+ the software.
36
+
37
+ c) give non-standard executables non-standard names, with
38
+ instructions on where to get the original software distribution.
39
+
40
+ d) make other distribution arrangements with the author.
41
+
42
+ 4. You may modify and include the part of the software into any other
43
+ software (possibly commercial). But some files in the distribution
44
+ are not written by the author, so that they are not under this terms.
45
+
46
+ They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
47
+ files under the ./missing directory. See each file for the copying
48
+ condition.
49
+
50
+ 5. The scripts and library files supplied as input to or produced as
51
+ output from the software do not automatically fall under the
52
+ copyright of the software, but belong to whomever generated them,
53
+ and may be sold commercially, and may be aggregated with this
54
+ software.
55
+
56
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
+ PURPOSE.
60
+
File without changes
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Jacob Maine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
@@ -0,0 +1,3 @@
1
+ MY RANDOM LICENSE
2
+
3
+ Gimme your money
File without changes
File without changes
@@ -0,0 +1,210 @@
1
+ = Project: Builder
2
+
3
+ == Goal
4
+
5
+ Provide a simple way to create XML markup and data structures.
6
+
7
+ == Classes
8
+
9
+ Builder::XmlMarkup:: Generate XML markup notiation
10
+ Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
11
+
12
+ <b>Notes</b>::
13
+
14
+ * An <tt>Builder::XmlTree</tt> class to generate XML tree
15
+ (i.e. DOM-like) structures is also planned, but not yet implemented.
16
+ Also, the events builder is currently lagging the markup builder in
17
+ features.
18
+
19
+ == Usage
20
+
21
+ require 'rubygems'
22
+ require_gem 'builder', '~> 2.0'
23
+
24
+ builder = Builder::XmlMarkup.new
25
+ xml = builder.person { |b| b.name("Jim"); b.phone("555-1234") }
26
+ xml #=> <person><name>Jim</name><phone>555-1234</phone></person>
27
+
28
+ or
29
+
30
+ require 'rubygems'
31
+ require_gem 'builder'
32
+
33
+ builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
34
+ builder.person { |b| b.name("Jim"); b.phone("555-1234") }
35
+ #
36
+ # Prints:
37
+ # <person>
38
+ # <name>Jim</name>
39
+ # <phone>555-1234</phone>
40
+ # </person>
41
+
42
+ == Compatibility
43
+
44
+ === Version 2.0.0 Compatibility Changes
45
+
46
+ Version 2.0.0 introduces automatically escaped attribute values for
47
+ the first time. Versions prior to 2.0.0 did not insert escape
48
+ characters into attribute values in the XML markup. This allowed
49
+ attribute values to explicitly reference entities, which was
50
+ occasionally used by a small number of developers. Since strings
51
+ could always be explicitly escaped by hand, this was not a major
52
+ restriction in functionality.
53
+
54
+ However, it did suprise most users of builder. Since the body text is
55
+ normally escaped, everybody expected the attribute values to be
56
+ escaped as well. Escaped attribute values were the number one support
57
+ request on the 1.x Builder series.
58
+
59
+ Starting with Builder version 2.0.0, all attribute values expressed as
60
+ strings will be processed and the appropriate characters will be
61
+ escaped (e.g. "&" will be tranlated to "&amp;"). Attribute values
62
+ that are expressed as Symbol values will not be processed for escaped
63
+ characters and will be unchanged in output. (Yes, this probably counts
64
+ as Symbol abuse, but the convention is convenient and flexible).
65
+
66
+ Example:
67
+
68
+ xml = Builder::XmlMarkup.new
69
+ xml.sample(:escaped=>"This&That", :unescaped=>:"Here&amp;There")
70
+ xml.target! =>
71
+ <sample escaped="This&amp;That" unescaped="Here&amp;There"/>
72
+
73
+ === Version 1.0.0 Compatibility Changes
74
+
75
+ Version 1.0.0 introduces some changes that are not backwards
76
+ compatible with earlier releases of builder. The main areas of
77
+ incompatibility are:
78
+
79
+ * Keyword based arguments to +new+ (rather than positional based). It
80
+ was found that a developer would often like to specify indentation
81
+ without providing an explicit target, or specify a target without
82
+ indentation. Keyword based arguments handle this situation nicely.
83
+
84
+ * Builder must now be an explicit target for markup tags. Instead of
85
+ writing
86
+
87
+ xml_markup = Builder::XmlMarkup.new
88
+ xml_markup.div { strong("text") }
89
+
90
+ you need to write
91
+
92
+ xml_markup = Builder::XmlMarkup.new
93
+ xml_markup.div { xml_markup.strong("text") }
94
+
95
+ * The builder object is passed as a parameter to all nested markup
96
+ blocks. This allows you to create a short alias for the builder
97
+ object that can be used within the block. For example, the previous
98
+ example can be written as:
99
+
100
+ xml_markup = Builder::XmlMarkup.new
101
+ xml_markup.div { |xml| xml.strong("text") }
102
+
103
+ * If you have both a pre-1.0 and a post-1.0 gem of builder installed,
104
+ you can choose which version to use through the RubyGems
105
+ +require_gem+ facility.
106
+
107
+ require_gem 'builder', "~> 0.0" # Gets the old version
108
+ require_gem 'builder', "~> 1.0" # Gets the new version
109
+
110
+ == Features
111
+
112
+ * XML Comments are supported ...
113
+
114
+ xml_markup.comment! "This is a comment"
115
+ #=> <!-- This is a comment -->
116
+
117
+ * XML processing instructions are supported ...
118
+
119
+ xml_markup.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
120
+ #=> <?xml version="1.0" encoding="UTF-8"?>
121
+
122
+ If the processing instruction is omitted, it defaults to "xml".
123
+ When the processing instruction is "xml", the defaults attributes
124
+ are:
125
+
126
+ <b>version</b>:: 1.0
127
+ <b>encoding</b>:: "UTF-8"
128
+
129
+ * XML entity declarations are now supported to a small degree.
130
+
131
+ xml_markup.declare! :DOCTYPE, :chapter, :SYSTEM, "../dtds/chapter.dtd"
132
+ #=> <!DOCTYPE chapter SYSTEM "../dtds/chapter.dtd">
133
+
134
+ The parameters to a declare! method must be either symbols or
135
+ strings. Symbols are inserted without quotes, and strings are
136
+ inserted with double quotes. Attribute-like arguments in hashes are
137
+ not allowed.
138
+
139
+ If you need to have an argument to declare! be inserted without
140
+ quotes, but the arguement does not conform to the typical Ruby
141
+ syntax for symbols, then use the :"string" form to specify a symbol.
142
+
143
+ For example:
144
+
145
+ xml_markup.declare! :ELEMENT, :chapter, :"(title,para+)"
146
+ #=> <!ELEMENT chapter (title,para+)>
147
+
148
+ Nested entity declarations are allowed. For example:
149
+
150
+ @xml_markup.declare! :DOCTYPE, :chapter do |x|
151
+ x.declare! :ELEMENT, :chapter, :"(title,para+)"
152
+ x.declare! :ELEMENT, :title, :"(#PCDATA)"
153
+ x.declare! :ELEMENT, :para, :"(#PCDATA)"
154
+ end
155
+
156
+ #=>
157
+
158
+ <!DOCTYPE chapter [
159
+ <!ELEMENT chapter (title,para+)>
160
+ <!ELEMENT title (#PCDATA)>
161
+ <!ELEMENT para (#PCDATA)>
162
+ ]>
163
+
164
+ * Some support for XML namespaces is now available. If the first
165
+ argument to a tag call is a symbol, it will be joined to the tag to
166
+ produce a namespace:tag combination. It is easier to show this than
167
+ describe it.
168
+
169
+ xml.SOAP :Envelope do ... end
170
+
171
+ Just put a space before the colon in a namespace to produce the
172
+ right form for builder (e.g. "<tt>SOAP:Envelope</tt>" =>
173
+ "<tt>xml.SOAP :Envelope</tt>")
174
+
175
+ * String attribute values are <em>now</em> escaped by default by
176
+ Builder (<b>NOTE:</b> this is _new_ behavior as of version 2.0).
177
+
178
+ However, occasionally you need to use entities in attribute values.
179
+ Using a symbols (rather than a string) for an attribute value will
180
+ cause Builder to not run its quoting/escaping algorithm on that
181
+ particular value.
182
+
183
+ (<b>Note:</b> The +escape_attrs+ option for builder is now
184
+ obsolete).
185
+
186
+ Example:
187
+
188
+ xml = Builder::XmlMarkup.new
189
+ xml.sample(:escaped=>"This&That", :unescaped=>:"Here&amp;There")
190
+ xml.target! =>
191
+ <sample escaped="This&amp;That" unescaped="Here&amp;There"/>
192
+
193
+ * UTF-8 Support
194
+
195
+ Builder correctly translates UTF-8 characters into valid XML. (New
196
+ in version 2.0.0). Thanks to Sam Ruby for the translation code.
197
+
198
+ Example:
199
+
200
+ xml = Builder::Markup.new
201
+ xml.sample("I�t�rn�ti�n�l")
202
+ xml.target! =>
203
+ "<sample>I&#241;t&#235;rn&#226;ti&#244;n&#224;l</sample>"
204
+
205
+ == Contact
206
+
207
+ Author:: Jim Weirich
208
+ Email:: jim@weirichhouse.org
209
+ Home Page:: http://onestepback.org
210
+ License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)
@@ -0,0 +1,61 @@
1
+ require "spec_helper"
2
+
3
+ module LicenseFinder
4
+ describe Bundle do
5
+ let(:definition) do
6
+ double('definition', {
7
+ :dependencies => [],
8
+ :groups => [],
9
+ :specs_for => [
10
+ build_gemspec('gem1', '1.2.3'),
11
+ build_gemspec('gem2', '0.4.2')
12
+ ]
13
+ })
14
+ end
15
+
16
+ def build_gemspec(name, version, dependency=nil)
17
+ Gem::Specification.new do |s|
18
+ s.name = name
19
+ s.version = version
20
+ s.summary = 'summary'
21
+ s.description = 'description'
22
+
23
+ if dependency
24
+ s.add_dependency dependency
25
+ end
26
+ end
27
+ end
28
+
29
+ describe '.current_gem_dependencies' do
30
+ subject do
31
+ Bundle.current_gem_dependencies(definition)
32
+ end
33
+
34
+ it "should have 2 dependencies" do
35
+ subject.size.should == 2
36
+ end
37
+
38
+ it "returns persisted dependencies" do
39
+ subject.first.id.should be
40
+ subject.last.id.should be
41
+ end
42
+
43
+ context "when initialized with a parent and child gem" do
44
+ before do
45
+ definition.stub(:specs_for).and_return([
46
+ build_gemspec('gem1', '1.2.3', 'gem2'),
47
+ build_gemspec('gem2', '0.4.2')
48
+ ])
49
+ end
50
+
51
+ it "should update the child dependency with its parent data" do
52
+ gem1 = subject.first.reload
53
+ gem2 = subject.last.reload
54
+
55
+ gem2.parents.should == [gem1]
56
+ gem1.children.should == [gem2]
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+
3
+ module LicenseFinder
4
+ describe BundleSyncer do
5
+ describe "#sync!" do
6
+ it "saves new, updates old, and destroys obsolete gems" do
7
+ current_dependencies = stub
8
+ Bundle.stub(:current_gem_dependencies).and_return { current_dependencies }
9
+ Dependency.should_receive(:destroy_obsolete).with(current_dependencies)
10
+
11
+ BundleSyncer.sync!
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ module LicenseFinder
4
+ describe BundledGem do
5
+ subject { described_class.new(gemspec) }
6
+
7
+ let(:gemspec) do
8
+ Gem::Specification.new do |s|
9
+ s.name = 'spec_name'
10
+ s.version = '2.1.3'
11
+ s.summary = 'summary'
12
+ s.description = 'description'
13
+ s.homepage = 'homepage'
14
+
15
+ s.add_dependency 'foo'
16
+ end
17
+ end
18
+
19
+ def fixture_path(fixture)
20
+ Pathname.new(File.join(File.dirname(__FILE__), '..', '..', '..', 'spec', 'fixtures', fixture)).realpath.to_s
21
+ end
22
+
23
+ its(:name) { should == 'spec_name 2.1.3' }
24
+ its(:dependency_name) { should == 'spec_name' }
25
+ its(:dependency_version) { should == '2.1.3' }
26
+
27
+ describe "#determine_license" do
28
+ subject do
29
+ details = BundledGem.new(gemspec)
30
+ details.stub(:license_files).and_return([license_file])
31
+ details
32
+ end
33
+
34
+ let(:license_file) { PossibleLicenseFile.new('gem', 'gem/license/path') }
35
+
36
+ it "returns the license from the gemspec if provided" do
37
+ gemspec.stub(:license).and_return('Some License')
38
+
39
+ subject.determine_license.should == "Some License"
40
+ end
41
+
42
+ it "returns the matched license if detected" do
43
+ license_file.stub(:license).and_return('Detected License')
44
+
45
+ subject.determine_license.should == "Detected License"
46
+ end
47
+
48
+ it "returns 'other' otherwise" do
49
+ license_file.stub(:license).and_return(nil)
50
+
51
+ subject.determine_license.should == "other"
52
+ end
53
+ end
54
+
55
+ describe "#license_files" do
56
+ it "delegates to the license files helper" do
57
+ LicenseFiles.should_receive(:new).with(gemspec.full_gem_path) { stub(files: [] )}
58
+ subject.license_files
59
+ end
60
+ end
61
+ end
62
+ end