File tree 4 files changed +35
-18
lines changed
4 files changed +35
-18
lines changed Original file line number Diff line number Diff line change 1
1
# NSSM CHANGELOG
2
2
3
+ ## 5.0.0 2021-10-28
4
+
5
+ - Depends on Chef 15+
6
+ - Remove dependency on Windows cookbook
7
+
3
8
## 4.0.1 2018-07-25
4
9
5
10
- Remote file is now before notification friendly (fixes #33 )
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
name 'nssm'
4
- maintainer 'Dennis Hoer '
5
- maintainer_email 'dennis.hoer@gmail .com'
4
+ maintainer 'Criteo '
5
+ maintainer_email 'systems-services-team@criteo .com'
6
6
license 'MIT'
7
7
description 'Installs/Configures NSSM'
8
8
long_description IO . read ( File . join ( File . dirname ( __FILE__ ) , 'README.md' ) )
9
9
source_url 'https://github.com/criteo-cookbooks/nssm'
10
10
issues_url 'https://github.com/criteo-cookbooks/nssm/issues'
11
- version '4 .0.1 '
11
+ version '5 .0.0 '
12
12
13
- chef_version '>= 12.7 '
13
+ chef_version '>= 15.0 '
14
14
15
15
supports 'windows'
16
- depends 'windows'
Original file line number Diff line number Diff line change 8
8
action :install do
9
9
src = new_resource . source
10
10
basename = src . slice ( src . rindex ( '/' ) + 1 , src . rindex ( '.' ) - src . rindex ( '/' ) - 1 )
11
+ download_path = "#{ Chef ::Config [ :file_cache_path ] } /#{ basename } .zip"
12
+ extract_path = "#{ Chef ::Config [ :file_cache_path ] } /#{ basename } "
11
13
system = node [ 'kernel' ] [ 'machine' ] == 'x86_64' ? 'win64' : 'win32'
12
- system_file = "#{ Chef :: Config [ :file_cache_path ] } /#{ basename } /#{ system } /nssm.exe"
14
+ system_file = "#{ extract_path } /#{ basename } /#{ system } /nssm.exe"
13
15
14
- windows_zipfile 'download nssm' do
15
- path Chef ::Config [ :file_cache_path ]
16
- source src
17
- overwrite true
16
+ remote_file 'download nssm' do
18
17
checksum new_resource . sha256
19
- action :unzip
18
+ path download_path
19
+ source src
20
20
notifies :create , 'remote_file[install nssm]' , :immediately
21
- not_if { Digest ::SHA256 . file ( "#{ Chef ::Config [ :file_cache_path ] } /#{ basename } .zip" ) . hexdigest == new_resource . sha256 } if ::File . exist? ( "#{ Chef ::Config [ :file_cache_path ] } /#{ basename } .zip" )
21
+ end
22
+
23
+ directory extract_path do
24
+ action :nothing
25
+ recursive true
26
+ subscribes :delete , 'remote_file[download nssm]' , :before
27
+ end
28
+
29
+ archive_file 'extract nssm' do
30
+ action :extract
31
+ destination extract_path
32
+ overwrite false
33
+ path download_path
22
34
end
23
35
24
36
remote_file 'install nssm' do
Original file line number Diff line number Diff line change 19
19
)
20
20
end
21
21
22
- it 'download nssm' do
23
- expect ( chef_run ) . to unzip_windows_zipfile ( 'download nssm' ) . with (
24
- path : CACHE ,
22
+ it 'downloads nssm' do
23
+ expect ( chef_run ) . to create_remote_file ( 'download nssm' ) . with (
24
+ path : " #{ CACHE } /nssm- #{ VERSION } .zip" ,
25
25
source : "https://nssm.cc/ci/nssm-#{ VERSION } .zip"
26
26
)
27
27
end
28
28
29
- it 'install nssm' do
29
+ it 'installs nssm' do
30
30
allow ( ::File ) . to receive ( :exist? ) . and_call_original
31
- expect ( ::File ) . to receive ( :exist? ) . with ( "#{ CACHE } /nssm-2.24-94-g9c88bc1/win64/nssm.exe" ) . and_return true
31
+ expect ( ::File ) . to receive ( :exist? ) . with ( "#{ CACHE } /nssm-#{ VERSION } /nssm-#{ VERSION } /win64/nssm.exe" ) . and_return true
32
+
32
33
expect ( chef_run ) . to create_remote_file ( 'install nssm' ) . with (
33
34
path : "C:\\ tmp\\ nssm-#{ VERSION } .exe" ,
34
- source : "file:///#{ CACHE } /nssm-2.24-94-g9c88bc1 /win64/nssm.exe"
35
+ source : "file:///#{ CACHE } /nssm-#{ VERSION } /nssm- #{ VERSION } /win64/nssm.exe"
35
36
)
36
37
end
37
38
end
You can’t perform that action at this time.
0 commit comments