license_finder 3.0.4 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +56 -0
- data/CHANGELOG.md +29 -2
- data/CONTRIBUTING.md +5 -1
- data/Dockerfile +33 -10
- data/Gemfile +2 -2
- data/README.md +27 -5
- data/Rakefile +15 -21
- data/ci/pipelines/pipeline.yml.erb +40 -6
- data/ci/pipelines/release.yml +11 -5
- data/ci/scripts/containerize-tests.sh +16 -0
- data/ci/scripts/run-rubocop.sh +8 -0
- data/ci/scripts/run-tests.sh +22 -0
- data/ci/scripts/test.ps1 +81 -0
- data/ci/tasks/build-windows.yml +6 -0
- data/ci/tasks/build.yml +2 -2
- data/ci/tasks/rubocop.yml +13 -0
- data/features/features/cli/cli_spec.rb +8 -8
- data/features/features/configure/add_dependencies_spec.rb +7 -7
- data/features/features/configure/approve_dependencies_spec.rb +15 -15
- data/features/features/configure/assign_licenses_spec.rb +4 -4
- data/features/features/configure/blacklist_licenses_spec.rb +3 -3
- data/features/features/configure/ignore_dependencies_spec.rb +3 -3
- data/features/features/configure/ignore_groups_spec.rb +4 -4
- data/features/features/configure/name_project_spec.rb +4 -4
- data/features/features/configure/set_project_path_spec.rb +2 -2
- data/features/features/configure/whitelist_licenses_spec.rb +4 -4
- data/features/features/package_managers/bower_spec.rb +3 -3
- data/features/features/package_managers/carthage_spec.rb +14 -0
- data/features/features/package_managers/cocoapods_spec.rb +3 -3
- data/features/features/package_managers/conan_spec.rb +11 -0
- data/features/features/package_managers/dep_spec.rb +15 -0
- data/features/features/package_managers/glide_spec.rb +14 -0
- data/features/features/package_managers/govendor_spec.rb +15 -0
- data/features/features/package_managers/gradle_spec.rb +1 -1
- data/features/features/package_managers/gvt_spec.rb +14 -0
- data/features/features/package_managers/maven_spec.rb +2 -3
- data/features/features/package_managers/mix_spec.rb +16 -0
- data/features/features/package_managers/npm_spec.rb +3 -3
- data/features/features/package_managers/nuget_spec.rb +4 -4
- data/features/features/package_managers/pip_spec.rb +2 -2
- data/features/features/package_managers/rebar_spec.rb +3 -3
- data/features/features/package_managers/yarn_spec.rb +14 -0
- data/features/features/report/composite_spec.rb +1 -1
- data/features/features/report/csv_spec.rb +3 -3
- data/features/features/report/diff_spec.rb +20 -10
- data/features/features/report/html_spec.rb +10 -10
- data/features/features/report/subproject_spec.rb +15 -4
- data/features/fixtures/Cartfile +1 -0
- data/features/fixtures/Podfile +1 -1
- data/features/fixtures/alternate-build-file-gradle/build-alt.gradle +5 -15
- data/features/fixtures/build.gradle +5 -15
- data/features/fixtures/conanfile.txt +11 -0
- data/features/fixtures/file-based-libs-gradle/build.gradle +5 -7
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.lock +9 -0
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.toml +7 -0
- data/features/fixtures/gopath_dep/src/foo-dep/bar/bar.go +10 -0
- data/features/fixtures/gopath_dep/src/foo-dep/foo.go +7 -0
- data/features/fixtures/gopath_glide/src/glide.lock +9 -0
- data/features/fixtures/gopath_glide/src/glide.yaml +6 -0
- data/features/fixtures/gopath_govendor/src/vendor/vendor.json +19 -0
- data/features/fixtures/gopath_gvt/src/vendor/manifest +22 -0
- data/features/fixtures/gradle-wrapper/build.gradle +5 -15
- data/features/fixtures/gradle-wrapper/gradlew +6 -1
- data/features/fixtures/gradle-wrapper/gradlew.bat +9 -1
- data/features/fixtures/mix.exs +22 -0
- data/features/fixtures/multi-module-gradle/build.gradle +7 -15
- data/features/fixtures/single-module-gradle/build.gradle +5 -15
- data/features/support/testing_dsl.rb +155 -43
- data/lib/license_finder.rb +4 -3
- data/lib/license_finder/cli.rb +0 -3
- data/lib/license_finder/cli/approvals.rb +3 -3
- data/lib/license_finder/cli/base.rb +11 -8
- data/lib/license_finder/cli/blacklist.rb +7 -7
- data/lib/license_finder/cli/dependencies.rb +8 -8
- data/lib/license_finder/cli/ignored_dependencies.rb +4 -4
- data/lib/license_finder/cli/ignored_groups.rb +4 -4
- data/lib/license_finder/cli/licenses.rb +2 -2
- data/lib/license_finder/cli/main.rb +59 -39
- data/lib/license_finder/cli/makes_decisions.rb +2 -2
- data/lib/license_finder/cli/patched_thor.rb +6 -7
- data/lib/license_finder/cli/project_name.rb +5 -6
- data/lib/license_finder/cli/whitelist.rb +7 -7
- data/lib/license_finder/configuration.rb +15 -4
- data/lib/license_finder/core.rb +20 -4
- data/lib/license_finder/decision_applier.rb +0 -1
- data/lib/license_finder/decisions.rb +12 -14
- data/lib/license_finder/diff.rb +33 -31
- data/lib/license_finder/license.rb +13 -9
- data/lib/license_finder/license/definitions.rb +55 -55
- data/lib/license_finder/license/none_matcher.rb +1 -1
- data/lib/license_finder/license/template.rb +1 -1
- data/lib/license_finder/license/text.rb +0 -1
- data/lib/license_finder/license_aggregator.rb +1 -0
- data/lib/license_finder/logger.rb +18 -61
- data/lib/license_finder/package.rb +25 -11
- data/lib/license_finder/package_delta.rb +3 -6
- data/lib/license_finder/package_manager.rb +77 -34
- data/lib/license_finder/package_managers/bower.rb +8 -8
- data/lib/license_finder/package_managers/bower_package.rb +12 -12
- data/lib/license_finder/package_managers/bundler.rb +21 -9
- data/lib/license_finder/package_managers/bundler_package.rb +1 -1
- data/lib/license_finder/package_managers/carthage.rb +66 -0
- data/lib/license_finder/package_managers/carthage_package.rb +16 -0
- data/lib/license_finder/package_managers/cocoa_pods.rb +13 -13
- data/lib/license_finder/package_managers/cocoa_pods_package.rb +1 -1
- data/lib/license_finder/package_managers/conan.rb +26 -0
- data/lib/license_finder/package_managers/conan_info_parser.rb +74 -0
- data/lib/license_finder/package_managers/conan_package.rb +17 -0
- data/lib/license_finder/package_managers/dep.rb +33 -0
- data/lib/license_finder/package_managers/glide.rb +30 -0
- data/lib/license_finder/package_managers/{go_vendor.rb → go_15vendorexperiment.rb} +19 -24
- data/lib/license_finder/package_managers/go_dep.rb +15 -12
- data/lib/license_finder/package_managers/go_package.rb +15 -13
- data/lib/license_finder/package_managers/go_workspace.rb +39 -34
- data/lib/license_finder/package_managers/govendor.rb +32 -0
- data/lib/license_finder/package_managers/gradle.rb +16 -16
- data/lib/license_finder/package_managers/gradle_package.rb +8 -8
- data/lib/license_finder/package_managers/gvt.rb +61 -0
- data/lib/license_finder/package_managers/maven.rb +17 -18
- data/lib/license_finder/package_managers/maven_package.rb +4 -6
- data/lib/license_finder/package_managers/merged_package.rb +25 -2
- data/lib/license_finder/package_managers/mix.rb +51 -0
- data/lib/license_finder/package_managers/mix_package.rb +7 -0
- data/lib/license_finder/package_managers/npm.rb +8 -32
- data/lib/license_finder/package_managers/npm_package.rb +51 -48
- data/lib/license_finder/package_managers/nuget.rb +30 -40
- data/lib/license_finder/package_managers/pip.rb +11 -11
- data/lib/license_finder/package_managers/pip_package.rb +8 -8
- data/lib/license_finder/package_managers/rebar.rb +11 -11
- data/lib/license_finder/package_managers/yarn.rb +62 -0
- data/lib/license_finder/packages/activation.rb +2 -2
- data/lib/license_finder/packages/license_files.rb +6 -6
- data/lib/license_finder/packages/licensing.rb +8 -10
- data/lib/license_finder/packages/manual_package.rb +2 -2
- data/lib/license_finder/project_finder.rb +6 -5
- data/lib/license_finder/report.rb +1 -0
- data/lib/license_finder/reports/csv_report.rb +4 -4
- data/lib/license_finder/reports/diff_report.rb +2 -2
- data/lib/license_finder/reports/erb_report.rb +2 -4
- data/lib/license_finder/reports/html_report.rb +2 -2
- data/lib/license_finder/reports/markdown_report.rb +1 -1
- data/lib/license_finder/reports/merged_report.rb +1 -1
- data/lib/license_finder/reports/text_report.rb +3 -5
- data/lib/license_finder/shared_helpers/cmd.rb +11 -0
- data/lib/license_finder/version.rb +1 -1
- data/license_finder-2.1.2.gem +0 -0
- data/license_finder.gemspec +38 -38
- metadata +84 -118
- data/ci/scripts/test.sh +0 -26
- data/ci/tasks/create-source-archives.yml +0 -23
- data/spec/dummy_app/Gemfile +0 -6
- data/spec/fixtures/all_pms/.envrc +0 -1
- data/spec/fixtures/all_pms/.nuget/.keep +0 -0
- data/spec/fixtures/all_pms/Gemfile +0 -0
- data/spec/fixtures/all_pms/Godeps/Godeps.json +0 -0
- data/spec/fixtures/all_pms/Podfile +0 -0
- data/spec/fixtures/all_pms/bower.json +0 -0
- data/spec/fixtures/all_pms/build.gradle +0 -0
- data/spec/fixtures/all_pms/package.json +0 -0
- data/spec/fixtures/all_pms/pom.xml +0 -0
- data/spec/fixtures/all_pms/rebar.config +0 -0
- data/spec/fixtures/all_pms/requirements.txt +0 -0
- data/spec/fixtures/all_pms/vendor/.gitkeep +0 -0
- data/spec/fixtures/composite/Gemfile +0 -0
- data/spec/fixtures/composite/nested_project/.envrc +0 -8
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Godeps.json +0 -16
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Readme +0 -5
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/foo.go +0 -6
- data/spec/fixtures/composite/not_a_project/DONTREADME.md +0 -0
- data/spec/fixtures/composite/project1/Gemfile +0 -0
- data/spec/fixtures/composite/project2/package.json +0 -0
- data/spec/fixtures/config/license_finder.yml +0 -5
- data/spec/fixtures/license_directory/COPYING +0 -1
- data/spec/fixtures/license_directory/LICENSE/MIT.txt +0 -1
- data/spec/fixtures/license_directory/LICENSE/lib/unrelated.txt +0 -2
- data/spec/fixtures/license_names/COPYING.txt +0 -1
- data/spec/fixtures/license_names/LICENSE +0 -1
- data/spec/fixtures/license_names/Licence.rdoc +0 -1
- data/spec/fixtures/license_names/Mit-License +0 -1
- data/spec/fixtures/license_names/README.rdoc +0 -1
- data/spec/fixtures/nested_gem/vendor/LICENSE +0 -1
- data/spec/fixtures/npm-circular-dependencies/npm-list.json +0 -5339
- data/spec/fixtures/npm-circular-dependencies/package.json +0 -5
- data/spec/fixtures/npm-circular-licenses/npm-list.json +0 -7597
- data/spec/fixtures/npm-circular-licenses/package.json +0 -23
- data/spec/fixtures/npm-licenses-string/npm-list.json +0 -7597
- data/spec/fixtures/npm-licenses-string/package.json +0 -23
- data/spec/fixtures/npm-recursive-dependencies/npm-list.json +0 -5158
- data/spec/fixtures/npm-recursive-dependencies/package.json +0 -15
- data/spec/fixtures/npm-stack-too-deep/npm-list.json +0 -13464
- data/spec/fixtures/npm-stack-too-deep/package.json +0 -5
- data/spec/fixtures/utf8_gem/README +0 -210
- data/spec/lib/license_finder/cli/approvals_spec.rb +0 -71
- data/spec/lib/license_finder/cli/blacklist_spec.rb +0 -58
- data/spec/lib/license_finder/cli/dependencies_spec.rb +0 -73
- data/spec/lib/license_finder/cli/ignored_dependencies_spec.rb +0 -47
- data/spec/lib/license_finder/cli/ignored_groups_spec.rb +0 -40
- data/spec/lib/license_finder/cli/licenses_spec.rb +0 -60
- data/spec/lib/license_finder/cli/main_spec.rb +0 -243
- data/spec/lib/license_finder/cli/project_name_spec.rb +0 -40
- data/spec/lib/license_finder/cli/whitelist_spec.rb +0 -58
- data/spec/lib/license_finder/configuration_spec.rb +0 -115
- data/spec/lib/license_finder/core_spec.rb +0 -54
- data/spec/lib/license_finder/decision_applier_spec.rb +0 -219
- data/spec/lib/license_finder/decisions_spec.rb +0 -408
- data/spec/lib/license_finder/diff_spec.rb +0 -129
- data/spec/lib/license_finder/license/definitions_spec.rb +0 -177
- data/spec/lib/license_finder/license_aggregator_spec.rb +0 -61
- data/spec/lib/license_finder/license_spec.rb +0 -106
- data/spec/lib/license_finder/package_delta_spec.rb +0 -18
- data/spec/lib/license_finder/package_manager_spec.rb +0 -62
- data/spec/lib/license_finder/package_managers/bower_package_spec.rb +0 -71
- data/spec/lib/license_finder/package_managers/bower_spec.rb +0 -39
- data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +0 -35
- data/spec/lib/license_finder/package_managers/bundler_spec.rb +0 -56
- data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +0 -48
- data/spec/lib/license_finder/package_managers/cocoa_pods_spec.rb +0 -59
- data/spec/lib/license_finder/package_managers/go_dep_spec.rb +0 -126
- data/spec/lib/license_finder/package_managers/go_package_spec.rb +0 -33
- data/spec/lib/license_finder/package_managers/go_vendor_spec.rb +0 -144
- data/spec/lib/license_finder/package_managers/go_workspace_spec.rb +0 -286
- data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +0 -80
- data/spec/lib/license_finder/package_managers/gradle_spec.rb +0 -180
- data/spec/lib/license_finder/package_managers/maven_package_spec.rb +0 -63
- data/spec/lib/license_finder/package_managers/maven_spec.rb +0 -128
- data/spec/lib/license_finder/package_managers/merged_package_spec.rb +0 -60
- data/spec/lib/license_finder/package_managers/npm_package_spec.rb +0 -57
- data/spec/lib/license_finder/package_managers/npm_spec.rb +0 -253
- data/spec/lib/license_finder/package_managers/nuget_package_spec.rb +0 -9
- data/spec/lib/license_finder/package_managers/nuget_spec.rb +0 -157
- data/spec/lib/license_finder/package_managers/pip_package_spec.rb +0 -87
- data/spec/lib/license_finder/package_managers/pip_spec.rb +0 -47
- data/spec/lib/license_finder/package_managers/rebar_package_spec.rb +0 -24
- data/spec/lib/license_finder/package_managers/rebar_spec.rb +0 -50
- data/spec/lib/license_finder/package_spec.rb +0 -179
- data/spec/lib/license_finder/packages/activation_spec.rb +0 -41
- data/spec/lib/license_finder/packages/license_files_spec.rb +0 -46
- data/spec/lib/license_finder/packages/licensing_spec.rb +0 -1
- data/spec/lib/license_finder/packages/possible_license_file_spec.rb +0 -38
- data/spec/lib/license_finder/project_finder_spec.rb +0 -33
- data/spec/lib/license_finder/reports/csv_report_spec.rb +0 -70
- data/spec/lib/license_finder/reports/diff_report_spec.rb +0 -56
- data/spec/lib/license_finder/reports/html_report_spec.rb +0 -101
- data/spec/lib/license_finder/reports/markdown_report_spec.rb +0 -45
- data/spec/lib/license_finder/reports/merged_report_spec.rb +0 -21
- data/spec/lib/license_finder/reports/text_report_spec.rb +0 -43
- data/spec/spec_helper.rb +0 -27
- data/spec/support/shared_examples_for_package_manager.rb +0 -52
- data/spec/support/stdout_helpers.rb +0 -31
- data/spec/support/test_fixtures.rb +0 -7
@@ -1,210 +0,0 @@
|
|
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 "&"). 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&There")
|
70
|
-
xml.target! =>
|
71
|
-
<sample escaped="This&That" unescaped="Here&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&There")
|
190
|
-
xml.target! =>
|
191
|
-
<sample escaped="This&That" unescaped="Here&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ñtërnâtiônà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)
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
describe Approvals do
|
6
|
-
let(:decisions) { Decisions.new }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(Decisions).to receive(:fetch_saved) { decisions }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#add" do
|
13
|
-
it "approves the requested gem" do
|
14
|
-
silence_stdout do
|
15
|
-
subject.add 'foo'
|
16
|
-
end
|
17
|
-
expect(subject.decisions).to be_approved "foo"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "approves multiple dependencies" do
|
21
|
-
silence_stdout do
|
22
|
-
subject.add 'foo', 'bar'
|
23
|
-
end
|
24
|
-
expect(subject.decisions).to be_approved "foo"
|
25
|
-
expect(subject.decisions).to be_approved "bar"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "raises a warning if no dependency was specified" do
|
29
|
-
silence_stdout do
|
30
|
-
expect { subject.add }.to raise_error(ArgumentError)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "sets approver, approval message, and approval version" do
|
35
|
-
subject.options = {
|
36
|
-
who: "Julian",
|
37
|
-
why: "We really need this",
|
38
|
-
version: '1.0.0.RELEASE'
|
39
|
-
}
|
40
|
-
silence_stdout do
|
41
|
-
subject.add("foo")
|
42
|
-
end
|
43
|
-
|
44
|
-
approval = subject.decisions.approval_of("foo", '1.0.0.RELEASE')
|
45
|
-
expect(approval.who).to eq "Julian"
|
46
|
-
expect(approval.why).to eq "We really need this"
|
47
|
-
expect(approval.safe_versions).to eq ['1.0.0.RELEASE']
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "remove" do
|
52
|
-
it "unapproves the specified dependency" do
|
53
|
-
silence_stdout do
|
54
|
-
subject.add("test")
|
55
|
-
subject.remove("test")
|
56
|
-
end
|
57
|
-
expect(subject.decisions).not_to be_approved "test"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "is cumulative" do
|
61
|
-
silence_stdout do
|
62
|
-
subject.add("test")
|
63
|
-
subject.remove("test")
|
64
|
-
subject.add("test")
|
65
|
-
end
|
66
|
-
expect(subject.decisions).to be_approved "test"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
describe Blacklist do
|
6
|
-
let(:decisions) { Decisions.new }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(Decisions).to receive(:fetch_saved) { decisions }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "list" do
|
13
|
-
it "shows the blacklist of licenses" do
|
14
|
-
decisions.blacklist("MIT")
|
15
|
-
|
16
|
-
expect(capture_stdout { subject.list }).to match /MIT/
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "add" do
|
21
|
-
it "adds the specified license to the blacklist" do
|
22
|
-
silence_stdout do
|
23
|
-
subject.add("test")
|
24
|
-
end
|
25
|
-
expect(subject.decisions.blacklisted).to eq [License.find_by_name("test")].to_set
|
26
|
-
end
|
27
|
-
|
28
|
-
it "adds multiple licenses to the blacklist" do
|
29
|
-
silence_stdout do
|
30
|
-
subject.add("test", "rest")
|
31
|
-
end
|
32
|
-
expect(subject.decisions.blacklisted).to eq [
|
33
|
-
License.find_by_name("test"),
|
34
|
-
License.find_by_name("rest")
|
35
|
-
].to_set
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "remove" do
|
40
|
-
it "removes the specified license from the blacklist" do
|
41
|
-
silence_stdout do
|
42
|
-
subject.add("test")
|
43
|
-
subject.remove("test")
|
44
|
-
end
|
45
|
-
expect(subject.decisions.blacklisted).to be_empty
|
46
|
-
end
|
47
|
-
|
48
|
-
it "removes multiple licenses from the blacklist" do
|
49
|
-
silence_stdout do
|
50
|
-
subject.add("test", "rest")
|
51
|
-
subject.remove("test", "rest")
|
52
|
-
end
|
53
|
-
expect(subject.decisions.blacklisted).to be_empty
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
describe Dependencies do
|
6
|
-
let(:decisions) { Decisions.new }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(Decisions).to receive(:fetch_saved) { decisions }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "add" do
|
13
|
-
it "adds a dependency" do
|
14
|
-
silence_stdout do
|
15
|
-
subject.add("js_dep", "MIT", "1.2.3")
|
16
|
-
end
|
17
|
-
|
18
|
-
expect(subject.decisions.packages.size).to eq 1
|
19
|
-
package = subject.decisions.packages.first
|
20
|
-
expect(package.name).to eq "js_dep"
|
21
|
-
expect(package.version).to eq "1.2.3"
|
22
|
-
expect(subject.decisions.licenses_of("js_dep")).to eq [License.find_by_name("MIT")].to_set
|
23
|
-
end
|
24
|
-
|
25
|
-
it "does not require a version" do
|
26
|
-
silence_stdout do
|
27
|
-
subject.add("js_dep", "MIT")
|
28
|
-
end
|
29
|
-
package = subject.decisions.packages.first
|
30
|
-
expect(package.version).to be_nil
|
31
|
-
end
|
32
|
-
|
33
|
-
it "has an --approve option to approve the added dependency" do
|
34
|
-
subject.options = { approve: true, who: "Julian", why: "We really need this" }
|
35
|
-
silence_stdout do
|
36
|
-
subject.add("js_dep", "MIT")
|
37
|
-
end
|
38
|
-
approval = subject.decisions.approval_of("js_dep")
|
39
|
-
expect(approval.who).to eq "Julian"
|
40
|
-
expect(approval.why).to eq "We really need this"
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'has an --approve option to approve the added dependency & version combination' do
|
44
|
-
subject.options = { approve: true, who: "Julian", why: "We really need this", version: '1.0.0.RELEASE' }
|
45
|
-
silence_stdout do
|
46
|
-
subject.add("js_dep", "MIT")
|
47
|
-
end
|
48
|
-
approval = subject.decisions.approval_of("js_dep", '1.0.0.RELEASE')
|
49
|
-
expect(approval.who).to eq "Julian"
|
50
|
-
expect(approval.why).to eq "We really need this"
|
51
|
-
expect(approval.safe_versions).to eq ['1.0.0.RELEASE']
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "remove" do
|
56
|
-
it "removes a dependency" do
|
57
|
-
silence_stdout do
|
58
|
-
subject.add("js_dep", "MIT")
|
59
|
-
subject.remove("js_dep")
|
60
|
-
end
|
61
|
-
expect(subject.decisions.packages).to be_empty
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "list" do
|
66
|
-
it "lists manually added dependencies" do
|
67
|
-
decisions.add_package("custom", nil)
|
68
|
-
expect(capture_stdout { subject.list }).to match /custom/
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
describe IgnoredDependencies do
|
6
|
-
let(:decisions) { Decisions.new }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(Decisions).to receive(:fetch_saved) { decisions }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "list" do
|
13
|
-
context "when there is at least one ignored dependency" do
|
14
|
-
it "shows the ignored dependencies" do
|
15
|
-
decisions.ignore("bundler")
|
16
|
-
expect(capture_stdout { subject.list }).to match /bundler/
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "when there are no ignored dependencies" do
|
21
|
-
it "prints '(none)'" do
|
22
|
-
expect(capture_stdout { subject.list }).to match /\(none\)/
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "add" do
|
28
|
-
it "adds the specified group to the ignored groups list" do
|
29
|
-
silence_stdout do
|
30
|
-
subject.add("test")
|
31
|
-
end
|
32
|
-
expect(subject.decisions.ignored).to eq ["test"].to_set
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "remove" do
|
37
|
-
it "removes the specified group from the ignored groups list" do
|
38
|
-
silence_stdout do
|
39
|
-
subject.add("test")
|
40
|
-
subject.remove("test")
|
41
|
-
end
|
42
|
-
expect(subject.decisions.ignored).to be_empty
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|