class PoiseJavascript::JavascriptProviders::System

Public Class Methods

provides_auto?(node, resource) click to toggle source
Calls superclass method
# File lib/poise_javascript/javascript_providers/system.rb, line 39
def self.provides_auto?(node, resource)
  # Don't auto on platforms I know have no system package by default. Kind
  # of pointless since the nodejs provider will hit on these platforms
  # anyway so this shouldn't ever happen.
  super && !node.platform_family?('rhel') && !node.platform?('amazon')
end

Public Instance Methods

javascript_binary() click to toggle source
# File lib/poise_javascript/javascript_providers/system.rb, line 46
def javascript_binary
  # Debian and Ubuntu after 12.04 changed the binary name ಠ_ಠ.
  binary_name = node.value_for_platform(debian: {default: 'nodejs'}, ubuntu: {'12.04' => 'node', default: 'nodejs'}, default: 'node')
  ::File.join('', 'usr', 'bin', binary_name)
end

Private Instance Methods

install_javascript() click to toggle source
# File lib/poise_javascript/javascript_providers/system.rb, line 54
def install_javascript
  install_system_packages
  package %w{npm nodejs-legacy} if node.platform_family?('debian')
end
system_package_candidates(version) click to toggle source
# File lib/poise_javascript/javascript_providers/system.rb, line 64
def system_package_candidates(version)
  # Boring :-(.
  %w{nodejs nodejs-legacy node}
end
uninstall_javascript() click to toggle source
# File lib/poise_javascript/javascript_providers/system.rb, line 59
def uninstall_javascript
  uninstall_system_packages
  package(%w{npm nodejs-legacy}) { action :purge } if node.platform_family?('debian')
end