Giter Site home page Giter Site logo

pivotal / licensefinder Goto Github PK

View Code? Open in Web Editor NEW
1.7K 51.0 330.0 5.67 MB

Find licenses for your project's dependencies.

License: MIT License

Shell 0.64% Ruby 95.42% Python 0.14% Erlang 0.02% HTML 1.55% Go 0.06% PowerShell 0.29% Elixir 0.60% Scala 0.04% Dockerfile 1.12% Makefile 0.03% Swift 0.08%
ruby

licensefinder's Introduction

License Finder

Code Climate

Build status

  • Ruby 2.7.8 Ruby 2.7.8 build status
  • Ruby 3.1.4 Ruby 3.1.4 build status
  • Ruby 3.2.3 Ruby 3.2.3 build status
  • Ruby 3.3.0 Ruby 3.3.0 build status

LicenseFinder works with your package managers to find dependencies, detect the licenses of the packages in them, compare those licenses against a user-defined list of permitted licenses, and give you an actionable exception report.

Supported project types

Project Type Package Manager Tested on Version
Ruby Gems bundler 2.3.7
Python 2.7 Eggs pip2 19.0.2
Python 3.5 Eggs pip3 20.0.2
Node.js npm 6.4.1
Bower bower 1.8.4
Nuget (without license discovery) nuget 4.7.1.5393
Godep Godep 80
Go workspace Go lang 1.11.5
Go modules Go lang 1.14.3
Java maven 3.6.0
Java gradle 5.6.4

Experimental project types

  • Erlang (via rebar and Erlang.mk)
  • Objective-C, Swift (via Carthage, CocoaPods [0.39 and below. See CocoaPods Specs Repo Sharding]) and Swift Package Manager(SPM)
  • Elixir (via mix)
  • Golang (via gvt, glide,dep, trash and govendor)
  • JavaScript (via yarn)
  • C++/C (via conan)
  • Scala (via sbt)
  • Rust (via cargo)
  • PHP (via composer)
  • Python (via Conda, pipenv)
  • Flutter (via flutter pub)

Installation

License Finder may be run as a pre-commit hook by adding the following to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/pivotal/LicenseFinder
    rev: v7.1.0 # You probably want the latest tag.
    hooks:
      - id: license-finder

Running License Finder directly requires Ruby 2.6.0 or greater. If you have an older version of Ruby installed, you can update via Homebrew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then:

$ brew install ruby

The easiest way to use license_finder directly is to install it as a command line tool, like brew, awk, gem or bundler:

$ gem install license_finder

Though it's less preferable, if you are using bundler in a Ruby project, you can add license_finder to your Gemfile:

gem 'license_finder', :group => :development

This approach helps you remember to install license_finder, but can pull in unwanted dependencies, including bundler. To mitigate this problem, see Excluding Dependencies.

Usage

Make sure your dependencies are installed (with your package manager's install command: bundle install, npm install, etc.)

The first time you run license_finder it will list all your project's packages.

$ license_finder

Or, if you installed with bundler:

$ bundle exec license_finder

The output will report that none of your packages have been approved. Over time you will tell license_finder which packages are approved, so when you run this command in the future, it will report current action items; i.e., packages that are new or have never been approved.

If you don't wish to see progressive output "dots", use the --quiet option.

If you'd like to see debugging output, use the --debug option. license_finder will then output info about packages, their dependencies, and where and how each license was discovered. This can be useful when you need to track down an unexpected package or license.

If you do not want to manually run an individual package manager's prepare command (ex: bundle install, npm install, etc) to ensure your project is fully prepared to be scanned, use the --prepare or -p option which will run each active package manager's prepare command for you. If you would like to continue running license_finder even if there is an issue with a prepare step, use the --prepare-no-fail option which prepares but carries on despite any potential failures.

Run license_finder help to see other available commands, and license_finder help [COMMAND] for detailed help on a specific command.

Docker

If you have docker installed, try using the included dlf script (potentially symlinked to be in your path via ln -s LicenseFinder/dlf /usr/local/bin or whatever method you prefer). This will run any commands passed to it inside a pre-provisioned Docker container to maintain consistent versions of all the package managers. For example,

$ dlf npm --version
5.3.0

$ dlf license_finder --help

Dependencies that need approval:
...
license_finder, 3.0.3, MIT

$ dlf "bundle install && license_finder"

You can better understand the way this script works by looking at its source, but for reference it will mount your current directory at the path /scan and run any commands passed to it from that directory. If your command has &&, ensure you quote the command. If it does not, ensure the command is not quoted.

Note that the docker image will run the gem which is installed within it. So the docker image tagged 7.0.0 will run License Finder Version 7.0.0

See the contributing guide for information on development.

Activation

license_finder will find and include packages for all supported languages, as long as that language has a package definition in the project directory:

  • Gemfile (for bundler)
  • requirements.txt (for pip)
  • Pipfile.lock (for pipenv)
  • package.json (for npm)
  • pom.xml (for maven)
  • build.gradle or build.gradle.kts (for gradle)
  • settings.gradle that specifies rootProject.buildFileName (for gradle)
  • bower.json (for bower)
  • Podfile (for pod) (set ACKNOWLEDGEMENTS_PATH variable if you want to target a particular Pods-acknowledgements-<TARGET>.plist. Can be useful in multi-target pods projects.)
  • Cartfile (for carthage)
  • workspace-state.json under build directory (provided as enviroment variable SPM_DERIVED_DATA for Xcode, or default .build for non-Xcode projects), (for spm)
  • rebar.config (for rebar)
  • Erlang.mk or erlang.mk file (for Erlang.mk)
  • mix.exs (for mix)
  • packages/ directory (for nuget)
  • *.csproj (for dotnet)
  • vendor/manifest or */vendor/manifest file (for gvt)
  • glide.lock file (for glide)
  • vendor/vendor.json file (for govendor)
  • Gopkg.lock file (for dep)
  • Godeps/Godeps.json (for godep)
  • *.envrc file (for go)
  • go.mod file (for go mod)
  • vendor.conf file (for trash)
  • yarn.lock file (for yarn)
  • conanfile.txt file (for conan)
  • build.sbt file (for sbt)
  • Cargo.lock file (for cargo)
  • composer.lock file (for composer)
  • environment.yml file (for conda)
  • pubspec.yaml & .pub cache locaton through ENV variable (for flutter)

Continuous Integration

license_finder will return a non-zero exit status if there are unapproved dependencies. This can be useful for inclusion in a CI environment to alert you if someone adds an unapproved dependency to the project.

Approving Dependencies

license_finder will inform you whenever you have an unapproved dependency. If your business decides this is an acceptable risk, the easiest way to approve the dependency is by running license_finder approvals add.

For example, let's assume you've added the awesome_gpl_gem to your Gemfile, which license_finder reports is unapproved:

$ license_finder
Dependencies that need approval:
awesome_gpl_gem, 1.0.0, GPL

Your business tells you that in this case, it's acceptable to use this gem. You now run:

$ license_finder approvals add awesome_gpl_gem

If you rerun license_finder, you should no longer see awesome_gpl_gem in the output.

To approve specific version

$ license_finder approvals add awesome_gpl_gem --version=1.0.0

To record who approved the dependency and why:

$ license_finder approvals add awesome_gpl_gem --who CTO --why "Go ahead"

Permitting Licenses

Approving packages one-by-one can be tedious. Usually your business has blanket policies about which packages are approved. To tell license_finder that any package with the MIT license should be approved, run:

$ license_finder permitted_licenses add MIT

Any current or future packages with the MIT license will be excluded from the output of license_finder.

You can also record --who and --why when changing permitted licenses, or making any other decision about your project.

Output and Artifacts

Decisions file

Any decisions you make about approvals will be recorded in a YAML file named doc/dependency_decisions.yml.

This file must be committed to version control. Rarely, you will have to manually resolve conflicts in it. In this situation, keep in mind that each decision has an associated timestamp, and the decisions are processed top-to-bottom, with later decisions overwriting or appending to earlier decisions.

Output from action_items

You could expect license_finder, which is an alias for license_finder action_items to output something like the following on a Rails project where MIT had been permitted:

Dependencies that need approval:

highline, 1.6.14, ruby
json, 1.7.5, ruby
mime-types, 1.19, ruby
rails, 3.2.8, unknown
rdoc, 3.12, unknown
rubyzip, 0.9.9, ruby
xml-simple, 1.1.1, unknown

You can customize the format of the output in the same way that you customize output from report.

Output from project_roots

The license_finder project_roots command will output the current working directory as a string in an array.

Using the --recursive option means the array will include subdirectories that contain a known package manager. With the exception that Gradle and Maven subprojects will not be included.

Output from report

The license_finder report command will output human-readable reports that you could send to your non-technical business partners, lawyers, etc. You can choose the format of the report (text, csv, html or markdown); see license_finder --help report for details. The output is sent to STDOUT, so you can save the reports wherever you want them. You can commit them to version control if you like.

The HTML report generated by license_finder report --format html summarizes all of your project's dependencies and includes information about which need to be approved. The project name at the top of the report can be set with license_finder project_name add.

Note:

When using the yarn package manager, when a node_module's package.json doesn't explicitly declare a license, yarn indicates that it has inferred the license based on some keywords in other files by appending an asterisk to the license name. If you see a * at the end of the license name, this is intended.

See CONTRIBUTING.md for advice about adding and customizing reports.

Manual Intervention

Setting Licenses

When license_finder reports that a dependency's license is 'unknown', you should manually research what the actual license is. When you have established the real license, you can record it with:

$ license_finder licenses add my_unknown_dependency MIT

This command would assign the MIT license to all versions of the dependency my_unknown_dependency. If you prefer, you could instead assign the license to only a specific version of the dependency:

$ license_finder licenses add my_unknown_dependency MIT --version=1.0.0

Please note that adding a license to a specific version of a dependency will cause any licenses previously added to all versions of that dependency to be forgotten. Similarly, adding a license to all versions of a dependency will override any licenses previously added to specific versions of that dependency.

There are several ways in which you can remove licenses that were previously added through the licenses add command:

# Removes all licenses from any version of the dependency
$ license_finder licenses remove my_unknown_dependency

# Removes just the MIT license from any version of the dependency
$ license_finder licenses remove my_unknown_dependency MIT

# Removes all licenses from only version 1.0.0 of the dependency
# This has no effect if you had last added a license to all versions of the dependency
$ license_finder licenses remove my_unknown_dependency --version=1.0.0

# Removes just the MIT license from only version 1.0.0 of the dependency
# This has no effect if you had last added a license to all versions of the dependency
$ license_finder licenses remove my_unknown_dependency MIT --version=1.0.0

Adding Hidden Dependencies

license_finder can track dependencies that your package managers don't know about (JS libraries that don't appear in your Gemfile/requirements.txt/package.json, etc.)

$ license_finder dependencies add my_js_dep MIT 0.1.2

Run license_finder dependencies help for additional documentation about managing these dependencies.

license_finder cannot automatically detect when one of these dependencies has been removed from your project, so you can use:

$ license_finder dependencies remove my_js_dep

Excluding Dependencies

Sometimes a project will have development or test dependencies which you don't want to track. You can exclude theses dependencies by running license_finder ignored_groups. (Currently this only works for packages managed by Bundler, NPM, Yarn, Maven, Pip2, Pip3, and Nuget.)

On rare occasions a package manager will report an individual dependency that you want to exclude from all reports, even though it is approved. You can exclude an individual dependency by running license_finder ignored_dependencies. Think carefully before adding dependencies to this list. A likely item to exclude is bundler, since it is a common dependency whose version changes from machine to machine. Adding it to the ignored_dependencies would prevent it (and its oscillating versions) from appearing in reports.

Restricting Licenses

Some projects will have a list of licenses that cannot be used. You can restrict these licenses with license_finder restricted_licenses add. Any dependency that has exclusively restricted licenses will always appear in the action items, even if someone attempts to manually approve or permit it. However, if a dependency has even one license that is not restricted, it can still be manually approved or permitted.

Decision inheritance

Add or remove decision files you want to inherit from - see license_finder inherited_decisions help for more information.

This allows you to have a centralized decision file for approved/restricted licenses. If you have multiple projects it's way easier to have one single place where you approved or restricted licenses defined.

Add one or more decision files to the inherited decisions

license_finder inherited_decisions add DECISION_FILE

Remove one or more decision files from the inherited decisions

license_finder inherited_decisions remove DECISION_FILE

List all the inherited decision files

license_finder inherited_decisions list

Configuration

Be default, license_finder expects the decisions file to be stored at doc/dependency_decisions.yml. All commands can be passed --decisions_file to override this location.

Package Manager Configuration

If you have a gradle project, you can invoke gradle with a custom script by passing (for example) --gradle_command gradlew to license_finder or license_finder report.

Similarly you can invoke a custom rebar script with --rebar_command rebar. If you store rebar dependencies in a custom directory (by setting deps_dir in rebar.config), set --rebar_deps_dir.

You can also invoke a custom Mix script remix with --mix_command remix and set --mix_deps_dir to fetch Mix dependencies from a custom directory.

Narrow down Package Manager

By default, license_finder will check for all supported package managers, but you can narrow it down to use only those you pass to --enabled-package-managers. For example,

$ license_finder --enabled-package-managers bundler npm

Saving Configuration

It may be difficult to remember to pass command line options to every command. In some of these cases you can store default values in a YAML formatted config file. license_finder looks for this file in config/license_finder.yml.

As an example, the file might look like this:

---
decisions_file: './some_path/decisions.yml'
gradle_command: './gradlew'
rebar_command: './rebarw'
rebar_deps_dir: './rebar_deps'
mix_command: './mixw'
mix_deps_dir: './mix_deps'
enabled_package_managers:
  - bundler
  - gradle
  - rebar
  - mix

Gradle Projects

license_finder supports both Gradle 1.x and Gradle 2.x. You need to have installed the license-gradle-plugin in your project: https://github.com/hierynomus/license-gradle-plugin

By default, license_finder will report on Gradle's "runtime" dependencies. If you want to generate a report for some other dependency configuration (e.g. Android projects will sometimes specify their meaningful dependencies in the "compile" group), you can specify it in your project's build.gradle:

// Must come *after* applying the appropriate plugin from [https://github.com/hierynomus/license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin)

downloadLicenses {
  dependencyConfiguration "compile"
}

Conan Projects

license_finder supports Conan. You need to have the following lines in your conanfile.txt for license_finder to retrieve dependencies' licenses. Ensure that conan install does not generate an error.

[imports]
., license* -> ./licenses @ folder=True, ignore_case=True

SBT Projects

license_finder supports SBT. You need to have installed the sbt-license-report in your project: https://github.com/sbt/sbt-license-report

By default, license_finder will report on SBT's "compile" and "test" dependencies. If you want to generate a report for some other dependency configuration, you can specify it in your projects's build.sbt

licenseConfigurations := Set("compile", "provided")

Requirements

license_finder requires ruby >= 2.6.0.

Upgrading

To upgrade to license_finder version >= 6.0, you have to replace the terminology whitelist with permit and blacklist with restrict in your dependency_decisions.yml. See Changelog for more details.

To upgrade from license_finder version 1.2 to 2.0, see license_finder_upgrade. To upgrade to 2.0 from a version lower than 1.2, first upgrade to 1.2, and run license_finder at least once. This will ensure that the license_finder database is in a state which license_finder_upgrade understands.

A Plea to Package Authors and Maintainers

Please add a license to your package specs! Most packaging systems allow for the specification of one or more licenses.

For example, Ruby Gems can specify a license by name:

Gem::Specification.new do |s|
  s.name = "my_great_gem"
  s.license = "MIT"
end

And save a LICENSE file which contains your license text in your repo.

Known issues with specific package managers

  • Bundler

    • When using --project-path, Bundler cannot find the Gemfile.
  • Yarn

    • A module that is incompatible with the platform on which license_finder is run will always be reported to have a license type of "unknown". (#456)

Support

Contributing

See CONTRIBUTING.md.

License

LicenseFinder is released under the MIT License. http://www.opensource.org/licenses/mit-license

licensefinder's People

Contributors

aminjam avatar brentwheeldon avatar cf-osl-bot avatar danielgrippi avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar erd avatar etiennecadicidean avatar flavorjones avatar forelabs avatar gerhard avatar grosser avatar jasonmswrve avatar julia-pu avatar lukebakken avatar lukewinikates avatar mainej avatar manifaust avatar mkoertgen avatar osis avatar pivotal-jeff-jun avatar pivotal-pmital avatar rhuitl avatar sschuberth avatar xlgmokha avatar xtreme-debbie-chen avatar xtreme-jason-smith avatar xtreme-lisheng-tai avatar xtreme-shane-lattanzio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

licensefinder's Issues

Add rake task that can be used on CI

As a developer
I want to be able to add a rake task to my CI build that will fail if there are license action items to address
So that I don't inadvertently add a dependency to my app that the client doesn't want

One option would be to add a new rake task like so:

namespace :license do
  desc 'checks whether there are action items and returns a 0 or a 1 - useful for ci'
  task :check => :generate_dependencies do
    action_items = LicenseFinder::Finder.new.action_items
    if action_items.present?
      puts "License action items:", action_items
      exit -1
    else
      exit 0
    end
  end
end

The other option would be to update the license:actions task to exit with a non-zero return code if there are any actions to take.

Charles LeRose and Jeff Dean

License files and readme files should not use absolute paths

We're working on a project where not all developers are on Pivotal machines. Because of the different usernames, our dependency files continue changing every time a new machine runs specs, because we get changes between lines like these:

license_files:
  - /Users/pivotal/.rvm/gems/ruby-1.9.3-p194@project/gems/rake-0.9.2.2/MIT-LICENSE

license_files:
  - /Users/johndoe/.rvm/gems/ruby-1.9.3-p194@project/gems/rake-0.9.2.2/MIT-LICENSE

Ideally we could pass an option to LicenseFinder to use relative paths from the home directory, or from the gem path.

could use an option to remove the spinner for license finder

The spinner creates some really interesting log files on jenkins. Our last run generated about 50MB of this:

 ------ \ ----------
 ---------- | ----------
 ---------- / ----------
 ---------- - ----------
 ---------- \ ----------
 ---------- | ----------
...

Timestamp only when dependencies change

In certain projects it's necessary to check in doc/dependencies.*, and we want developers running license_finder frequently. We'd prefer if the timestamps in dependencies.html/md/etc only changed when the dependencies changed, or at least if there were an option to enable this behavior.

Also, you may want to consider using an ISO timestamp. Otherwise the timestamp will thrash depending on the timezone setting of the machine on which license_finder runs.

Example diff:

diff --git a/doc/dependencies.html b/doc/dependencies.html
index cc48bab..f4207c9 100644
--- a/doc/dependencies.html
+++ b/doc/dependencies.html
@@ -29,7 +29,7 @@
       <div class="span5">
         <h2>Dependencies</h2>

-        <p>As of September 22, 2014  6:28pm</p>
+        <p>As of September 22, 2014  6:57pm</p>

         <h4>12 total</h4>

diff --git a/doc/dependencies.md b/doc/dependencies.md
index 85f6e0a..a44df6d 100644
--- a/doc/dependencies.md
+++ b/doc/dependencies.md
@@ -1,6 +1,6 @@
 # Node Gemfire

-As of September 22, 2014  6:28pm. 12 total
+As of September 22, 2014  6:57pm. 12 total

 ## Summary
 * 10 MIT

cc @nertzy

Doesn't work under Ruby 2.0.0

When we run license finder under Ruby 2.0.0, we get the following error:

/Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/bundled_gem_saver.rb:3:in <class:BundledGemSaver>': uninitialized constant LicenseFinder::BundledGemSaver::Forwardable (NameError) from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/bundled_gem_saver.rb:2:inmodule:LicenseFinder'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/bundled_gem_saver.rb:1:in <top (required)>' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/dependency_manager.rb:7:inblock in sync_with_bundler'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/dependency_manager.rb:39:in modifying' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/dependency_manager.rb:6:insync_with_bundler'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/cli.rb:153:in block (2 levels) in rescan' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/cli.rb:218:inspinner'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/cli.rb:152:in block in rescan' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/cli.rb:15:indie_on_error'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/lib/license_finder/cli.rb:151:in rescan' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/thor-0.18.1/lib/thor/command.rb:27:inrun'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/thor-0.18.1/lib/thor.rb:363:indispatch'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.9.1/bin/license_finder:5:in<top (required)>'
from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/license_finder:23:in load' from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/license_finder:23:in

'

licenses in node.js aren't discovered for children of project dependencies.

This is easiest to describe with an example.
Assume A1 is dependent on L1 as described in A1's package.json.
Also, L1 is dependent on L2 as described in L1's package.json.

license_finder will only discover the license for L1 and NOT for L2.
What's required to fix this? It would seem that anybody using license_finder will care not only about the direct dependencies but also the indirect ones through the dependent packages.

Error using -a under 1.8 (ree)

bundle exec license_finder -a acts_as_list

The acts_as_list has been approved!

/home/user/.rvm/gems/ree-1.8.7-2012.02@project/bundler/gems/LicenseFinder-8c1c23df95b9/bin/license_finder:12:in run': private methodclass_variable_get' called for LicenseFinder::CLI:Module (NoMethodError)

Do not execute in the context of the current repositories bundle

atm license finder loads the bundle of the repo it is in, which means loading older versions of json/bundler etc, that might conflict with the currently activated version / might not be installed on the system ('bundle --path vendor/bundle').

I'm hacking the GEM_PATH AS workaround but it's pretty ugly, so ideally the bundle inspector should just shell out to bundle exec ruby -e something and parse the result (Marshal dump + load ?) and then construct it's dependency graph from this list.

Broken build due to missing Gemfile.lock

Since there is no Gemfile.lock, gems are whatever is newest when the person pulls down the repo. I'm not sure what the motivation was for this, but the current behavior is that the build is actually broken and Travis isn't saying anything until the next time someone pushes.

Line 21 in spec_helper.rb

/Users/jboyens/.rvm/gems/ruby-1.9.3-p194@LicenseFinder/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in initialize': SQLite3::SQLException: near "ancestries": syntax error (Sequel::DatabaseError)`

LicenseFinder dependency on bundler creates unexpected diffs

LicenseFinder itself has a dependency on Bundler, which it is then tracking as a project dependency. Because the bundler version is not specified in the gem, we get diffs with different bundler versions on different machines. Arguably bundler is a tool, not a dependency, so it should not be in the LicenseFinder gemspec.

Recommended way to include in CI/rake?

This would be great to include in my CI environment, but I note that the old tasks mentioned in #3 and #9 have gone away, and that the one remaining rake task is deprecated. Is there a recommended way to include license_finder in a CI build?

Wrong license for pg?

license_finder shows a BSD license (4-clause) for pg, while looking at the project itself I think it should be ruby or SimplifiedBSD (2-clause).

Also: How about multi-license models? The Ruby license actually gives you the choice between 2-clause BSD (or GPLv2 in older versions) and its custom license text.

Does not work on 1.8

if that's intentional, fix it, otherwise document in gemspec with ruby_version >= 1.9.3

license_finder
/opt/boxen/rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:711:in `load': /opt/boxen/rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/gems/license_finder-0.9.3/db/migrate/201303290935_create_dependencies.rb:7: syntax error, unexpected ':', expecting kEND (SyntaxError)
      String :name, null: false
                         ^
/opt/boxen/rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/gems/license_finder-0.9.3/db/migrate/201303290935_create_dependencies.rb:8: syntax error, unexpected ':', expecting kEND
      String :version, null: false
                            ^
    from /opt/boxen/rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:711:in `get_migration_tuples'
    from /opt/boxen/rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:697:in `each'

Support node dependency groups

Currently LicenseFinder is punting on the existence of npm dependency groups (e.g. "dependencies" vs "devDependencies"). It would be great to be able to exclude npm devDependencies the same way you can exclude bundler groups.

cc @nertzy

manually approving rdoc fails

When trying to approve rdoc manually it fails with the below error.

ยฑ ga+dlb |master โœ—| โ†’ license_finder -a rdoc

/Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/gems/license_finder-0.8.1/lib/license_finder/tables/dependency.rb:18:in approve!': undefined methodstate=' for nil:NilClass (NoMethodError)
from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/gems/license_finder-0.8.1/lib/license_finder/cli.rb:33:in execute!' from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/gems/license_finder-0.8.1/bin/license_finder:64:inblock in <top (required)>'
from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/gems/license_finder-0.8.1/bin/license_finder:17:in run' from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/gems/license_finder-0.8.1/bin/license_finder:63:in<top (required)>'
from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/bin/license_finder:19:in load' from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/bin/license_finder:19:in

'
from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/bin/ruby_noexec_wrapper:14:in eval' from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392@push/bin/ruby_noexec_wrapper:14:in'

`license_finder -a json` raises an exception

dickinson:NYCVotes (master) dg gh$ license_finder

Dependencies that need approval:
json, 1.7.7, other
pg, 0.15.0, BSD
rails, 3.2.13, other
rdoc, 3.12.2, other
thin, 1.5.1, Ruby
dickinson:NYCVotes (master) dg gh$ license_finder -a json

/Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.8.1/lib/license_finder/tables/dependency.rb:18:in `approve!': undefined method `state=' for nil:NilClass (NoMethodError)
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.8.1/lib/license_finder/cli.rb:33:in `execute!'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.8.1/bin/license_finder:64:in `block in <top (required)>'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.8.1/bin/license_finder:17:in `run'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/gems/license_finder-0.8.1/bin/license_finder:63:in `<top (required)>'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/license_finder:23:in `load'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/license_finder:23:in `<main>'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/pivotal/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

Failure on initial run

$ gem install license_finder
Fetching: sequel-4.0.0.gem (100%)
Successfully installed sequel-4.0.0
Fetching: license_finder-0.8.2.gem (100%)
Successfully installed license_finder-0.8.2
2 gems installed
$ rbenv rehash
$ license_finder 
/Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/lib/license_finder/configuration.rb:15:in `make_config_file': uninitialized constant LicenseFinder::Configuration::FileUtils (NameError)
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/lib/license_finder/configuration.rb:10:in `ensure_default'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/lib/license_finder.rb:34:in `config'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/lib/license_finder/tables.rb:5:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/lib/license_finder.rb:43:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/license_finder-0.8.2/bin/license_finder:3:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/bin/license_finder:23:in `load'
    from /Users/mrm/.rbenv/versions/2.0.0-p195/bin/license_finder:23:in `<main>'
$ rbenv local
2.0.0-p195

Same thing with 1.9.3, fwiw:

$ rbenv local 1.9.3-p429 
$ gem install license_finder
Fetching: sequel-4.0.0.gem (100%)hs
Successfully installed sequel-4.0.0
Fetching: license_finder-0.8.2.gem (100%)
Successfully installed license_finder-0.8.2
2 gems installed

$ rbenv rehash
$ license_finder 
/Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/lib/license_finder/configuration.rb:15:in `make_config_file': uninitialized constant LicenseFinder::Configuration::FileUtils (NameError)
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/lib/license_finder/configuration.rb:10:in `ensure_default'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/lib/license_finder.rb:34:in `config'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/lib/license_finder/tables.rb:5:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/lib/license_finder.rb:43:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/license_finder-0.8.2/bin/license_finder:3:in `<top (required)>'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/bin/license_finder:23:in `load'
    from /Users/mrm/.rbenv/versions/1.9.3-p429/bin/license_finder:23:in `<main>'

license_finder 0.8.2 and later all fail with '`<class:Dependencies>': undefined method `option' for LicenseFinder::CLI::Dependencies:Class (NoMethodError)'

Ruby 1.9.2-p290
Rails 3.0.20

Upgrading license_finder to 0.8.2 or any later version results in the error:

<class:Dependencies>': undefined methodoption' for LicenseFinder::CLI::Dependencies:Class (NoMethodError)

being thrown when running

license_finder

Apparently, it is failing on this line in cli.rb (next line after the class Dependencies < Base line):

option :approve, type: :boolean, aliases: :a

Not sure what's going on here - I can't tell where the class level "option" method is defined. I thought perhaps this was a Ruby version issue, but couldn't verify it.

migrate/201303290935_create_dependencies.rb:7: syntax error

Hi,
with rails 3.2.13, ruby 1.8.7, sequel 4.5.0, licence_finder 0.9.3
when executing license_finder, having this syntax error :

/usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:711:in load': /usr/lib/ruby/gems/1.8/gems/license_finder-0.9.3/db/migrate/201303290935_create_dependencies.rb:7: syntax error, unexpected ':', expecting kEND (SyntaxError) String :name, null: false ^ /usr/lib/ruby/gems/1.8/gems/license_finder-0.9.3/db/migrate/201303290935_create_dependencies.rb:8: syntax error, unexpected ':', expecting kEND String :version, null: false ^ from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:711:inget_migration_tuples'
from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:697:in each' from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:697:inget_migration_tuples'
from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:634:in initialize' from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:390:innew'
from /usr/lib/ruby/gems/1.8/gems/sequel-4.5.0/lib/sequel/extensions/migration.rb:390:in run' from /usr/lib/ruby/gems/1.8/gems/license_finder-0.9.3/lib/license_finder/tables.rb:7 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in require' from /usr/lib/ruby/gems/1.8/gems/license_finder-0.9.3/lib/license_finder.rb:42 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in require' from /usr/lib/ruby/gems/1.8/gems/license_finder-0.9.3/bin/license_finder:3 from /usr/bin/license_finder:19:inload'
from /usr/bin/license_finder:19

regards

handling of multiple licenses could use better documentation

License Finder detects dependencies that have multiple licenses, but it doesn't treat them as approved if one of the licenses is whitelisted. License Finder seems to be taking a conservative approach, but the README isn't making it clear what users should do in this case. If the expectation is that dual-licensed dependencies must always be manually approved, this could be made clearer.

For example: Our Gemfile includes newrelic_rpm, which is triple-licensed under the New Relic, MIT, and Ruby licenses. Our whitelist includes MIT and Ruby, but the newrelic_rpm gem still gets flagged as needing approval.

โ†’ license_finder

Ignored Dependencies:
(none)
Dependencies that need approval:
newrelic_rpm, 3.8.1.221, multiple licenses: New Relic, MIT, ruby
license_finder.yml

---
whitelist:
- MIT
- ruby
- Apache 2.0
- Apache 1.1
- NewBSD

Does not work with LICENSE as a directory

havemeyer:~/workspace/abc (master)$ rake license:generate_dependencies
rake aborted!
Is a directory - /Users/pivotal/.rvm/gems/ruby-1.9.2-p180@abc/gems/ansi-1.3.0/LICENSE

Tasks: TOP => license:generate_dependencies
(See full trace by running task with --trace)
havemeyer:~/workspace/abc (master)$ ls -la /Users/pivotal/.rvm/gems/ruby-1.9.2-p180@abc/gems/ansi-1.3.0/LICENSE
total 64
drwxr-xr-x 6 pivotal staff 204 Aug 22 10:39 .
drwxr-xr-x 10 pivotal staff 340 Aug 22 10:39 ..
-rw-r--r-- 1 pivotal staff 1475 Aug 22 10:39 BSD-2-Clause.txt
-rw-r--r-- 1 pivotal staff 18091 Aug 22 10:39 GPL-2.0.txt
-rw-r--r-- 1 pivotal staff 1037 Aug 22 10:39 MIT.txt
-rw-r--r-- 1 pivotal staff 2580 Aug 22 10:39 RUBY.txt

Outdated README

As I can see there are no more license_finder help or license_finder approve commands.
They are available on -h and -a command line options.
Readme still displays commands

Readme is out of date

It references license_finder license but license_finder --help shows license_finder -l

Version 1.0.1 can't be installed on jRuby

Everything work great on MRI, but bundle update license_finder on jRuby ends up with something like this:

...
Installing sqlite3 (1.3.9)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/mekssart/.rvm/rubies/jruby-1.7.11/bin/jruby extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.

   (root) at /Users/mekssart/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1085
   (root) at /Users/mekssart/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
   (root) at extconf.rb:3

extconf failed, uncaught signal 1

Gem files will remain installed in /Users/mekssart/.rvm/gems/jruby-1.7.11@mytime2/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/mekssart/.rvm/gems/jruby-1.7.11@mytime2/extensions/universal-java-1.7/1.9/sqlite3-1.3.9/gem_make.out

An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.

It seems that you forgot to release jRuby version to ruby gems, so it should install jdbc-sqlite3 instead as a dependency in this step. Could you please release it?

Installation documentation is misleading

The installation documentation suggests that you add license_finder to your Gemfile. This is one way to install license_finder, but it's not ideal. gem install license_finder also works, and doesn't add license_finder (or its dependencies) as a project dependency. The only reason to have a production dependency on LF (and therefore to care about its license) is if you actually use its code somewhere in your own Ruby code.

The documentation should:

  • suggest gem install license_finder followed by license_finder, or
  • suggest adding license_finder as a "development" dependency, so it can be excluded from the dependency list with the "ignored_bundler_groups" configuration, or
  • both.

More generally, LF is no longer a Rails plugin. It is a command-line tool that happens to be written in Ruby. It interacts with Bundler, along with many other language's package managers. If it's being used on a Python project, there's no reason to suggest a Gemfile - gem install license_finder is more appropriate.

I'm bringing this up because there are regular github issues about license_finder's own license. That suggests people are tracking it (and worrying about it) when it's very unlikely they need to care.

ignore_groups isn't ignoring some of our bundler groups

We have multiple group blocks in our Gemfile. Some of them are for multiple groups, and some are for just one. Like this:

group :development do
  gem "some_gem"
end

group :test, :development do
  gem "another_gem
end

platforms :jruby do
  group :development do
    gem "yet_another_gem"
  end
end

Our config/license_finder.yml has

ignore_groups:
- development
- test

But we are seeing some of the development gems show up in our dependencies. They also trigger license warnings when we run our audits.

The definition of irony

LicenseFinder 0.8.1 depends on the sqlite3 gem, which has a license type of "other," so it needs approval.

Wrong license for ansi

LicenseFinder detects a GPLv2 license for the ansi gem. The only mention of GPL I found is in the NOTICE.md file, while README.md, LICENSE.txt and also NOTICE.md all specify the FreeBSD license for the gem.

Several MIT-licensed libraries are "other"

Using the 1.0.0.0 Ruby release, I've noticed that several libraries which have licenses defined in their gemspecs do not get their license properly recognized by license_finder. This occurs with an empty dependencies.db (new project). It has occurred both locally and on Travis CI.

Surprisingly, license_finder is one of the unrecognized offenders; along with minitest, addressable, json, and sqlite3.

Javascript dependencies

Before the introduction of sqlite, I could add javascript dependencies to the yml file and track them as well. When I pulled the new version, all those dependencies are gone now, and I don't see how I could add them again.

Error when running in node.js project: undefined method `downcase' for ["type", "BSD"]:Array (NoMethodError)

Getting the following error when running license_finder in a node project with ruby-1.9.3-p392 or ruby-2.1.2p95

/Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license.rb:42:in `map': undefined method `downcase' for ["type", "BSD"]:Array (NoMethodError)
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license.rb:42:in `matches_name?'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license/definitions.rb:35:in `block in whitelist_if_necessary'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license/definitions.rb:35:in `each'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license/definitions.rb:35:in `any?'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license/definitions.rb:35:in `whitelist_if_necessary'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license/definitions.rb:29:in `build_unrecognized'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/license.rb:10:in `find_by_name'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package.rb:46:in `block in licenses_from_spec'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package.rb:45:in `map'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package.rb:45:in `licenses_from_spec'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package.rb:27:in `determine_license'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package.rb:21:in `license'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package_saver.rb:28:in `save'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package_saver.rb:12:in `block in save_all'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package_saver.rb:11:in `map'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/package_saver.rb:11:in `save_all'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/dependency_manager.rb:7:in `block in sync_with_package_managers'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/dependency_manager.rb:38:in `block in modifying'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/database/transactions.rb:126:in `_transaction'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/database/transactions.rb:100:in `block in transaction'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/database/connecting.rb:229:in `block in synchronize'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/connection_pool/threaded.rb:104:in `hold'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/database/connecting.rb:229:in `synchronize'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/sequel-4.12.0/lib/sequel/database/transactions.rb:89:in `transaction'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/dependency_manager.rb:38:in `modifying'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/dependency_manager.rb:6:in `sync_with_package_managers'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:17:in `block (2 levels) in sync_with_spinner'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:42:in `spinner'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:16:in `block in sync_with_spinner'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:23:in `die_on_error'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:15:in `sync_with_spinner'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/lib/license_finder/cli.rb:220:in `rescan'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/gems/license_finder-1.1.0/bin/license_finder:5:in `<top (required)>'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/bin/license_finder:19:in `load'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/bin/license_finder:19:in `<main>'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/bin/ruby_executable_hooks:15:in `eval'
    from /Users/pivotal/.rvm/gems/ruby-1.9.3-p392/bin/ruby_executable_hooks:15:in `<main>'

The package.json looks like this:

{
  "name": "junglebear",
  "version": "0.0.0",
  "repository": {
    "type": "git",
    "url": "AWESOME_CODE"
  },
  "dependencies": {},
  "devDependencies": {
    "buffer-crc32": "^0.2.1",
    "connect": "^3.0.1",
    "formidable": "^1.0.14",
    "grunt": "~0.4.1",
    "grunt-autoprefixer": "~0.2.0",
    "grunt-bower-install": "~0.5.0",
    "grunt-concurrent": "~0.3.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-compass": "~0.5.0",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-cssmin": "~0.6.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.2.0",
    "grunt-contrib-jshint": "~0.6.3",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-karma": "~0.7.1",
    "grunt-mocha": "~0.4.0",
    "grunt-phonegap": "~0.6.2",
    "grunt-rev": "~0.1.0",
    "grunt-svgmin": "~0.2.0",
    "grunt-usemin": "~0.1.10",
    "load-grunt-tasks": "~0.1.0",
    "send": "^0.1.1",
    "time-grunt": "~0.1.1"
  },
  "engines": {
    "node": ">=0.8.0"
  }
}

No such file or directory - git ls-files in Cucumber Spec with LicenseFinder

When I've included license_finder in my development group

    group :development do
      gem 'license_finder', :git => "https://github.com/pivotal/LicenseFinder.git"
      gem 'pivotal_git_scripts'
    end

And I run a plain cucumber spec in RubyMine I get this output:

Testing started at 12:02 PM ...
/Users/pivotal/.rvm/gems/ruby-1.9.2-p180@sumuru/bundler/gems/LicenseFinder-7fd224f264a1/license_finder.gemspec:19:in ``': No such file or directory - git ls-files (Errno::ENOENT)
    from /Users/pivotal/.rvm/gems/ruby-1.9.2-p180@sumuru/bundler/gems/LicenseFinder-7fd224f264a1/license_finder.gemspec:19:in `block in <main>'
    from /Users/pivotal/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:349:in `initialize'

When I remove license finder, everything works appropriately.

near "DEFAULT": syntax error by running license_finder

By running license_finder

Error is raised in:

license_finder-0.9.3/lib/license_finder/tables/dependency.rb:53:in `ensure_approval_exists!'

When I change

self.approval = Approval.create

to

app = Approval.new
app.id = nil
app.save
self.approval = app

then there is no error

I am using 3.8.1 sqllite3

NPM License Finder Error - undefined method `fetch'

Here is the full error log:

/Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/npm.rb:21:in `block in current_modules': undefined method `fetch' for "1.8.1":String (NoMethodError)
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/npm.rb:19:in `map'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/npm.rb:19:in `current_modules'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/dependency_manager.rb:18:in `block in sync_with_bundler'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/dependency_manager.rb:56:in `modifying'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/dependency_manager.rb:6:in `sync_with_bundler'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/cli.rb:157:in `block (2 levels) in rescan'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/cli.rb:222:in `spinner'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/cli.rb:156:in `block in rescan'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/cli.rb:15:in `die_on_error'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/lib/license_finder/cli.rb:155:in `rescan'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/gems/license_finder-0.9.4/bin/license_finder:5:in `<top (required)>'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/bin/license_finder:23:in `load'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/bin/license_finder:23:in `<main>'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
    from /Users/brettchalupa/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'

Here is the package.json:

{
  "name": "supermarket",
  "devDependencies": {
    "chai": "1.8.1",
    "karma": "0.10.2",
    "karma-mocha": "0.1.0",
    "karma-osx-reporter": "0.0.3",
    "karma-spec-reporter": "0.0.6",
    "mocha": "1.13.0",
    "sprockets-chain": "0.0.9"
  }
}

It looks like fetch is not working for the NPM dependencies specified in the package.json. Am I doing something wrong? Thanks a lot!

edit: Is there a way to ignore NPM license finding?

edit2: Some more information:

  • Ruby 2.0.0
  • Rails 4.0.x
  • NPM 1.3.21
  • On OS X 10.9

Downgrading from master branch to released (0.8.1) version of license_finder causes failure

In an attempt to verify the issue in #27 I updated my Gemfile to use master branch HEAD. When this failed, I then attempted to downgrade back to the released version of license_finder (0.8.1), and now I get this error:

$ license_finder
/Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/sequel-3.48.0/lib/sequel/extensions/migration.rb:678:in get_applied_migrations': Applied migration files not in file system: 201304181524_add_manual_to_dependencies.rb (Sequel::Migrator::Error) from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/sequel-3.48.0/lib/sequel/extensions/migration.rb:634:ininitialize'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/sequel-3.48.0/lib/sequel/extensions/migration.rb:390:in new' from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/sequel-3.48.0/lib/sequel/extensions/migration.rb:390:inrun'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/license_finder-0.8.1/lib/license_finder/tables.rb:7:in <top (required)>' from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/license_finder-0.8.1/lib/license_finder.rb:45:inrequire'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/license_finder-0.8.1/lib/license_finder.rb:45:in <top (required)>' from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/license_finder-0.8.1/bin/license_finder:3:inrequire'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/gems/license_finder-0.8.1/bin/license_finder:3:in <top (required)>' from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/bin/license_finder:19:inload'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/bin/license_finder:19:in <main>' from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/bin/ruby_noexec_wrapper:14:ineval'
from /Users/weyus/.rvm/gems/ruby-1.9.2-p290@redflag/bin/ruby_noexec_wrapper:14:in `

'

Even if I uninstall license_finder and reinstall using 'bundle install', I get this.

List Project URL

This gem creates a CSV file that lists the Name, Version, License

Is there a way to add a 4th value as "URL" and fill with the appropriate URL. For example, gems would list the Homepage and for node modules the Repository?

Thanks

Approving the sqlite3 gem causes an exception

When approving the new sqlite3 gem (now required by this library), an exception occurs:

$ license_finder

Dependencies that need approval:
sqlite3, 1.3.7, BSD3

$ license_finder -a sqlite3

/Users/name/.rvm/gems/ruby-1.9.3-p0@course/gems/license_finder-0.8.1/lib/license_finder/tables/dependency.rb:18:in `approve!': undefined method `state=' for nil:NilClass (NoMethodError)
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/gems/license_finder-0.8.1/lib/license_finder/cli.rb:33:in `execute!'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/gems/license_finder-0.8.1/bin/license_finder:64:in `block in <top (required)>'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/gems/license_finder-0.8.1/bin/license_finder:17:in `run'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/gems/license_finder-0.8.1/bin/license_finder:63:in `<top (required)>'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/bin/license_finder:23:in `load'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/bin/license_finder:23:in `<main>'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/name/.rvm/gems/ruby-1.9.3-p0@course/bin/ruby_noexec_wrapper:14:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.