diff options
| author | mo khan <mo.khan@gmail.com> | 2020-08-17 16:23:28 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-08-18 09:27:34 -0600 |
| commit | a54789bcfe9e05ab42dfb6e03457279384e343fe (patch) | |
| tree | 9f0ad8087db423cf57b1e96451a0c977422a50d7 /spec | |
| parent | 24695063d1ba9a73ba92a44fae0813d5492cf29c (diff) | |
Update license_finder to 6.8.1
* Update CHANGELOG
* Add default retry for all jobs
* Ensure all deb packages are built
Diffstat (limited to 'spec')
41 files changed, 681 insertions, 53 deletions
diff --git a/spec/fixtures/dotnet/nuget-csproj/Program.cs b/spec/fixtures/dotnet/nuget-csproj/Program.cs new file mode 100644 index 0000000..9e98aa4 --- /dev/null +++ b/spec/fixtures/dotnet/nuget-csproj/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace nuget_csproj +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/spec/fixtures/dotnet/nuget-csproj/nuget-csproj.csproj b/spec/fixtures/dotnet/nuget-csproj/nuget-csproj.csproj new file mode 100644 index 0000000..7bdb8cc --- /dev/null +++ b/spec/fixtures/dotnet/nuget-csproj/nuget-csproj.csproj @@ -0,0 +1,7 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp3.1</TargetFramework> + <RootNamespace>nuget_csproj</RootNamespace> + </PropertyGroup> +</Project> diff --git a/spec/fixtures/expected/js/bower/v2.1.json b/spec/fixtures/expected/js/bower/v2.1.json index 78a4a05..b1a140a 100644 --- a/spec/fixtures/expected/js/bower/v2.1.json +++ b/spec/fixtures/expected/js/bower/v2.1.json @@ -35,7 +35,7 @@ "dependencies": [ { "name": "cli", - "version": "6.14.7", + "version": "6.14.8", "package_manager": "bower", "path": "bower.json", "licenses": [ @@ -137,4 +137,4 @@ ] } ] -}
\ No newline at end of file +} diff --git a/spec/fixtures/java/maven/java-version/.java-version b/spec/fixtures/java/maven/java-version/.java-version new file mode 100644 index 0000000..be6dcc8 --- /dev/null +++ b/spec/fixtures/java/maven/java-version/.java-version @@ -0,0 +1 @@ +java-version diff --git a/spec/fixtures/java/maven/tool-versions/.tool-versions b/spec/fixtures/java/maven/tool-versions/.tool-versions new file mode 100644 index 0000000..ecf6810 --- /dev/null +++ b/spec/fixtures/java/maven/tool-versions/.tool-versions @@ -0,0 +1 @@ +java tool-versions diff --git a/spec/fixtures/js/10.21.0-tool-versions/.tool-versions b/spec/fixtures/js/10.21.0-tool-versions/.tool-versions new file mode 100644 index 0000000..d5c42e2 --- /dev/null +++ b/spec/fixtures/js/10.21.0-tool-versions/.tool-versions @@ -0,0 +1 @@ +nodejs 10.21.0 diff --git a/spec/fixtures/python/pip/requirements/requirements.txt b/spec/fixtures/python/pip/requirements/requirements.txt new file mode 100644 index 0000000..11b4935 --- /dev/null +++ b/spec/fixtures/python/pip/requirements/requirements.txt @@ -0,0 +1 @@ +beets==1.4.9 diff --git a/spec/fixtures/python/simple-Pipfile b/spec/fixtures/python/pipenv/simple/Pipfile index 2a4ffeb..2a4ffeb 100644 --- a/spec/fixtures/python/simple-Pipfile +++ b/spec/fixtures/python/pipenv/simple/Pipfile diff --git a/spec/fixtures/python/simple-Pipfile.lock b/spec/fixtures/python/pipenv/simple/Pipfile.lock index 655ee42..655ee42 100644 --- a/spec/fixtures/python/simple-Pipfile.lock +++ b/spec/fixtures/python/pipenv/simple/Pipfile.lock diff --git a/spec/fixtures/python/pipenv/specific-python-version/.tool-versions b/spec/fixtures/python/pipenv/specific-python-version/.tool-versions new file mode 100644 index 0000000..5f51665 --- /dev/null +++ b/spec/fixtures/python/pipenv/specific-python-version/.tool-versions @@ -0,0 +1 @@ +python 3.4.10 diff --git a/spec/fixtures/python/pipenv/specific-python-version/Pipfile b/spec/fixtures/python/pipenv/specific-python-version/Pipfile new file mode 100644 index 0000000..ba1512c --- /dev/null +++ b/spec/fixtures/python/pipenv/specific-python-version/Pipfile @@ -0,0 +1,14 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +docutils = "==0.13.1" +Django = "==1.11.3" +requests = "==2.5.3" + +[requires] +python_version = "3.4" diff --git a/spec/fixtures/python/pipenv/specific-python-version/Pipfile.lock b/spec/fixtures/python/pipenv/specific-python-version/Pipfile.lock new file mode 100644 index 0000000..82cfacb --- /dev/null +++ b/spec/fixtures/python/pipenv/specific-python-version/Pipfile.lock @@ -0,0 +1,53 @@ +{ + "_meta": { + "hash": { + "sha256": "1ac44ce43bdf23591652454e72811bc45465877c4a40721707a4a21323e14fb3" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.4" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "django": { + "hashes": [ + "sha256:9ef9de0a957245ed3a29c4162ed2fd493252ca249a755f9e2b4a9be82caf8f6b", + "sha256:c69e0c0416f2376b677830304d4c5fa8793b9c815af77be659a3c50d1f46c2e6" + ], + "index": "pypi", + "version": "==1.11.3" + }, + "docutils": { + "hashes": [ + "sha256:718c0f5fb677be0f34b781e04241c4067cbd9327b66bdd8e763201130f5175be", + "sha256:cb3ebcb09242804f84bdbf0b26504077a054da6772c6f4d625f335cc53ebf94d", + "sha256:de454f1015958450b72641165c08afe7023cd7e3944396448f2fb1b0ccba9d77" + ], + "index": "pypi", + "version": "==0.13.1" + }, + "pytz": { + "hashes": [ + "sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32", + "sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7" + ], + "version": "==2019.2" + }, + "requests": { + "hashes": [ + "sha256:3e66d7ba78e7a6a8eccd2e901079ab8d24e408b5375cf32eb51f291306302418", + "sha256:55d7f5619daae94ec49ee81ed8c865e5a2a47f0bbf8e06cf94636bee103eaf65" + ], + "index": "pypi", + "version": "==2.5.3" + } + }, + "develop": {} +} diff --git a/spec/fixtures/ruby/bundler-jruby/.tool-versions b/spec/fixtures/ruby/bundler-jruby/.tool-versions new file mode 100644 index 0000000..e966fd0 --- /dev/null +++ b/spec/fixtures/ruby/bundler-jruby/.tool-versions @@ -0,0 +1,2 @@ +java adoptopenjdk-8.0.252+9.1 +ruby jruby-9.2.11.1 diff --git a/spec/fixtures/ruby/bundler-jruby/Gemfile b/spec/fixtures/ruby/bundler-jruby/Gemfile new file mode 100644 index 0000000..c6e1267 --- /dev/null +++ b/spec/fixtures/ruby/bundler-jruby/Gemfile @@ -0,0 +1,66 @@ +source "https://rubygems.org" + +gem "rails", "5.2.4.3" + +gem "action_subscriber" +gem "action_subscriber-opentracing" +gem "activerecord-import" +gem "active_remote" +gem "aws-sdk-sns" +gem "bcrypt" +gem "pluck_each" +gem "httpclient" +gem "md-logstasher" +gem "protobuf", ">= 3.10.0.pre0" +gem "protobuf-activerecord", ">= 5.2.0" +gem "protobuf-nats" +gem "protobuf-opentracing" +gem "rails-html-sanitizer", "~> 1.0.3" +gem "redis-namespace" +gem "redis-rails" +gem "ruby-saml", "~> 1.2" +gem "sidekiq" +gem "sidekiq-cron" +gem "spectacles" +gem "sprockets", "~>3.7.2" +gem "urlcrypt" +gem "harness" +gem "harness-action_subscriber" +gem "harness-active_publisher" +gem "harness-sidekiq" +gem "trebuchet", :group => :development +gem "rspec-rails", group: [:development, :test] + +platforms :ruby do + gem "pg" +end + +platforms :jruby do + gem "activerecord-jdbcpostgresql-adapter" + gem "protobuf_java_helpers" + gem "fast_blank_java" +end + +group :development, :test do + gem "benchmark-ips", require: false + gem "brakeman", require: false + gem "bundler-audit", require: false + gem "mad_rubocop", require: false + gem "pry" + platforms :jruby do + gem "jruby-profiler-flame_graph_profile_printer", require: false + end +end + +group :test do + gem "factory_bot_rails" + gem "protobuf-rspec" + gem "rspec-pride", require: false + gem "shoulda" + gem "simplecov", require: false + gem "timecop" +end + +group :doc do + gem "sdoc", require: false +end diff --git a/spec/fixtures/ruby/bundler-jruby/Gemfile.lock b/spec/fixtures/ruby/bundler-jruby/Gemfile.lock new file mode 100644 index 0000000..2dedaae --- /dev/null +++ b/spec/fixtures/ruby/bundler-jruby/Gemfile.lock @@ -0,0 +1,362 @@ +GEM + remote: https://rubygems.org/ + specs: + action_subscriber (5.2.1-java) + activesupport (>= 3.2) + concurrent-ruby + march_hare (>= 2.7.0) + middleware + thor + action_subscriber-opentracing (1.0.3) + opentracing + actioncable (5.2.4.3) + actionpack (= 5.2.4.3) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.3) + actionview (= 5.2.4.3) + activesupport (= 5.2.4.3) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.4.3) + activesupport (= 5.2.4.3) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + active_remote (5.2.0) + activemodel (~> 5.2) + activesupport (~> 5.2) + protobuf (>= 3.0) + activejob (5.2.4.3) + activesupport (= 5.2.4.3) + globalid (>= 0.3.6) + activemodel (5.2.4.3) + activesupport (= 5.2.4.3) + activerecord (5.2.4.3) + activemodel (= 5.2.4.3) + activesupport (= 5.2.4.3) + arel (>= 9.0) + activerecord-import (1.0.5) + activerecord (>= 3.2) + activerecord-jdbc-adapter (52.6-java) + activerecord (~> 5.2.0) + activerecord-jdbcpostgresql-adapter (52.6-java) + activerecord-jdbc-adapter (= 52.6) + jdbc-postgres (>= 9.4, < 43) + activestorage (5.2.4.3) + actionpack (= 5.2.4.3) + activerecord (= 5.2.4.3) + marcel (~> 0.3.1) + activesupport (5.2.4.3) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + ast (2.4.1) + aws-eventstream (1.1.0) + aws-partitions (1.341.0) + aws-sdk-core (3.103.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-sns (1.28.0) + aws-sdk-core (~> 3, >= 3.99.0) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.2.1) + aws-eventstream (~> 1, >= 1.0.2) + bcrypt (3.1.13-java) + benchmark-ips (2.8.2) + brakeman (4.8.2) + builder (3.2.4) + bundler-audit (0.7.0.1) + bundler (>= 1.2.0, < 3) + thor (>= 0.18, < 2) + coderay (1.1.3) + concurrent-ruby (1.1.6) + connection_pool (2.2.3) + crass (1.0.6) + diff-lcs (1.4.4) + docile (1.3.2) + erubi (1.9.0) + et-orbi (1.2.4) + tzinfo + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) + fast_blank_java (0.0.2-java) + ffi (1.13.1-java) + fugit (1.3.6) + et-orbi (~> 1.1, >= 1.1.8) + raabro (~> 1.3) + globalid (0.4.2) + activesupport (>= 4.2.0) + harness (2.0.0) + statsd-ruby + harness-action_subscriber (0.0.4) + action_subscriber (>= 2.0.0) + activesupport (>= 3.2) + harness (>= 2.0.0) + harness-active_publisher (1.1.3) + activesupport (>= 3.2) + harness (>= 2.0.0) + harness-sidekiq (0.1.0) + harness + sidekiq + heredity (0.1.2) + httpclient (2.8.3) + i18n (1.8.3) + concurrent-ruby (~> 1.0) + jaro_winkler (1.5.4-java) + jdbc-postgres (42.2.14) + jmespath (1.4.0) + jruby-profiler-flame_graph_profile_printer (0.2.0-java) + logstash-event (1.2.02) + loofah (2.6.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mad_rubocop (3.64.0) + rubocop (~> 0.64.0) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + march_hare (4.2.0-java) + md-logstasher (1.2.0) + logstash-event (~> 1.2) + method_source (1.0.0) + middleware (0.1.0) + mimemagic (0.3.5) + mini_mime (1.0.2) + minitest (5.14.1) + nats-pure (0.3.0) + nio4r (2.5.2-java) + nokogiri (1.10.10-java) + opentracing (0.5.0) + parallel (1.19.2) + parser (2.7.1.4) + ast (~> 2.4.1) + pluck_each (0.1.3) + activerecord (> 3.2.0) + activesupport (> 3.0.0) + powerpack (0.1.2) + protobuf (3.10.3) + activesupport (>= 3.2) + middleware + thor + thread_safe + protobuf-activerecord (5.2.0) + activerecord (~> 5.2.0) + activesupport (~> 5.2.0) + concurrent-ruby + heredity (>= 0.1.1) + protobuf (>= 3.0) + protobuf-nats (0.10.2) + activesupport (>= 3.2) + connection_pool + nats-pure (~> 0.3, < 0.4) + protobuf (~> 3.7, >= 3.7.2) + protobuf-opentracing (1.0.7) + activesupport (>= 3.2) + opentracing + protobuf-rspec (1.1.4) + protobuf (>= 3.0.0) + rspec (>= 2.14, < 4.0) + protobuf_java_helpers (0.2.0-java) + pry (0.13.1-java) + coderay (~> 1.1) + method_source (~> 1.0) + spoon (~> 0.0) + raabro (1.3.1) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.3) + actioncable (= 5.2.4.3) + actionmailer (= 5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) + activemodel (= 5.2.4.3) + activerecord (= 5.2.4.3) + activestorage (= 5.2.4.3) + activesupport (= 5.2.4.3) + bundler (>= 1.3.0) + railties (= 5.2.4.3) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.4.3) + actionpack (= 5.2.4.3) + activesupport (= 5.2.4.3) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + rdoc (6.2.1) + redis (4.2.1) + redis-actionpack (5.2.0) + actionpack (>= 5, < 7) + redis-rack (>= 2.1.0, < 3) + redis-store (>= 1.1.0, < 2) + redis-activesupport (5.2.0) + activesupport (>= 3, < 7) + redis-store (>= 1.3, < 2) + redis-namespace (1.7.0) + redis (>= 3.0.4) + redis-rack (2.1.2) + rack (>= 2.0.8, < 3) + redis-store (>= 1.2, < 2) + redis-rails (5.0.2) + redis-actionpack (>= 5.0, < 6) + redis-activesupport (>= 5.0, < 6) + redis-store (>= 1.2, < 2) + redis-store (1.9.0) + redis (>= 4, < 5) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-pride (3.2.1) + rspec (~> 3.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.9.3) + rubocop (0.64.0) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.5, != 2.5.1.1) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.4.0) + ruby-progressbar (1.10.1) + ruby-saml (1.11.0) + nokogiri (>= 1.5.10) + sdoc (1.1.0) + rdoc (>= 5.0) + shoulda (4.0.0) + shoulda-context (~> 2.0) + shoulda-matchers (~> 4.0) + shoulda-context (2.0.0) + shoulda-matchers (4.3.0) + activesupport (>= 4.2.0) + sidekiq (6.1.0) + connection_pool (>= 2.2.2) + rack (~> 2.0) + redis (>= 4.2.0) + sidekiq-cron (1.2.0) + fugit (~> 1.1) + sidekiq (>= 4.2.1) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spectacles (2.0.0) + activerecord (>= 3.2.0, < 6.0) + activesupport (>= 3.2.0, < 6.0) + spoon (0.0.6) + ffi + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + statsd-ruby (1.4.0) + thor (1.0.1) + thread_safe (0.3.6-java) + timecop (0.9.1) + trebuchet (0.1) + tzinfo (1.2.7) + thread_safe (~> 0.1) + unicode-display_width (1.4.1) + urlcrypt (0.1.1) + websocket-driver (0.7.3-java) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + +PLATFORMS + java + +DEPENDENCIES + action_subscriber + action_subscriber-opentracing + active_remote + activerecord-import + activerecord-jdbcpostgresql-adapter + aws-sdk-sns + bcrypt + benchmark-ips + brakeman + bundler-audit + factory_bot_rails + fast_blank_java + harness + harness-action_subscriber + harness-active_publisher + harness-sidekiq + httpclient + jruby-profiler-flame_graph_profile_printer + mad_rubocop + md-logstasher + pg + pluck_each + protobuf (>= 3.10.0.pre0) + protobuf-activerecord (>= 5.2.0) + protobuf-nats + protobuf-opentracing + protobuf-rspec + protobuf_java_helpers + pry + rails (= 5.2.4.3) + rails-html-sanitizer (~> 1.0.3) + redis-namespace + redis-rails + rspec-pride + rspec-rails + ruby-saml (~> 1.2) + sdoc + shoulda + sidekiq + sidekiq-cron + simplecov + spectacles + sprockets (~> 3.7.2) + timecop + trebuchet + urlcrypt + +BUNDLED WITH + 2.1.4 diff --git a/spec/fixtures/ruby/bundler/ruby-2.6.0-tool-versions/.tool-versions b/spec/fixtures/ruby/bundler/ruby-2.6.0-tool-versions/.tool-versions new file mode 100644 index 0000000..cf8ec42 --- /dev/null +++ b/spec/fixtures/ruby/bundler/ruby-2.6.0-tool-versions/.tool-versions @@ -0,0 +1 @@ +ruby 2.6.0 diff --git a/spec/integration/c/conan_spec.rb b/spec/integration/c/conan_spec.rb index cdbf029..86025bd 100644 --- a/spec/integration/c/conan_spec.rb +++ b/spec/integration/c/conan_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "conan" do diff --git a/spec/integration/dotnet/examples_spec.rb b/spec/integration/dotnet/examples_spec.rb index f9c63ea..909dd2c 100644 --- a/spec/integration/dotnet/examples_spec.rb +++ b/spec/integration/dotnet/examples_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe ".NET Core" do diff --git a/spec/integration/dotnet/nuget_spec.rb b/spec/integration/dotnet/nuget_spec.rb index 90a189b..5bda5db 100644 --- a/spec/integration/dotnet/nuget_spec.rb +++ b/spec/integration/dotnet/nuget_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "nuget" do diff --git a/spec/integration/go/modules_spec.rb b/spec/integration/go/modules_spec.rb index fa2313c..3edef74 100644 --- a/spec/integration/go/modules_spec.rb +++ b/spec/integration/go/modules_spec.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "modules" do before do # Delete go module cache - system('rm -fr ~/.local/pkg') + system('rm -fr /opt/gitlab/.local/pkg') system('rm -fr /opt/asdf/installs/golang/**/packages/pkg/') end @@ -64,6 +66,21 @@ RSpec.describe "modules" do end end + context "when scanning the `gitlab-runner` project" do + subject { runner.scan } + + before do + runner.clone('https://gitlab.com/gitlab-org/gitlab-runner.git') + end + + specify do + expect(subject).to match_schema + expect(subject[:licenses]).not_to be_empty + expect(subject[:dependencies]).not_to be_empty + expect(subject.dependency_names).to include('gitlab.com/gitlab-org/gitlab-terminal') + end + end + context "when scanning a project with vendored modules" do subject { runner.scan } diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb index c2137b3..25d7e26 100644 --- a/spec/integration/java/gradle_spec.rb +++ b/spec/integration/java/gradle_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "gradle" do @@ -113,17 +115,17 @@ plugins { end context 'when using Java 8 with version 1.* of gradle' do + subject { runner.scan(env: { 'LM_JAVA_VERSION' => '8' }) } + before do runner.mount(dir: fixture_file("java/gradle/java-8")) runner.add_file('.tool-versions', "gradle 1.9") end it 'returns an empty report because the plugin we use does not work in this version of the gradle API' do - report = runner.scan(env: { 'LM_JAVA_VERSION' => '8' }) - - expect(report).to match_schema - expect(report[:dependencies]).to be_empty - expect(report[:licenses]).to be_empty + expect(subject).to match_schema + expect(subject[:dependencies]).to be_empty + expect(subject[:licenses]).to be_empty end end diff --git a/spec/integration/java/maven_spec.rb b/spec/integration/java/maven_spec.rb index aa2d1ff..c9a7026 100644 --- a/spec/integration/java/maven_spec.rb +++ b/spec/integration/java/maven_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "maven" do @@ -58,15 +60,15 @@ RSpec.describe "maven" do end describe "When scanning a project with multiple modules" do + subject { runner.scan } + before do runner.mount(dir: fixture_file('java/maven/multimodule')) end it 'detects dependences from each module' do - report = runner.scan - - expect(report).to match_schema - expect(report[:dependencies]).not_to be_empty + expect(subject).to match_schema + expect(subject[:dependencies]).not_to be_empty [ { name: "asm", licenses: ["BSD-4-Clause"] }, @@ -81,10 +83,10 @@ RSpec.describe "maven" do { name: "netty-all", licenses: ["Apache-2.0"] }, { name: "stax2-api", licenses: ["BSD-4-Clause"] } ].each do |dependency| - expect(report.licenses_for(dependency[:name])).to match_array(dependency[:licenses]) + expect(subject.licenses_for(dependency[:name])).to match_array(dependency[:licenses]) end - expect(report.dependency_names).not_to include('junit') + expect(subject.dependency_names).not_to include('junit') end end diff --git a/spec/integration/js/bower_spec.rb b/spec/integration/js/bower_spec.rb index 227718e..1bb366e 100644 --- a/spec/integration/js/bower_spec.rb +++ b/spec/integration/js/bower_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "bower" do diff --git a/spec/integration/js/npm_spec.rb b/spec/integration/js/npm_spec.rb index a8dd2d4..8ab5be6 100644 --- a/spec/integration/js/npm_spec.rb +++ b/spec/integration/js/npm_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "npm" do diff --git a/spec/integration/js/yarn_spec.rb b/spec/integration/js/yarn_spec.rb index d81564c..5b1f9c5 100644 --- a/spec/integration/js/yarn_spec.rb +++ b/spec/integration/js/yarn_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "yarn" do diff --git a/spec/integration/php/composer_spec.rb b/spec/integration/php/composer_spec.rb index 839f0b7..9f71541 100644 --- a/spec/integration/php/composer_spec.rb +++ b/spec/integration/php/composer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "composer" do diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb index a52b992..9c2721d 100644 --- a/spec/integration/python/pip_spec.rb +++ b/spec/integration/python/pip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "pip" do @@ -100,10 +102,20 @@ RSpec.describe "pip" do context "when a project uses a custom `SETUP_CMD`" do before do runner.add_file('requirements.txt', 'six==1.14.0') + runner.add_file('.python-version', '3.8.4') + runner.add_file('custom.sh') do + <<~SCRIPT + #!/bin/bash -lx + + asdf install python 3.8.4 + asdf reshim + pip install -r requirements.txt + SCRIPT + end end it 'detects the software licenses' do - report = runner.scan(env: { 'SETUP_CMD' => 'pip install -r requirements.txt' }) + report = runner.scan(env: { 'SETUP_CMD' => 'bash custom.sh' }) expect(report).to match_schema(version: '2.0') expect(report.licenses_for('six')).to match_array(["MIT"]) diff --git a/spec/integration/python/pipenv_spec.rb b/spec/integration/python/pipenv_spec.rb index 5cc9128..cd20522 100644 --- a/spec/integration/python/pipenv_spec.rb +++ b/spec/integration/python/pipenv_spec.rb @@ -1,6 +1,12 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "pipenv" do + subject { runner.scan(env: env) } + + let(:env) { {} } + include_examples "each report version", "python", "pipenv", "pip-file-lock" context "when a project depends on a version 6 Pipfile.lock" do @@ -19,15 +25,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to contain_exactly("six") + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to contain_exactly("six") end end @@ -64,15 +70,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to match_array([ + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to match_array([ "backports.shutil_get_terminal_size", "click", "colorama", @@ -124,15 +130,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to match_array(%w[ + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to match_array(%w[ certifi chardet idna @@ -163,22 +169,19 @@ RSpec.describe "pipenv" do end it 'produces a valid report' do - report = runner.scan - - expect(report).to match_schema - expect(report[:licenses]).not_to be_empty - expect(report[:dependencies].count).to be(1) - expect(report.find('six')).not_to be_nil + expect(subject).to match_schema + expect(subject[:licenses]).not_to be_empty + expect(subject[:dependencies].count).to be(1) + expect(subject.find('six')).not_to be_nil end end context "when scanning a simple Pipfile project" do - let(:lockfile_content) { fixture_file_content('python/simple-Pipfile.lock') } + let(:lockfile_content) { fixture_file_content('python/pipenv/simple/Pipfile.lock') } let(:lockfile_hash) { JSON.parse(lockfile_content) } before do - runner.add_file('Pipfile', fixture_file_content('python/simple-Pipfile')) - runner.add_file('Pipfile.lock', lockfile_content) + runner.mount(dir: fixture_file('python/pipenv/simple')) end [2, 3].each do |version| @@ -204,6 +207,12 @@ RSpec.describe "pipenv" do context "when connecting to a private package repository with self signed certificate" do let(:index_url) { "https://pypi.test/simple" } + let(:env) do + { + 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read, + 'PIP_INDEX_URL' => index_url + } + end before do add_host('pypi.test', '127.0.0.1') @@ -214,13 +223,19 @@ RSpec.describe "pipenv" do end it 'downloads the packages and trusts the certificate' do - report = runner.scan(env: { - 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read, - 'PIP_INDEX_URL' => index_url - }) + expect(subject).to match_schema + expect(subject.dependency_names).to include('requests') + end + end + + context "when scanning a project that declares a specific version of python in the lockfile" do + before do + runner.mount(dir: fixture_file('python/pipenv/specific-python-version')) + end - expect(report).to match_schema - expect(report.dependency_names).to include('requests') + specify do + expect(subject).to match_schema + expect(subject.dependency_names).to match_array(%w[Django docutils pytz requests]) end end end diff --git a/spec/integration/ruby/bundler_spec.rb b/spec/integration/ruby/bundler_spec.rb index 30cf776..6cb5543 100644 --- a/spec/integration/ruby/bundler_spec.rb +++ b/spec/integration/ruby/bundler_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "bundler" do @@ -82,8 +84,6 @@ RSpec.describe "bundler" do specify do expect(subject).to match_schema - expect(subject[:licenses]).not_to be_empty - expect(subject[:dependencies]).not_to be_empty expect(subject.dependency_names).to include('rails') expect(subject.dependency_names).to include('vue') end @@ -140,4 +140,24 @@ RSpec.describe "bundler" do expect(subject.licenses_for('spandx')).to match_array(['MIT']) end end + + context "when scanning a jruby project" do + before do + runner.mount(dir: fixture_file('ruby/bundler-jruby')) + end + + pending do + expect(subject).to match_schema + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).not_to include('jruby-profiler-flame_graph_profile_printer') + + expect(subject.dependency_names).to include('activerecord-jdbcpostgresql-adapter') + expect(subject.dependency_names).to include('protobuf_java_helpers') + expect(subject.dependency_names).to include('fast_blank_java') + + expect(subject.licenses_for('activerecord-jdbcpostgresql-adapter')).to match_array(['MIT']) + expect(subject.licenses_for('protobuf_java_helpers')).to match_array(['MIT']) + expect(subject.licenses_for('fast_blank_java')).to match_array(['MIT']) + end + end end diff --git a/spec/integration/rust/cargo_spec.rb b/spec/integration/rust/cargo_spec.rb index 77ad447..3ab010d 100644 --- a/spec/integration/rust/cargo_spec.rb +++ b/spec/integration/rust/cargo_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "cargo" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 81f9164..618175b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'simplecov' require 'license/management' diff --git a/spec/support/fixture_file_helper.rb b/spec/support/fixture_file_helper.rb index 313ee35..f21bfee 100644 --- a/spec/support/fixture_file_helper.rb +++ b/spec/support/fixture_file_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module FixtureFileHelper def fixture_file_content(path, data = {}) content = IO.read(fixture_file(path)) diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb index 9d28871..ec92fb8 100644 --- a/spec/support/integration_test_helper.rb +++ b/spec/support/integration_test_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IntegrationTestHelper def runner(*args) @runner ||= ProjectHelper.new(*args) diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 9f88bf1..71b6efb 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec::Matchers.define :match_schema do |version: License::Management::Report::DEFAULT_VERSION| def schema_for(version) License::Management.root.join("spec/fixtures/schema/v#{version}.json").to_s diff --git a/spec/support/project_helper.rb b/spec/support/project_helper.rb index 4ae490e..f64df98 100644 --- a/spec/support/project_helper.rb +++ b/spec/support/project_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectHelper attr_reader :project_path diff --git a/spec/support/proxy_helper.rb b/spec/support/proxy_helper.rb index 1f31164..63b3910 100644 --- a/spec/support/proxy_helper.rb +++ b/spec/support/proxy_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ProxyHelper def x509_certificate(host) License::Management.root.join("tmp/#{host}.crt") diff --git a/spec/support/report.rb b/spec/support/report.rb index d6546ae..dca3c96 100644 --- a/spec/support/report.rb +++ b/spec/support/report.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Report attr_reader :report diff --git a/spec/support/shared.rb b/spec/support/shared.rb index 49edd45..298d85d 100644 --- a/spec/support/shared.rb +++ b/spec/support/shared.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.shared_examples "each report version" do |language, package_manager, branch = 'master'| ['1.0', '1.1', '2.0', '2.1'].each do |version| context "when generating a `#{version}` report for #{package_manager}" do diff --git a/spec/unit/license/management/report/v2_1_spec.rb b/spec/unit/license/management/report/v2_1_spec.rb index 356648c..b7576df 100644 --- a/spec/unit/license/management/report/v2_1_spec.rb +++ b/spec/unit/license/management/report/v2_1_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe License::Management::Report::V2_1 do describe "#to_h" do context "when choosing an appropriate url for a license" do diff --git a/spec/unit/license/management/report/v2_spec.rb b/spec/unit/license/management/report/v2_spec.rb index e5a941e..1bcdb16 100644 --- a/spec/unit/license/management/report/v2_spec.rb +++ b/spec/unit/license/management/report/v2_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe License::Management::Report::V2 do describe "#to_h" do { diff --git a/spec/unit/license/management/repository_spec.rb b/spec/unit/license/management/repository_spec.rb index a391d09..04eb469 100644 --- a/spec/unit/license/management/repository_spec.rb +++ b/spec/unit/license/management/repository_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe License::Management::Repository do describe "#item_for" do let(:spdx_licenses) { JSON.parse(IO.read('spdx-licenses.json'))['licenses'] } |
