Class: LearnOpen::DependencyInstallers::NodeInstaller

Inherits:
BaseInstaller
  • Object
show all
Defined in:
lib/learn_open/services/dependency_installers/node_package_installer.rb

Instance Attribute Summary

Attributes inherited from BaseInstaller

#environment, #io, #lesson, #location, #system_adapter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseInstaller

call, #initialize

Constructor Details

This class inherits a constructor from LearnOpen::DependencyInstallers::BaseInstaller

Class Method Details

.detect(lesson, location) ⇒ Object



4
5
6
# File 'lib/learn_open/services/dependency_installers/node_package_installer.rb', line 4

def self.detect(lesson, location)
  File.exists?("#{lesson.to_path}/package.json")
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/learn_open/services/dependency_installers/node_package_installer.rb', line 8

def run
  io.puts 'Installing npm dependencies...'

  case environment
  when LearnOpen::Environments::IDEEnvironment
    system_adapter.run_command("yarn install --no-lockfile")
  else
    system_adapter.run_command("npm install")
  end
end