itamae-plugin-recipe-highlight 0.1.0 → 0.2.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 +13 -0
- data/README.md +6 -5
- data/lib/itamae/plugin/recipe/highlight/default.rb +106 -39
- data/lib/itamae/plugin/recipe/highlight/version.rb +1 -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: b1d2e267ae55d36488f4df5ae57d5c694ec8ce0d278d5d49b89b3c03815ea4d9
|
4
|
+
data.tar.gz: '098472c06e01065d04ec2d9a77e3dbdcc73025fc00910aad8a6de97b44fae4ea'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7afc0742d8d19f72904a5d23c2d1cda086a6f83bdaea22d063cc02e1decbf9772bd6029767a62abbef013db428a6d664be19bb29c58ca1096d515bdd2e93d93
|
7
|
+
data.tar.gz: 31b7c7c97f3b0877ca0298fb82bee46c5a39ad9a448a92c7761fe865a22822f16e5d38bae0707812f398f8009a0f538b407d222c7ddb2a941ec9f3993270b18e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2023-09-11
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
* Node attributes: `highlight` / `command`, `highlight` / `commands` / `grep`, `highlight` / `commands` / `tar`, and `highlight` / `commands` / `type`.
|
8
|
+
* Node attributes validation
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
* Skip some steps when the `makefile` exists.
|
13
|
+
* Skip downloading the signature when it exists.
|
14
|
+
* Skip fetching the public key when it's already imported.
|
15
|
+
|
3
16
|
## [0.1.0] - 2023-09-10
|
4
17
|
|
5
18
|
- 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,27 +1,75 @@
|
|
1
1
|
require 'shellwords'
|
2
2
|
require 'uri'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
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',
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
node.replace(defaults.merge(node))
|
26
|
+
|
27
|
+
node.validate! do
|
28
|
+
{
|
29
|
+
highlight: {
|
30
|
+
tmp: string,
|
31
|
+
version: string,
|
32
|
+
command: string,
|
33
|
+
verify: boolean,
|
34
|
+
dependencies: {
|
35
|
+
lua: string,
|
36
|
+
boost: string,
|
37
|
+
},
|
38
|
+
commands: {
|
39
|
+
gpg: string,
|
40
|
+
grep: string,
|
41
|
+
make: string,
|
42
|
+
tar: string,
|
43
|
+
type: string,
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
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)
|
7
58
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
boost = node['highlight']['dependencies']['boost'] || 'libboost-dev'
|
12
|
-
gpg = node['highlight']['commands']['gpg'] || 'gpg'
|
13
|
-
make = node['highlight']['commands']['make'] || 'make'
|
59
|
+
grep_version = [grep, "highlight version #{ version }"].shelljoin
|
60
|
+
print_version = [command, '--version'].shelljoin
|
61
|
+
updated = "#{ print_version } | #{ grep_version }"
|
14
62
|
|
15
|
-
|
16
|
-
verify = true if verify.nil?
|
17
|
-
verify = false if verify == 'false'
|
63
|
+
test = node.dig(:highlight, :commands, :test)
|
18
64
|
|
19
|
-
|
20
|
-
|
65
|
+
source_dir = File.join(tmp, "highlight-#{ version }")
|
66
|
+
makefile = File.join(source_dir, 'makefile')
|
67
|
+
makefile_exists = [test, '-f', makefile].shelljoin
|
21
68
|
|
22
69
|
directory tmp do
|
23
|
-
not_if
|
24
|
-
not_if
|
70
|
+
not_if command_exists
|
71
|
+
not_if updated
|
72
|
+
not_if makefile_exists
|
25
73
|
end
|
26
74
|
|
27
75
|
archive_file_name = "highlight-#{ version }.tar.bz2"
|
@@ -31,66 +79,85 @@ download_root_url = 'http://www.andre-simon.de/zip/'
|
|
31
79
|
http_request archive_file_path do
|
32
80
|
url URI.join(download_root_url, archive_file_name).to_s
|
33
81
|
|
34
|
-
not_if
|
35
|
-
not_if
|
82
|
+
not_if command_exists
|
83
|
+
not_if updated
|
84
|
+
not_if makefile_exists
|
36
85
|
end
|
37
86
|
|
38
|
-
if verify
|
87
|
+
if node.dig(:highlight, :verify)
|
39
88
|
signature_name = "highlight-#{ version }.tar.bz2.asc"
|
40
89
|
signature_path = File.join(tmp, signature_name)
|
41
90
|
|
42
91
|
http_request signature_path do
|
43
92
|
url URI.join(download_root_url, signature_name).to_s
|
44
93
|
|
45
|
-
not_if
|
46
|
-
not_if
|
94
|
+
not_if command_exists
|
95
|
+
not_if updated
|
96
|
+
not_if [test, '-f', signature_path].shelljoin
|
47
97
|
end
|
48
98
|
|
99
|
+
gpg = node.dig(:highlight, :commands, :gpg)
|
100
|
+
|
49
101
|
execute 'receive key' do
|
50
|
-
|
102
|
+
key_id = 'D805A7C7'
|
103
|
+
|
104
|
+
fetch_key = [gpg, '--keyserver', 'pgp.mit.edu', '--recv-key', key_id].shelljoin
|
105
|
+
command fetch_key
|
51
106
|
|
52
|
-
not_if
|
53
|
-
not_if
|
107
|
+
not_if command_exists
|
108
|
+
not_if updated
|
109
|
+
|
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 }"
|
54
113
|
end
|
55
114
|
|
56
115
|
execute 'verify' do
|
57
|
-
|
116
|
+
verify_archive = [gpg, '--verify', signature_path, archive_file_path].shelljoin
|
117
|
+
command verify_archive
|
58
118
|
|
59
|
-
not_if
|
60
|
-
not_if
|
119
|
+
not_if command_exists
|
120
|
+
not_if updated
|
61
121
|
end
|
62
122
|
end
|
63
123
|
|
64
124
|
execute 'extract' do
|
65
|
-
|
125
|
+
extract_archive = [node.dig(:highlight, :commands, :tar), 'axf', archive_file_path].shelljoin
|
126
|
+
command extract_archive
|
66
127
|
cwd tmp
|
67
128
|
|
68
|
-
not_if
|
69
|
-
not_if
|
129
|
+
not_if command_exists
|
130
|
+
not_if updated
|
131
|
+
not_if makefile_exists
|
70
132
|
end
|
71
133
|
|
134
|
+
lua = node.dig(:highlight, :dependencies, :lua)
|
135
|
+
boost = node.dig(:highlight, :dependencies, :boost)
|
136
|
+
|
72
137
|
[lua, boost].each do |pack|
|
73
138
|
package pack do
|
74
139
|
|
75
|
-
not_if
|
76
|
-
not_if
|
140
|
+
not_if command_exists
|
141
|
+
not_if updated
|
77
142
|
end
|
78
143
|
end
|
79
144
|
|
80
|
-
|
145
|
+
make = node.dig(:highlight, :commands, :make)
|
81
146
|
|
82
147
|
execute 'compile' do
|
83
|
-
|
148
|
+
compile_cli = [make, 'cli'].shelljoin
|
149
|
+
command compile_cli
|
84
150
|
cwd source_dir
|
85
151
|
|
86
|
-
not_if
|
87
|
-
not_if
|
152
|
+
not_if command_exists
|
153
|
+
not_if updated
|
88
154
|
end
|
89
155
|
|
90
156
|
execute 'install' do
|
91
|
-
|
157
|
+
install_files = [make, 'install'].shelljoin
|
158
|
+
command install_files
|
92
159
|
cwd source_dir
|
93
160
|
|
94
|
-
not_if
|
95
|
-
not_if
|
161
|
+
not_if command_exists
|
162
|
+
not_if updated
|
96
163
|
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.2.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
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: itamae
|