Class: SourceMonitor::Setup::NodeInstaller
- Inherits:
-
Object
- Object
- SourceMonitor::Setup::NodeInstaller
- Defined in:
- lib/source_monitor/setup/node_installer.rb
Instance Method Summary collapse
-
#initialize(root: Pathname.pwd.to_s, shell: ShellRunner.new) ⇒ NodeInstaller
constructor
A new instance of NodeInstaller.
- #install_if_needed ⇒ Object
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_needed ⇒ Object
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 |