itamae-plugin-recipe-highlight 0.2.0 → 0.3.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: 2160685314e586f026eaf4e5f082bcb54e6b384f0b137ee7dc141825fe63c2ac
4
+ data.tar.gz: 212ac98b6198685f296f5f73ad047086b39b8e5bca74fc68a9a225dee7f03a95
5
5
  SHA512:
6
- metadata.gz: c7afc0742d8d19f72904a5d23c2d1cda086a6f83bdaea22d063cc02e1decbf9772bd6029767a62abbef013db428a6d664be19bb29c58ca1096d515bdd2e93d93
7
- data.tar.gz: 31b7c7c97f3b0877ca0298fb82bee46c5a39ad9a448a92c7761fe865a22822f16e5d38bae0707812f398f8009a0f538b407d222c7ddb2a941ec9f3993270b18e
6
+ metadata.gz: 8ad25864df90cf5ff7c36eb0f02c9e417a4c8ccca1e1d440451c08d2b40ca6e778e1648e13d2cb9e16f8307b38ee4b7c50905ee09e1213e07efcd55de7db592f
7
+ data.tar.gz: e71483e9ab2c9b6396db6e76eb09a42a3d885c0c5d210e353a4dc1a22d38b9c085186219b2d371ad1e1ce15e3def2c367790f92594ea1f627d4b2e7fa02e4fe6
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
- ## [Unreleased]
1
+ # Change log for Itamae plugin recipe Highlight
2
2
 
3
- ## [0.2.0] - 2023-09-11
3
+ ## Unreleased
4
+
5
+ ## 0.3.0 - 2023-11-14
6
+
7
+ ### Changed
8
+
9
+ * Update Highlight version to v4.10.
10
+ * The role of `node[:highlight][:tmp]`.
11
+ It is now a prefix for temporary directory path, and the full path is auto generated.
12
+
13
+ ### Added
14
+
15
+ * `highlight` / `commands` / `wget` node attribute.
16
+ [GNU Wget][wget] is used for downloading the archive file.
17
+
18
+ [wget]: https://www.gnu.org/software/wget/
19
+
20
+ ### Fixed
21
+
22
+ * Changed to use GNU Wget instead of the Itamae's HTTP request resource since updating archive files might somehow fail.
23
+
24
+ ## 0.2.0 - 2023-09-11
4
25
 
5
26
  ### Added
6
27
 
@@ -13,6 +34,6 @@
13
34
  * Skip downloading the signature when it exists.
14
35
  * Skip fetching the public key when it's already imported.
15
36
 
16
- ## [0.1.0] - 2023-09-10
37
+ ## 0.1.0 - 2023-09-10
17
38
 
18
39
  - 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.10',
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,123 +42,107 @@ 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)
51
+ command_exists = [node[:highlight][:commands][:type], node[:highlight][:command]].shelljoin
50
52
 
51
- command = node.dig(:highlight, :command)
53
+ grep_version = [node[:highlight][:commands][:grep], "highlight version #{ node[:highlight][:version] }"].shelljoin
54
+ print_version = [node[:highlight][:command], '--version'].shelljoin
55
+ updated = "#{ print_version } | #{ grep_version }"
52
56
 
53
- command_exists = [node.dig(:highlight, :commands, :type), command].shelljoin
57
+ Dir.mktmpdir(node[:highlight][:tmp]) do |tmp_dir|
58
+ source_dir = File.join(tmp_dir, "highlight-#{ node[:highlight][:version] }")
59
+ makefile_exists = [node[:highlight][:commands][:test], '-f', File.join(source_dir, 'makefile')].shelljoin
54
60
 
55
- version = node.dig(:highlight, :version)
61
+ archive_file_name = "highlight-#{ node[:highlight][:version] }.tar.bz2"
62
+ archive_file_path = File.join(tmp_dir, archive_file_name)
63
+ download_root_url = 'http://www.andre-simon.de/zip/'
56
64
 
57
- grep = node.dig(:highlight, :commands, :grep)
65
+ directory tmp_dir
58
66
 
59
- grep_version = [grep, "highlight version #{ version }"].shelljoin
60
- print_version = [command, '--version'].shelljoin
61
- updated = "#{ print_version } | #{ grep_version }"
67
+ package 'wget'
62
68
 
63
- test = node.dig(:highlight, :commands, :test)
69
+ execute 'download archive file' do
70
+ cwd tmp_dir
71
+ download = [node[:highlight][:commands][:wget], URI.join(download_root_url, archive_file_name).to_s].shelljoin
72
+ command download
64
73
 
65
- source_dir = File.join(tmp, "highlight-#{ version }")
66
- makefile = File.join(source_dir, 'makefile')
67
- makefile_exists = [test, '-f', makefile].shelljoin
74
+ not_if command_exists
75
+ not_if updated
76
+ not_if makefile_exists
77
+ end
68
78
 
69
- directory tmp do
70
- not_if command_exists
71
- not_if updated
72
- not_if makefile_exists
73
- end
79
+ if node[:highlight][:verify]
80
+ signature_name = "highlight-#{ node[:highlight][:version] }.tar.bz2.asc"
81
+ signature_path = File.join(tmp_dir, signature_name)
74
82
 
75
- archive_file_name = "highlight-#{ version }.tar.bz2"
76
- archive_file_path = File.join(tmp, archive_file_name)
77
- download_root_url = 'http://www.andre-simon.de/zip/'
83
+ http_request signature_path do
84
+ url URI.join(download_root_url, signature_name).to_s
78
85
 
79
- http_request archive_file_path do
80
- url URI.join(download_root_url, archive_file_name).to_s
86
+ not_if command_exists
87
+ not_if updated
88
+ not_if [node[:highlight][:commands][:test], '-f', signature_path].shelljoin
89
+ end
81
90
 
82
- not_if command_exists
83
- not_if updated
84
- not_if makefile_exists
85
- end
91
+ execute 'receive key' do
92
+ key_id = 'D805A7C7'
86
93
 
87
- if node.dig(:highlight, :verify)
88
- signature_name = "highlight-#{ version }.tar.bz2.asc"
89
- signature_path = File.join(tmp, signature_name)
94
+ fetch_key = [node[:highlight][:commands][:gpg], '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
95
+ command fetch_key
90
96
 
91
- http_request signature_path do
92
- url URI.join(download_root_url, signature_name).to_s
97
+ not_if command_exists
98
+ not_if updated
93
99
 
94
- not_if command_exists
95
- not_if updated
96
- not_if [test, '-f', signature_path].shelljoin
97
- end
100
+ export_public_key = [node[:highlight][:commands][:gpg], '--export', '--armor', key_id].shelljoin
101
+ check_not_yet_imported = [node[:highlight][:commands][:grep], 'nothing exported'].shelljoin
102
+ only_if "#{ export_public_key } | #{ check_not_yet_imported }"
103
+ end
98
104
 
99
- gpg = node.dig(:highlight, :commands, :gpg)
105
+ execute 'verify' do
106
+ verify_archive = [node[:highlight][:commands][:gpg], '--verify', signature_path, archive_file_path].shelljoin
107
+ command verify_archive
100
108
 
101
- execute 'receive key' do
102
- key_id = 'D805A7C7'
109
+ not_if command_exists
110
+ not_if updated
111
+ end
112
+ end
103
113
 
104
- fetch_key = [gpg, '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
105
- command fetch_key
114
+ execute 'extract' do
115
+ extract_archive = [node[:highlight][:commands][:tar], 'axf', archive_file_path].shelljoin
116
+ command extract_archive
117
+ cwd tmp_dir
106
118
 
107
119
  not_if command_exists
108
120
  not_if updated
121
+ not_if makefile_exists
122
+ end
109
123
 
110
- export_public_key = [gpg, '--export', '--armor', key_id].shelljoin
111
- check_not_yet_imported = [grep, 'nothing exported'].shelljoin
112
- only_if "#{ export_public_key } | #{ check_not_yet_imported }"
124
+ [node[:highlight][:dependencies][:lua], node[:highlight][:dependencies][:boost]].each do |pack|
125
+ package pack do
126
+ not_if command_exists
127
+ not_if updated
128
+ end
113
129
  end
114
130
 
115
- execute 'verify' do
116
- verify_archive = [gpg, '--verify', signature_path, archive_file_path].shelljoin
117
- command verify_archive
131
+ execute 'compile' do
132
+ compile_cli = [node[:highlight][:commands][:make], 'cli'].shelljoin
133
+ command compile_cli
134
+ cwd source_dir
118
135
 
119
136
  not_if command_exists
120
137
  not_if updated
121
138
  end
122
- end
123
-
124
- execute 'extract' do
125
- extract_archive = [node.dig(:highlight, :commands, :tar), 'axf', archive_file_path].shelljoin
126
- command extract_archive
127
- cwd tmp
128
-
129
- not_if command_exists
130
- not_if updated
131
- not_if makefile_exists
132
- end
133
-
134
- lua = node.dig(:highlight, :dependencies, :lua)
135
- boost = node.dig(:highlight, :dependencies, :boost)
136
139
 
137
- [lua, boost].each do |pack|
138
- package pack do
140
+ execute 'install' do
141
+ install_files = [node[:highlight][:commands][:make], 'install'].shelljoin
142
+ command install_files
143
+ cwd source_dir
139
144
 
140
145
  not_if command_exists
141
146
  not_if updated
142
147
  end
143
148
  end
144
-
145
- make = node.dig(:highlight, :commands, :make)
146
-
147
- execute 'compile' do
148
- compile_cli = [make, 'cli'].shelljoin
149
- command compile_cli
150
- cwd source_dir
151
-
152
- not_if command_exists
153
- not_if updated
154
- end
155
-
156
- execute 'install' do
157
- install_files = [make, 'install'].shelljoin
158
- command install_files
159
- cwd source_dir
160
-
161
- not_if command_exists
162
- not_if updated
163
- end
@@ -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.3.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.3.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: 2023-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae