Commit a4c1766 1 parent d7f520c commit a4c1766 Copy full SHA for a4c1766
File tree 8 files changed +18
-18
lines changed
8 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 16
16
# limitations under the License.
17
17
#
18
18
19
- $:. unshift File . expand_path ( "../../ lib" , __FILE__ )
19
+ $:. unshift File . expand_path ( "../lib" , __dir__ )
20
20
21
21
require "license_scout"
22
22
Original file line number Diff line number Diff line change 15
15
# limitations under the License.
16
16
#
17
17
18
- require "zlib" # Temporarily require before rugged to fix https://github.com/prontolabs/pronto/issues/23
18
+ require "zlib" unless defined? ( Zlib ) # Temporarily require before rugged to fix https://github.com/prontolabs/pronto/issues/23
19
19
20
- require "mixlib/cli"
20
+ require "mixlib/cli" unless defined? ( Mixlib :: CLI )
21
21
require "license_scout/config"
22
22
require "license_scout/exporter"
23
23
require "license_scout/collector"
@@ -85,7 +85,7 @@ def run(argv = ARGV)
85
85
86
86
LicenseScout ::Config . config_files . each do |config_file |
87
87
if config_file =~ /^http/
88
- require "open-uri"
88
+ require "open-uri" unless defined? ( OpenURI )
89
89
90
90
LicenseScout ::Log . info ( "[cli] Loading config from #{ config_file } " )
91
91
Original file line number Diff line number Diff line change 15
15
# limitations under the License.
16
16
#
17
17
18
- require "mixlib/config"
19
- require "tmpdir"
18
+ require "mixlib/config" unless defined? ( Mixlib :: Config )
19
+ require "tmpdir" unless defined? ( Dir . mktmpdir )
20
20
21
21
require "license_scout/exceptions"
22
22
require "license_scout/log"
Original file line number Diff line number Diff line change 20
20
require "license_scout/exceptions"
21
21
22
22
require "bundler"
23
- require "ffi_yajl"
24
- require "net/http"
25
- require "mixlib/shellout"
26
- require "pathname"
23
+ require "ffi_yajl" unless defined? ( FFI_Yajl )
24
+ require "net/http" unless defined? ( Net :: HTTP )
25
+ require "mixlib/shellout" unless defined? ( Mixlib :: ShellOut )
26
+ require "pathname" unless defined? ( Pathname )
27
27
require "psych"
28
- require "set"
28
+ require "set" unless defined? ( Set )
29
29
require "toml-rb"
30
- require "yaml"
30
+ require "yaml" unless defined? ( YAML )
31
31
32
32
module LicenseScout
33
33
# The DependencyManager module (or more accurately, implementations of it) are responsible for recognizing
Original file line number Diff line number Diff line change 15
15
# limitations under the License.
16
16
#
17
17
18
- require "csv"
18
+ require "csv" unless defined? ( CSV )
19
19
20
20
module LicenseScout
21
21
class Exporter
Original file line number Diff line number Diff line change 15
15
# limitations under the License.
16
16
#
17
17
18
- require "ffi_yajl"
18
+ require "ffi_yajl" unless defined? ( FFI_Yajl )
19
19
require "terminal-table"
20
20
21
21
require "license_scout/exceptions"
Original file line number Diff line number Diff line change 17
17
18
18
# This library was inspired by (and pulls some logic from) librariesio/spdx
19
19
20
- require "ffi_yajl"
20
+ require "ffi_yajl" unless defined? ( FFI_Yajl )
21
21
require "fuzzy_match"
22
22
23
23
module LicenseScout
@@ -45,12 +45,12 @@ def parse(license_string)
45
45
46
46
# @return [Hash] The SPDX license data in Hash form
47
47
def licenses
48
- @@license_data ||= FFI_Yajl ::Parser . parse ( File . read ( File . expand_path ( "../ data/licenses.json" , __FILE__ ) ) ) [ "licenses" ]
48
+ @@license_data ||= FFI_Yajl ::Parser . parse ( File . read ( File . expand_path ( "data/licenses.json" , __dir__ ) ) ) [ "licenses" ]
49
49
end
50
50
51
51
# @return [Hash] The SPDX license data in Hash form
52
52
def exceptions
53
- @@license_data ||= FFI_Yajl ::Parser . parse ( File . read ( File . expand_path ( "../ data/exceptions.json" , __FILE__ ) ) ) [ "exceptions" ]
53
+ @@license_data ||= FFI_Yajl ::Parser . parse ( File . read ( File . expand_path ( "data/exceptions.json" , __dir__ ) ) ) [ "exceptions" ]
54
54
end
55
55
56
56
def known_ids
Original file line number Diff line number Diff line change 15
15
# limitations under the License.
16
16
#
17
17
18
- lib = File . expand_path ( "../ lib" , __FILE__ )
18
+ lib = File . expand_path ( "lib" , __dir__ )
19
19
$LOAD_PATH. unshift ( lib ) unless $LOAD_PATH. include? ( lib )
20
20
require "license_scout/version"
21
21
You can’t perform that action at this time.
0 commit comments