Class: EY::Serverside::DependencyManager::Npm

Inherits:
Base
  • Object
show all
Defined in:
lib/engineyard-serverside/dependency_manager/npm.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #runner, #servers, #shell

Instance Method Summary collapse

Methods inherited from Base

#check, detect, #initialize, #rails_version, #show_ey_config_instructions, #uses_sqlite3?

Constructor Details

This class inherits a constructor from EY::Serverside::DependencyManager::Base

Instance Method Details

#detected?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/engineyard-serverside/dependency_manager/npm.rb', line 7

def detected?
  paths.package_json.exist?
end

#installObject



11
12
13
14
15
# File 'lib/engineyard-serverside/dependency_manager/npm.rb', line 11

def install
  shell.status "Installing npm packages (package.json detected)"
  run "mkdir -p #{paths.shared_node_modules} && ln -nfs #{paths.shared_node_modules} #{paths.active_node_modules}"
  run %{cd #{paths.active_release} && export GIT_SSH="#{ENV['GIT_SSH']}" && npm install #{npm_install_options.join(" ")}}
end

#npm_install_optionsObject



17
18
19
20
21
# File 'lib/engineyard-serverside/dependency_manager/npm.rb', line 17

def npm_install_options
  options = []
  options += ['--production'] if npm_production?
  options
end

#npm_production?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/engineyard-serverside/dependency_manager/npm.rb', line 23

def npm_production?
  ENV['NODE_ENV'] == 'production'
end