itamae-plugin-recipe-highlight 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -2
- data/README.md +6 -5
- data/lib/itamae/plugin/recipe/highlight/default.rb +122 -70
- data/lib/itamae/plugin/recipe/highlight/version.rb +1 -1
- data/lib/itamae/plugin/recipe/highlight.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2160685314e586f026eaf4e5f082bcb54e6b384f0b137ee7dc141825fe63c2ac
|
4
|
+
data.tar.gz: 212ac98b6198685f296f5f73ad047086b39b8e5bca74fc68a9a225dee7f03a95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ad25864df90cf5ff7c36eb0f02c9e417a4c8ccca1e1d440451c08d2b40ca6e778e1648e13d2cb9e16f8307b38ee4b7c50905ee09e1213e07efcd55de7db592f
|
7
|
+
data.tar.gz: e71483e9ab2c9b6396db6e76eb09a42a3d885c0c5d210e353a4dc1a22d38b9c085186219b2d371ad1e1ce15e3def2c367790f92594ea1f627d4b2e7fa02e4fe6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
|
-
|
1
|
+
# Change log for Itamae plugin recipe Highlight
|
2
2
|
|
3
|
-
##
|
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
|
25
|
+
|
26
|
+
### Added
|
27
|
+
|
28
|
+
* Node attributes: `highlight` / `command`, `highlight` / `commands` / `grep`, `highlight` / `commands` / `tar`, and `highlight` / `commands` / `type`.
|
29
|
+
* Node attributes validation
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
* Skip some steps when the `makefile` exists.
|
34
|
+
* Skip downloading the signature when it exists.
|
35
|
+
* Skip fetching the public key when it's already imported.
|
36
|
+
|
37
|
+
## 0.1.0 - 2023-09-10
|
4
38
|
|
5
39
|
- Initial release
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Itamae::Plugin::Recipe::Highlight
|
2
2
|
|
3
|
-
itamae-plugin-recipe-highlight gem installs [Highlight][]
|
3
|
+
itamae-plugin-recipe-highlight gem installs [Highlight][].
|
4
4
|
|
5
|
-
[dl]: http://www.andre-simon.de/zip/download.php
|
6
5
|
[Highlight]: http://www.andre-simon.de/doku/highlight/en/highlight.php
|
7
6
|
|
8
7
|
## Installation
|
@@ -23,7 +22,10 @@ gem install itamae-plugin-recipe-highlight
|
|
23
22
|
|
24
23
|
## Usage
|
25
24
|
|
26
|
-
It installs command line interface by default.
|
25
|
+
It installs command line interface `highlight` by default.
|
26
|
+
Some configulations can be done by setting [the node attributes][attrs].
|
27
|
+
|
28
|
+
[attrs]: https://github.com/itamae-kitchen/itamae/wiki/Node-Attributes
|
27
29
|
|
28
30
|
```ruby
|
29
31
|
include_recipe "highlight"
|
@@ -32,7 +34,6 @@ include_recipe "highlight"
|
|
32
34
|
## Development
|
33
35
|
|
34
36
|
After checking out the repo, run `bin/setup` to install dependencies.
|
35
|
-
Then, run `rake test-unit` to run the tests.
|
36
37
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
38
|
|
38
39
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
@@ -46,6 +47,6 @@ Bug reports and pull requests are welcome on [Codeberg][].
|
|
46
47
|
|
47
48
|
## License
|
48
49
|
|
49
|
-
This gem is
|
50
|
+
This gem is released under [the Apache License version 2.0][apache].
|
50
51
|
|
51
52
|
[apache]: https://www.apache.org/licenses/LICENSE-2.0
|
@@ -1,96 +1,148 @@
|
|
1
1
|
require 'shellwords'
|
2
2
|
require 'uri'
|
3
3
|
|
4
|
-
node
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
node.validate! do
|
29
|
+
{
|
30
|
+
highlight: {
|
31
|
+
tmp: string,
|
32
|
+
version: string,
|
33
|
+
command: string,
|
34
|
+
verify: boolean,
|
35
|
+
dependencies: {
|
36
|
+
lua: string,
|
37
|
+
boost: string,
|
38
|
+
},
|
39
|
+
commands: {
|
40
|
+
gpg: string,
|
41
|
+
grep: string,
|
42
|
+
make: string,
|
43
|
+
tar: string,
|
44
|
+
type: string,
|
45
|
+
wget: string,
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
25
49
|
end
|
26
50
|
|
27
|
-
|
28
|
-
archive_file_path = File.join(tmp, archive_file_name)
|
29
|
-
download_root_url = 'http://www.andre-simon.de/zip/'
|
51
|
+
command_exists = [node[:highlight][:commands][:type], node[:highlight][:command]].shelljoin
|
30
52
|
|
31
|
-
|
32
|
-
|
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 }"
|
33
56
|
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
37
60
|
|
38
|
-
|
39
|
-
|
40
|
-
|
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/'
|
41
64
|
|
42
|
-
|
43
|
-
url URI.join(download_root_url, signature_name).to_s
|
65
|
+
directory tmp_dir
|
44
66
|
|
45
|
-
|
46
|
-
not_if version_check_command
|
47
|
-
end
|
67
|
+
package 'wget'
|
48
68
|
|
49
|
-
execute '
|
50
|
-
|
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
|
51
73
|
|
52
|
-
not_if
|
53
|
-
not_if
|
74
|
+
not_if command_exists
|
75
|
+
not_if updated
|
76
|
+
not_if makefile_exists
|
54
77
|
end
|
55
78
|
|
56
|
-
|
57
|
-
|
79
|
+
if node[:highlight][:verify]
|
80
|
+
signature_name = "highlight-#{ node[:highlight][:version] }.tar.bz2.asc"
|
81
|
+
signature_path = File.join(tmp_dir, signature_name)
|
58
82
|
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
83
|
+
http_request signature_path do
|
84
|
+
url URI.join(download_root_url, signature_name).to_s
|
63
85
|
|
64
|
-
|
65
|
-
|
66
|
-
|
86
|
+
not_if command_exists
|
87
|
+
not_if updated
|
88
|
+
not_if [node[:highlight][:commands][:test], '-f', signature_path].shelljoin
|
89
|
+
end
|
67
90
|
|
68
|
-
|
69
|
-
|
70
|
-
|
91
|
+
execute 'receive key' do
|
92
|
+
key_id = 'D805A7C7'
|
93
|
+
|
94
|
+
fetch_key = [node[:highlight][:commands][:gpg], '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
|
95
|
+
command fetch_key
|
96
|
+
|
97
|
+
not_if command_exists
|
98
|
+
not_if updated
|
99
|
+
|
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
|
71
104
|
|
72
|
-
|
73
|
-
|
105
|
+
execute 'verify' do
|
106
|
+
verify_archive = [node[:highlight][:commands][:gpg], '--verify', signature_path, archive_file_path].shelljoin
|
107
|
+
command verify_archive
|
74
108
|
|
75
|
-
|
76
|
-
|
109
|
+
not_if command_exists
|
110
|
+
not_if updated
|
111
|
+
end
|
77
112
|
end
|
78
|
-
end
|
79
113
|
|
80
|
-
|
114
|
+
execute 'extract' do
|
115
|
+
extract_archive = [node[:highlight][:commands][:tar], 'axf', archive_file_path].shelljoin
|
116
|
+
command extract_archive
|
117
|
+
cwd tmp_dir
|
81
118
|
|
82
|
-
|
83
|
-
|
84
|
-
|
119
|
+
not_if command_exists
|
120
|
+
not_if updated
|
121
|
+
not_if makefile_exists
|
122
|
+
end
|
85
123
|
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
129
|
+
end
|
89
130
|
|
90
|
-
execute '
|
91
|
-
|
92
|
-
|
131
|
+
execute 'compile' do
|
132
|
+
compile_cli = [node[:highlight][:commands][:make], 'cli'].shelljoin
|
133
|
+
command compile_cli
|
134
|
+
cwd source_dir
|
93
135
|
|
94
|
-
|
95
|
-
|
136
|
+
not_if command_exists
|
137
|
+
not_if updated
|
138
|
+
end
|
139
|
+
|
140
|
+
execute 'install' do
|
141
|
+
install_files = [node[:highlight][:commands][:make], 'install'].shelljoin
|
142
|
+
command install_files
|
143
|
+
cwd source_dir
|
144
|
+
|
145
|
+
not_if command_exists
|
146
|
+
not_if updated
|
147
|
+
end
|
96
148
|
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.
|
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-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: itamae
|