Class: SourceMonitor::Setup::NodeInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/source_monitor/setup/node_installer.rb

Instance Method Summary collapse

Constructor Details

#initialize(root: Pathname.pwd.to_s, shell: ShellRunner.new) ⇒ NodeInstaller

Returns a new instance of NodeInstaller.



8
9
10
11
# File 'lib/source_monitor/setup/node_installer.rb', line 8

def initialize(root: Pathname.pwd.to_s, shell: ShellRunner.new)
  @root = Pathname.new(root)
  @shell = shell
end

Instance Method Details

#install_if_neededObject



13
14
15
16
17
18
# File 'lib/source_monitor/setup/node_installer.rb', line 13

def install_if_needed
  return false unless package_json?

  shell.run("npm", "install")
  true
end