Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: saltstack-formulas/node-formula
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: tfolio/node-formula
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: tfolio
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 7 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 21, 2015

  1. Copy the full SHA
    bab4d32 View commit details
  2. Copy the full SHA
    9590c23 View commit details

Commits on Oct 22, 2015

  1. Allow Debian to install from the Nodesource repository

    Also fixes the npm_requirement mapped variable when using that repository.
    malept committed Oct 22, 2015
    Copy the full SHA
    4fe5469 View commit details

Commits on Sep 18, 2016

  1. Set variables

    malept committed Sep 18, 2016
    Copy the full SHA
    c375ff3 View commit details
  2. Copy the full SHA
    117adf3 View commit details

Commits on Mar 6, 2017

  1. Update default Node

    malept committed Mar 6, 2017
    Copy the full SHA
    5135c51 View commit details
  2. Copy the full SHA
    f7d37ab View commit details
Showing with 20 additions and 24 deletions.
  1. +13 −13 node/map.jinja
  2. +7 −11 node/pkg.sls
26 changes: 13 additions & 13 deletions node/map.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% set pillar_get = salt['pillar.get'] -%}
{% set install_from_ppa = pillar_get('node:install_from_ppa') %}
{% set install_from_source = pillar_get('node:install_from_source') %}

{% if pillar_get('node:install_from_source') %}
{% if install_from_source %}
{% set default_npm_prefix = '/usr/local' %}
{% else %}
{% set default_npm_prefix = '/usr' %}
@@ -9,28 +11,26 @@
{% set npm_bin = '{0}/bin/npm'.format(npm_prefix) %}
{% set npm_src_requirement = 'file: {0}'.format(npm_bin) %}

{% if npm_prefix == '/usr' %}
{% if npm_prefix == '/usr' and not (install_from_ppa and 'deb.nodesource.com' in pillar_get('node:ppa:repository_url', '')) %}
{% set npmrc_prefix = '' %}
{% else %}
{% set npmrc_prefix = npm_prefix %}
{% endif %}
{% set npmrc = '{0}/etc/npmrc'.format(npmrc_prefix) %}

{% set npm_requirement = 'pkg: npm' %}

{% if pillar_get('node:install_from_source') %}
{% set npm_requirement = npm_src_requirement %}
{% elif grains['os'] == 'Debian' and grains['osrelease']|float < 8 %}
{% set npm_requirement = npm_src_requirement %}
{% endif %}

{% set node = salt['grains.filter_by']({
'Debian': {
'node_pkg': 'nodejs' if grains['osrelease']|float < 8 else 'nodejs-legacy',
'npm_pkg': 'npm',
'node_pkg': 'nodejs' if install_from_ppa else 'nodejs-legacy',
'npm_pkg': 'nodejs' if install_from_ppa else 'npm',
},
'Ubuntu': {
'node_pkg': 'nodejs',
'npm_pkg': 'nodejs' if pillar_get('node:install_from_ppa') else 'npm',
'npm_pkg': 'nodejs' if install_from_ppa else 'npm',
},
}, grain='os', merge=pillar_get('node:lookup')) %}

{% if install_from_source or (grains['os'] == 'Debian' and grains['osrelease']|float < 8) %}
{% set npm_requirement = npm_src_requirement %}
{% else %}
{% set npm_requirement = 'pkg: {0}'.format(node['npm_pkg']) %}
{% endif %}
18 changes: 7 additions & 11 deletions node/pkg.sls
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{%- from "node/map.jinja" import node, npm_bin with context %}
{%- from "node/map.jinja" import node with context %}
{%- if grains['os'] == 'Ubuntu' and salt['pillar.get']('node:install_from_ppa') %}
{%- if salt['pillar.get']('node:install_from_ppa') %}
{%- set dist = salt['pillar.get']('node:ppa:dist', grains['oscodename']) %}
nodejs.ppa:
pkg.installed:
- name: apt-transport-https
- require_in:
- pkgrepo: nodejs.ppa
pkgrepo.managed:
- humanname: NodeSource Node.js Repository
- name: deb {{ salt['pillar.get']('node:ppa:repository_url', 'https://deb.nodesource.com/node_0.12') }} {{ grains['oscodename'] }} main
- dist: {{ grains['oscodename'] }}
- name: deb {{ salt['pillar.get']('node:ppa:repository_url', 'https://deb.nodesource.com/node_6.x') }} {{ dist }} main
- dist: {{ dist }}
- file: /etc/apt/sources.list.d/nodesource.list
- keyid: "68576280"
- key_url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
@@ -18,18 +19,13 @@ nodejs.ppa:
pkg: nodejs
{%- else %}
npm:
{%- if grains['os'] == 'Debian' and grains['osrelease']|float < 8 %}
file.exists:
- name: {{ npm_bin }}
- require:
- file: install-npm
{% include 'node/source_npm.sls' %}
{%- else %}
pkg.installed:
- name: {{ node.npm_pkg }}
- reload_modules: true
- require:
- pkg: nodejs
{%- if grains['os'] == 'Debian' and grains['oscodename'] == 'wheezy' %}
- dist: wheezy-backports
{%- endif %}
{%- endif %}
nodejs: