Class: LicenseFinder::NPM
Instance Method Summary
collapse
#active?, #command_exists?, #current_packages_with_relations, #detected_package_path, id, #installed?, #project_root?, takes_priority_over
Constructor Details
#initialize(options = {}) ⇒ NPM
Returns a new instance of NPM.
8
9
10
11
|
# File 'lib/license_finder/package_managers/npm.rb', line 8
def initialize(options = {})
super
@npm_options = options[:npm_options]
end
|
Instance Method Details
#current_packages ⇒ Object
13
14
15
|
# File 'lib/license_finder/package_managers/npm.rb', line 13
def current_packages
NpmPackage.packages_from_json(npm_json, detected_package_path)
end
|
#package_management_command ⇒ Object
17
18
19
|
# File 'lib/license_finder/package_managers/npm.rb', line 17
def package_management_command
'npm'
end
|
#possible_package_paths ⇒ Object
25
26
27
|
# File 'lib/license_finder/package_managers/npm.rb', line 25
def possible_package_paths
[project_path.join('package.json')]
end
|
#prepare ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/license_finder/package_managers/npm.rb', line 29
def prepare
prep_cmd = "#{prepare_command}#{production_flag}"
_stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(prep_cmd) }
return if status.success?
log_errors stderr
raise "Prepare command '#{prep_cmd}' failed" unless @prepare_no_fail
end
|
#prepare_command ⇒ Object
21
22
23
|
# File 'lib/license_finder/package_managers/npm.rb', line 21
def prepare_command
'npm install --no-save --ignore-scripts'
end
|