Sha256: 7249aa8607066e7eea0cb377ae500fd684142817cc1e1ee841689eb53edb4bb8

Contents?: true

Size: 1.65 KB

Versions: 39

Compression:

Stored size: 1.65 KB

Contents

#
# Copyright:: Copyright 2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# When using LicenseScout with Omnibus, LicenseScout is run from the bundled
# omnibus process which has a different ruby executable and rubygems directory
# than the project we want to collect licenses for. Bundler will end up loading
# the gemspecs for the gems we are inspecting, so we need to run our query for
# version and license information from a separate process that executes inside
# the target ruby+bundler environment. This script is the thing that runs that
# query; it's intended to be run like
# `/opt/chef/embedded/bin/ruby /path/to/script`. It returns the data
# LicenseScout needs as JSON on stdout.

# We need to load the target project's bundler config, so we have to do a full
# bundler setup:
require "bundler/setup"

# We're only using things that are in the stdlib.
require "json"

dependencies = []

Bundler.load.specs.each do |gem_spec|
  dependencies << {
    name: gem_spec.name,
    version: gem_spec.version.to_s,
    license: gem_spec.license,
    path: gem_spec.full_gem_path,
  }
end

puts JSON.generate(dependencies)

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
license_scout-1.1.9 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.8 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.7 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.6 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.4 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.3 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.1.2 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.29 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.28 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.27 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.26 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.25 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.24 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.22 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.21 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.20 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.19 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.18 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.17 lib/license_scout/dependency_manager/bundler/_bundler_script.rb
license_scout-1.0.16 lib/license_scout/dependency_manager/bundler/_bundler_script.rb