itamae-plugin-recipe-highlight 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1d2e267ae55d36488f4df5ae57d5c694ec8ce0d278d5d49b89b3c03815ea4d9
4
- data.tar.gz: '098472c06e01065d04ec2d9a77e3dbdcc73025fc00910aad8a6de97b44fae4ea'
3
+ metadata.gz: 29f4729ace2c86bb91175dd17de087b59a51424044ec85e61d52bb4e31be2fc3
4
+ data.tar.gz: 35249ac240b005f451668ee33aa4a049a3677a4784b21d60858099a5cb720474
5
5
  SHA512:
6
- metadata.gz: c7afc0742d8d19f72904a5d23c2d1cda086a6f83bdaea22d063cc02e1decbf9772bd6029767a62abbef013db428a6d664be19bb29c58ca1096d515bdd2e93d93
7
- data.tar.gz: 31b7c7c97f3b0877ca0298fb82bee46c5a39ad9a448a92c7761fe865a22822f16e5d38bae0707812f398f8009a0f538b407d222c7ddb2a941ec9f3993270b18e
6
+ metadata.gz: 3519396bee3343a961870d09e20b1e12c6070aa87c3462f27f885537e845840d67906e709e448f6c6c5ce0a3462eb71879f23ba9d2268cb88c8092625de2b9d6
7
+ data.tar.gz: 1dd7385622869db646985b33eb26ead89b5efe170a343996ea2cb25f1412eccdef9467f6753961c8830e118e4ebe0bb963be996c4308742ba9b708c0ef658a3c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,37 @@
1
- ## [Unreleased]
1
+ # Change log for Itamae plugin recipe Highlight
2
2
 
3
- ## [0.2.0] - 2023-09-11
3
+ ## Unreleased
4
+
5
+ ## 0.4.0 - 2024-03-29
6
+
7
+ ### Changed
8
+
9
+ * Update Highlight version to v4.11.
10
+
11
+ ### Fixed
12
+
13
+ * Fixed not to create a temporary directory on the host system.
14
+
15
+ ## 0.3.0 - 2023-11-14
16
+
17
+ ### Changed
18
+
19
+ * Update Highlight version to v4.10.
20
+ * The role of `node[:highlight][:tmp]`.
21
+ It is now a prefix for temporary directory path, and the full path is auto generated.
22
+
23
+ ### Added
24
+
25
+ * `highlight` / `commands` / `wget` node attribute.
26
+ [GNU Wget][wget] is used for downloading the archive file.
27
+
28
+ [wget]: https://www.gnu.org/software/wget/
29
+
30
+ ### Fixed
31
+
32
+ * Changed to use GNU Wget instead of the Itamae's HTTP request resource since updating archive files might somehow fail.
33
+
34
+ ## 0.2.0 - 2023-09-11
4
35
 
5
36
  ### Added
6
37
 
@@ -13,6 +44,6 @@
13
44
  * Skip downloading the signature when it exists.
14
45
  * Skip fetching the public key when it's already imported.
15
46
 
16
- ## [0.1.0] - 2023-09-10
47
+ ## 0.1.0 - 2023-09-10
17
48
 
18
49
  - Initial release
@@ -1,28 +1,29 @@
1
1
  require 'shellwords'
2
2
  require 'uri'
3
3
 
4
- defaults = {
5
- highlight: {
6
- tmp: '/tmp',
7
- version: '4.8',
8
- command: 'highlight',
9
- verify: true,
10
- dependencies: {
11
- lua: 'liblua5.4-dev',
12
- boost: 'libboost-dev'
13
- },
14
- commands: {
15
- gpg: 'gpg',
16
- grep: 'grep',
17
- make: 'make',
18
- tar: 'tar',
19
- test: 'test',
20
- type: 'type',
4
+ node.reverse_merge!(
5
+ {
6
+ highlight: {
7
+ tmp: '/tmp',
8
+ version: '4.11',
9
+ command: 'highlight',
10
+ verify: true,
11
+ dependencies: {
12
+ lua: 'liblua5.4-dev',
13
+ boost: 'libboost-dev'
14
+ },
15
+ commands: {
16
+ gpg: 'gpg',
17
+ grep: 'grep',
18
+ make: 'make',
19
+ tar: 'tar',
20
+ test: 'test',
21
+ type: 'type',
22
+ wget: 'wget',
23
+ }
21
24
  }
22
25
  }
23
- }
24
-
25
- node.replace(defaults.merge(node))
26
+ )
26
27
 
27
28
  node.validate! do
28
29
  {
@@ -41,79 +42,69 @@ node.validate! do
41
42
  make: string,
42
43
  tar: string,
43
44
  type: string,
45
+ wget: string,
44
46
  }
45
47
  }
46
48
  }
47
49
  end
48
50
 
49
- tmp = node.dig(:highlight, :tmp)
50
-
51
- command = node.dig(:highlight, :command)
52
-
53
- command_exists = [node.dig(:highlight, :commands, :type), command].shelljoin
54
-
55
- version = node.dig(:highlight, :version)
56
-
57
- grep = node.dig(:highlight, :commands, :grep)
51
+ command_exists = [node[:highlight][:commands][:type], node[:highlight][:command]].shelljoin
58
52
 
59
- grep_version = [grep, "highlight version #{ version }"].shelljoin
60
- print_version = [command, '--version'].shelljoin
53
+ grep_version = [node[:highlight][:commands][:grep], "highlight version #{ node[:highlight][:version] }"].shelljoin
54
+ print_version = [node[:highlight][:command], '--version'].shelljoin
61
55
  updated = "#{ print_version } | #{ grep_version }"
62
56
 
63
- test = node.dig(:highlight, :commands, :test)
57
+ tmp_dir = run_command(["mktemp", "--directory", "--tmpdir=#{node[:highlight][:tmp]}"].shelljoin).stdout
64
58
 
65
- source_dir = File.join(tmp, "highlight-#{ version }")
66
- makefile = File.join(source_dir, 'makefile')
67
- makefile_exists = [test, '-f', makefile].shelljoin
59
+ source_dir = File.join(tmp_dir, "highlight-#{ node[:highlight][:version] }")
60
+ makefile_exists = [node[:highlight][:commands][:test], '-f', File.join(source_dir, 'makefile')].shelljoin
68
61
 
69
- directory tmp do
70
- not_if command_exists
71
- not_if updated
72
- not_if makefile_exists
73
- end
74
-
75
- archive_file_name = "highlight-#{ version }.tar.bz2"
76
- archive_file_path = File.join(tmp, archive_file_name)
62
+ archive_file_name = "highlight-#{ node[:highlight][:version] }.tar.bz2"
63
+ archive_file_path = File.join(tmp_dir, archive_file_name)
77
64
  download_root_url = 'http://www.andre-simon.de/zip/'
78
65
 
79
- http_request archive_file_path do
80
- url URI.join(download_root_url, archive_file_name).to_s
66
+ directory tmp_dir
67
+
68
+ package 'wget'
69
+
70
+ execute 'download archive file' do
71
+ cwd tmp_dir
72
+ download = [node[:highlight][:commands][:wget], URI.join(download_root_url, archive_file_name).to_s].shelljoin
73
+ command download
81
74
 
82
75
  not_if command_exists
83
76
  not_if updated
84
77
  not_if makefile_exists
85
78
  end
86
79
 
87
- if node.dig(:highlight, :verify)
88
- signature_name = "highlight-#{ version }.tar.bz2.asc"
89
- signature_path = File.join(tmp, signature_name)
80
+ if node[:highlight][:verify]
81
+ signature_name = "highlight-#{ node[:highlight][:version] }.tar.bz2.asc"
82
+ signature_path = File.join(tmp_dir, signature_name)
90
83
 
91
84
  http_request signature_path do
92
85
  url URI.join(download_root_url, signature_name).to_s
93
86
 
94
87
  not_if command_exists
95
88
  not_if updated
96
- not_if [test, '-f', signature_path].shelljoin
89
+ not_if [node[:highlight][:commands][:test], '-f', signature_path].shelljoin
97
90
  end
98
91
 
99
- gpg = node.dig(:highlight, :commands, :gpg)
100
-
101
92
  execute 'receive key' do
102
93
  key_id = 'D805A7C7'
103
94
 
104
- fetch_key = [gpg, '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
95
+ fetch_key = [node[:highlight][:commands][:gpg], '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
105
96
  command fetch_key
106
97
 
107
98
  not_if command_exists
108
99
  not_if updated
109
100
 
110
- export_public_key = [gpg, '--export', '--armor', key_id].shelljoin
111
- check_not_yet_imported = [grep, 'nothing exported'].shelljoin
101
+ export_public_key = [node[:highlight][:commands][:gpg], '--export', '--armor', key_id].shelljoin
102
+ check_not_yet_imported = [node[:highlight][:commands][:grep], 'nothing exported'].shelljoin
112
103
  only_if "#{ export_public_key } | #{ check_not_yet_imported }"
113
104
  end
114
105
 
115
106
  execute 'verify' do
116
- verify_archive = [gpg, '--verify', signature_path, archive_file_path].shelljoin
107
+ verify_archive = [node[:highlight][:commands][:gpg], '--verify', signature_path, archive_file_path].shelljoin
117
108
  command verify_archive
118
109
 
119
110
  not_if command_exists
@@ -122,30 +113,24 @@ if node.dig(:highlight, :verify)
122
113
  end
123
114
 
124
115
  execute 'extract' do
125
- extract_archive = [node.dig(:highlight, :commands, :tar), 'axf', archive_file_path].shelljoin
116
+ extract_archive = [node[:highlight][:commands][:tar], 'axf', archive_file_path].shelljoin
126
117
  command extract_archive
127
- cwd tmp
118
+ cwd tmp_dir
128
119
 
129
120
  not_if command_exists
130
121
  not_if updated
131
122
  not_if makefile_exists
132
123
  end
133
124
 
134
- lua = node.dig(:highlight, :dependencies, :lua)
135
- boost = node.dig(:highlight, :dependencies, :boost)
136
-
137
- [lua, boost].each do |pack|
125
+ [node[:highlight][:dependencies][:lua], node[:highlight][:dependencies][:boost]].each do |pack|
138
126
  package pack do
139
-
140
127
  not_if command_exists
141
128
  not_if updated
142
129
  end
143
130
  end
144
131
 
145
- make = node.dig(:highlight, :commands, :make)
146
-
147
132
  execute 'compile' do
148
- compile_cli = [make, 'cli'].shelljoin
133
+ compile_cli = [node[:highlight][:commands][:make], 'cli'].shelljoin
149
134
  command compile_cli
150
135
  cwd source_dir
151
136
 
@@ -154,7 +139,7 @@ execute 'compile' do
154
139
  end
155
140
 
156
141
  execute 'install' do
157
- install_files = [make, 'install'].shelljoin
142
+ install_files = [node[:highlight][:commands][:make], 'install'].shelljoin
158
143
  command install_files
159
144
  cwd source_dir
160
145
 
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module Highlight
5
- VERSION = '0.2.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
8
8
  end
@@ -5,7 +5,6 @@ module Itamae
5
5
  module Recipe
6
6
  module Highlight
7
7
  class Error < StandardError; end
8
- # Your code goes here...
9
8
  end
10
9
  end
11
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-recipe-highlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae