File tree Expand file tree Collapse file tree
integration/default/controls Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66{%- from tplroot ~ " /map.jinja" import node with context % }
77{%- from tplroot ~ " /libtofs.jinja" import files_switch with context % }
88
9- {%- if ' environ' in node and node.environ % }
9+ {%- if ' environ' in node and node.environ and grains.os_family != ' Windows ' % }
1010
1111 {%- if node.pkg.use_upstream_source % }
1212 {%- set sls_package_install = tplroot ~ ' .source.install' % }
Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ node-config-npmrc-file-managed-config_file:
2424 lookup = ' node-config-file-file-managed-config_file'
2525 )
2626 }}
27+ {%- if grains.os_family != ' Windows' % }
2728 - mode: 640
2829 - user: {{ node.rootuser }}
2930 - group: {{ node.rootgroup }}
31+ {%- endif % }
3032 - makedirs: True
3133 - template: jinja
3234 - context:
Original file line number Diff line number Diff line change 55{%- set tplroot = tpldir.split(' /' )[0 ] %}
66{%- from tplroot ~ " /map.jinja" import node with context % }
77
8- {%- if grains.os_family not in (' Windows ' , ' MacOS' ,) % }
8+ {%- if grains.os_family not in (' MacOS' ,) % }
99 {%- set p = node.pkg % }
1010
1111include:
Original file line number Diff line number Diff line change @@ -84,7 +84,11 @@ OpenBSD:
8484Solaris : {}
8585
8686Windows :
87+ config_file : C:\Program Files\nodejs\node_modules\npm\npmrc
88+ config :
89+ prefix : ' ${APPDATA}\\npm'
8790 pkg :
91+ name : node.js
8892 source :
8993 # win-x64/node.exe
9094 source_hash : 7fca04f83b0e2169e41b2e1845e8da0f07d66cf9c3a1b4150767bf3ffddccf62
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33# Overide by Platform
4+ npmrc_file , config_prefix =
5+ case platform [ :family ]
6+ when 'windows'
7+ [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\npmrc' , '${APPDATA}\\npm' ]
8+ else
9+ %w[ /etc/npmrc /home/vagrant/.npm-packages ]
10+ end
11+
412root_group =
513 case platform [ :family ]
614 when 'bsd'
1220control 'node configuration' do
1321 title 'should match desired lines'
1422
15- describe file ( '/etc/npmrc' ) do
23+ describe file ( npmrc_file ) do
1624 it { should be_file }
17- it { should be_owned_by 'root' }
18- it { should be_grouped_into root_group }
19- its ( 'mode' ) { should cmp '0640' }
20- its ( 'content' ) { should include 'prefix = /home/vagrant/.npm-packages' }
25+ unless %w[ windows ] . include? ( platform [ :family ] )
26+ it { should be_owned_by 'root' }
27+ it { should be_grouped_into root_group }
28+ its ( 'mode' ) { should cmp '0640' }
29+ end
30+ its ( 'content' ) { should include "prefix = #{ config_prefix } " }
2131 end
2232end
Original file line number Diff line number Diff line change 1212control 'node configuration environment' do
1313 title 'should match desired lines'
1414
15+ only_if ( 'Environment file not managed on Windows' ) do
16+ !%w[ windows ] . include? ( system . platform [ :name ] )
17+ end
18+
1519 describe file ( '/etc/default/node.sh' ) do
1620 it { should be_file }
1721 it { should be_owned_by 'root' }
Original file line number Diff line number Diff line change 2020 else
2121 'nodejs'
2222 end
23+ when 'windows'
24+ 'node.js'
2325 else
2426 'nodejs'
2527 end
Original file line number Diff line number Diff line change 44node :
55 version : 16.13.0
66 config :
7- prefix : ' /home/vagrant/.npm-packages'
7+ # yamllint disable-line rule:line-length
8+ prefix : ' {{ "${APPDATA}\\npm" if grains.os == "Windows" else "/home/vagrant/.npm-packages" }}'
89 environ :
910 a : b
1011 pkg :
You can’t perform that action at this time.
0 commit comments