rake_dependencies 2.14.0.pre.1 → 3.2.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +130 -115
- data/lib/rake_dependencies/platform_names.rb +17 -0
- data/lib/rake_dependencies/task_sets/all.rb +2 -1
- data/lib/rake_dependencies/tasks/download.rb +24 -15
- data/lib/rake_dependencies/tasks/extract.rb +16 -10
- data/lib/rake_dependencies/tasks/install.rb +18 -10
- data/lib/rake_dependencies/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff0040b6de7eae489ffd4ca26d423c592530c4d232b1a679c43e1408b59a6dcb
|
4
|
+
data.tar.gz: 64d3c088c2fef067c3a1160a26538a1b75d97e77046c996bad87b89d07dca2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 353cadba1e2eb8c3c5121e0bc91f03943627159085474bac701c7a1a3691bc0b7f23165b3ecac9e21c6d76e227c865914a007b73b259710a448a06b7d80a0d56
|
7
|
+
data.tar.gz: 35fd09975af2963cc682892aea8419b1aea5394b39658111aabae3d770f5bc51783dcb22b4c420366c3b8b8231c41ca83f094580f0136d01e4062993ad996f18
|
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -32,19 +32,22 @@ RakeDependencies::Tasks::All.new do |t|
|
|
32
32
|
t.version = '0.9.0'
|
33
33
|
t.path = File.join('vendor', 'terraform')
|
34
34
|
t.type = :zip
|
35
|
-
|
36
|
-
t.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
'
|
43
|
-
|
35
|
+
|
36
|
+
t.platform_os_names = { darwin: 'darwin', linux: 'linux' }
|
37
|
+
t.platform_cpu_names = { x86_64: 'amd64', arm64: 'arm64' }
|
38
|
+
|
39
|
+
t.uri_template =
|
40
|
+
'https://releases.hashicorp.com/terraform/<%= @version %>/' +
|
41
|
+
'terraform_<%= @version %>_' +
|
42
|
+
'<%= @platform_os_name %>_<%= @platform_cpu_name %><%= @ext %>'
|
43
|
+
t.file_name_template =
|
44
|
+
'terraform_<%= @version %>_' +
|
45
|
+
'<%= @platform_os_name %>_<%= @platform_cpu_name %><%= @ext %>'
|
46
|
+
|
44
47
|
t.needs_fetch = lambda do |parameters|
|
45
48
|
terraform_binary = File.join(
|
46
|
-
|
47
|
-
|
49
|
+
parameters[:path], parameters[:binary_directory], 'terraform')
|
50
|
+
|
48
51
|
!(File.exist?(terraform_binary) &&
|
49
52
|
`#{terraform_binary} -version`.lines.first =~ /#{parameters[:version]}/)
|
50
53
|
end
|
@@ -52,6 +55,7 @@ end
|
|
52
55
|
```
|
53
56
|
|
54
57
|
With this in place, a number of tasks will be defined:
|
58
|
+
|
55
59
|
```bash
|
56
60
|
> rake -T
|
57
61
|
rake terraform:clean # Clean vendored terraform
|
@@ -62,36 +66,37 @@ rake terraform:fetch # Fetch terraform
|
|
62
66
|
```
|
63
67
|
|
64
68
|
The tasks perform the following:
|
69
|
+
|
65
70
|
* `<ns>:clean` - recursively deletes the directory containing the dependency
|
66
71
|
* `<ns>:download` - downloads the distribution from the provided path into the
|
67
72
|
dependency directory
|
68
73
|
* `<ns>:extract` - extracts, in the case of a compressed archive, or copies, in
|
69
|
-
the case of an uncompressed distribution, the binaries into the binary
|
74
|
+
the case of an uncompressed distribution, the binaries into the binary
|
70
75
|
directory under the dependency directory
|
71
76
|
* `<ns>:fetch` - downloads then extracts
|
72
77
|
* `<ns>:ensure` - checks whether the dependency needs to be fetched and cleans
|
73
78
|
and fetches if necessary
|
74
79
|
|
75
|
-
With these tasks defined, any task that requires the dependency to be present
|
80
|
+
With these tasks defined, any task that requires the dependency to be present
|
76
81
|
should depend on `<ns>:ensure`. Continuing the terraform example:
|
77
|
-
|
82
|
+
|
78
83
|
```ruby
|
79
84
|
task :provision_database => ['terraform:ensure'] do
|
80
85
|
sh('vendor/terraform/bin/terraform apply infra/database')
|
81
86
|
end
|
82
87
|
```
|
83
88
|
|
84
|
-
If the `installation_directory` attribute is supplied, an additional `install`
|
89
|
+
If the `installation_directory` attribute is supplied, an additional `install`
|
85
90
|
task will be defined:
|
86
91
|
|
87
92
|
```ruby
|
88
93
|
RakeDependencies::Tasks::All.new do |t|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
t.namespace = :terraform
|
95
|
+
t.dependency = 'terraform'
|
96
|
+
|
97
|
+
# ...
|
98
|
+
t.installation_directory = "#{ENV['HOME']}/bin"
|
99
|
+
# ...
|
95
100
|
end
|
96
101
|
```
|
97
102
|
|
@@ -107,53 +112,57 @@ rake terraform:fetch # Fetch terraform
|
|
107
112
|
rake terraform:install # Install terraform
|
108
113
|
```
|
109
114
|
|
110
|
-
The `<ns>:install` task copies the binary into the defined installation
|
115
|
+
The `<ns>:install` task copies the binary into the defined installation
|
111
116
|
directory which can be anywhere on the filesystem.
|
112
117
|
|
113
118
|
The `RakeDependencies::Tasks::All` tasklib supports the following configuration
|
114
119
|
parameters:
|
115
120
|
|
116
|
-
| Name | Description
|
117
|
-
|
118
|
-
| `namespace` | The namespace in which to define the tasks
|
119
|
-
| `dependency` | The name of the dependency, used in status reporting and as the default binary name
|
120
|
-
| `version` | The version of the dependency to manage, only required if used in templates or `needs_fetch`
|
121
|
-
| `path` | The path in which to install the dependency
|
122
|
-
| `type` | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`
|
123
|
-
| `
|
124
|
-
| `
|
125
|
-
| `
|
126
|
-
| `
|
127
|
-
| `
|
128
|
-
| `
|
129
|
-
| `
|
130
|
-
| `
|
131
|
-
| `
|
132
|
-
| `
|
133
|
-
| `
|
134
|
-
| `
|
135
|
-
| `
|
136
|
-
| `
|
137
|
-
| `
|
138
|
-
| `
|
121
|
+
| Name | Description | Default | Required |
|
122
|
+
|-------------------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|
|
123
|
+
| `namespace` | The namespace in which to define the tasks | - | no |
|
124
|
+
| `dependency` | The name of the dependency, used in status reporting and as the default binary name | - | yes |
|
125
|
+
| `version` | The version of the dependency to manage, only required if used in templates or `needs_fetch` | - | no |
|
126
|
+
| `path` | The path in which to install the dependency | - | yes |
|
127
|
+
| `type` | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed` | `:zip` | yes |
|
128
|
+
| `platform_os_names` | A map of platform OS identifiers to OS names to use in templates | `RakeDependencies::PlatformNames::OS` | yes |
|
129
|
+
| `platform_cpu_names` | A map of platform CPU identifiers to CPU names to use in templates | `RakeDependencies::PlatformNames::CPU` | yes |
|
130
|
+
| `distribution_directory` | The name of the directory under the supplied path into which to download the distribution | `'dist'` | yes |
|
131
|
+
| `binary_directory` | The name of the directory under the supplied path into which to extract/copy the binaries | `'bin'` | yes |
|
132
|
+
| `installation_directory` | The name of the directory into which to install the binaries, anywhere on the file system | - | no |
|
133
|
+
| `uri_template` | A template for the URI of the distribution | - | yes |
|
134
|
+
| `file_name_template` | A template for the name of the downloaded file | - | yes |
|
135
|
+
| `source_binary_name_template` | A template for the name of the binary before rename after extraction/copying | - | no |
|
136
|
+
| `target_binary_name_template` | A template for the name to rename the binary to after extraction/copying | - | no |
|
137
|
+
| `strip_path_template` | A template for the path to strip within an archive before extracting | - | no |
|
138
|
+
| `needs_fetch` | A lambda taking a parameter map that should return `true` if the dependency needs to be fetched, `false` otherwise | Will always return `true` | no |
|
139
|
+
| `clean_task_name` | The name of the clean task, required if it should be different from the default | `:clean` | yes |
|
140
|
+
| `download_task_name` | The name of the download task, required if it should be different from the default | `:download` | yes |
|
141
|
+
| `extract_task_name` | The name of the extract task, required if it should be different from the default | `:extract` | yes |
|
142
|
+
| `install_task_name` | The name of the install task, required if it should be different from the default | `:install` | no |
|
143
|
+
| `fetch_task_name` | The name of the fetch task, required if it should be different from the default | `:fetch` | yes |
|
144
|
+
| `ensure_task_name` | The name of the ensure task, required if it should be different from the default | `:ensure` | yes |
|
139
145
|
|
140
146
|
Notes:
|
147
|
+
|
141
148
|
* Each of the templates will have the following instance variables in scope when
|
142
149
|
rendered:
|
143
|
-
|
144
|
-
|
145
|
-
`:
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
+
* `@version`: the supplied version string
|
151
|
+
* `@platform`: the `Gem::Platform` on which the task is executing
|
152
|
+
* `@platform_os_name`: the OS name derived from the platform on which the
|
153
|
+
task is executing and the provided `platform_os_names` map
|
154
|
+
* `@platform_cpu_name`: the CPU name derived from the platform on which the
|
155
|
+
task is executing and the provided `platform_cpu_names` map
|
156
|
+
* `@ext`: the file extension corresponding to the provided `type`, one of
|
157
|
+
`.zip`, `.tar.gz`, `.tgz` or empty string for uncompressed files
|
150
158
|
* The `needs_fetch` lambda will receive a map with the following entries:
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
159
|
+
* `path`: the supplied path
|
160
|
+
* `version`: the supplied version string
|
161
|
+
* `binary_directory`: the supplied or default binary directory
|
162
|
+
|
155
163
|
The `RakeDependencies::Tasks::All` tasklib uses each of the following tasklibs
|
156
164
|
in its definition:
|
165
|
+
|
157
166
|
* `RakeDependencies::Tasks::Clean`
|
158
167
|
* `RakeDependencies::Tasks::Download`
|
159
168
|
* `RakeDependencies::Tasks::Extract`
|
@@ -163,7 +172,7 @@ in its definition:
|
|
163
172
|
|
164
173
|
### `RakeDependencies::Tasks::Clean`
|
165
174
|
|
166
|
-
The `RakeDependencies::Tasks::Clean` tasklib supports the following
|
175
|
+
The `RakeDependencies::Tasks::Clean` tasklib supports the following
|
167
176
|
configuration parameters:
|
168
177
|
|
169
178
|
| Name | Description | Default | Required |
|
@@ -174,82 +183,88 @@ configuration parameters:
|
|
174
183
|
|
175
184
|
### `RakeDependencies::Tasks::Download`
|
176
185
|
|
177
|
-
The `RakeDependencies::Tasks::Download` tasklib supports the following
|
186
|
+
The `RakeDependencies::Tasks::Download` tasklib supports the following
|
178
187
|
configuration parameters:
|
179
188
|
|
180
|
-
| Name
|
181
|
-
|
182
|
-
| `name`
|
183
|
-
| `dependency`
|
184
|
-
| `version`
|
185
|
-
| `path`
|
186
|
-
| `type`
|
187
|
-
| `
|
188
|
-
| `
|
189
|
-
| `
|
190
|
-
| `
|
189
|
+
| Name | Description | Default | Required |
|
190
|
+
|-------------------------------|---------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|
|
191
|
+
| `name` | The name of the task, required if it should be different from the default | `:download` | yes |
|
192
|
+
| `dependency` | The name of the dependency, used in status reporting | - | yes |
|
193
|
+
| `version` | The version of the dependency to manage, only required if used in templates | - | no |
|
194
|
+
| `path` | The path in which to install the dependency | - | yes |
|
195
|
+
| `type` | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed` | `:zip` | yes |
|
196
|
+
| `platform_os_names` | A map of platform OS identifiers to OS names to use in templates | `RakeDependencies::PlatformNames::OS` | yes |
|
197
|
+
| `platform_cpu_names` | A map of platform CPU identifiers to CPU names to use in templates | `RakeDependencies::PlatformNames::CPU` | yes |
|
198
|
+
| `distribution_directory` | The name of the directory under the supplied path into which to download the distribution | `'dist'` | yes |
|
199
|
+
| `uri_template` | A template for the URI of the distribution | - | yes |
|
200
|
+
| `file_name_template` | A template for the name of the downloaded file | - | yes |
|
191
201
|
|
192
202
|
Notes:
|
193
|
-
|
203
|
+
|
204
|
+
* The templates have the same instance variables in scope when rendered as
|
194
205
|
mentioned above.
|
195
206
|
|
196
207
|
### `RakeDependencies::Tasks::Extract`
|
197
208
|
|
198
|
-
The `RakeDependencies::Tasks::Extract` tasklib supports the following
|
209
|
+
The `RakeDependencies::Tasks::Extract` tasklib supports the following
|
199
210
|
configuration parameters:
|
200
211
|
|
201
|
-
| Name | Description
|
202
|
-
|
203
|
-
| `name` | The name of the task, required if it should be different from the default
|
204
|
-
| `dependency` | The name of the dependency, used in status reporting
|
205
|
-
| `version` | The version of the dependency to manage, only required if used in templates
|
206
|
-
| `path` | The path in which to install the dependency
|
207
|
-
| `type` | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`
|
208
|
-
| `
|
209
|
-
| `
|
210
|
-
| `
|
211
|
-
| `
|
212
|
-
| `
|
213
|
-
| `
|
214
|
-
| `
|
215
|
-
| `
|
212
|
+
| Name | Description | Default | Required |
|
213
|
+
|-------------------------------|----------------------------------------------------------------------------------------------|----------------------------------------|:--------:|
|
214
|
+
| `name` | The name of the task, required if it should be different from the default | `:extract` | yes |
|
215
|
+
| `dependency` | The name of the dependency, used in status reporting | - | yes |
|
216
|
+
| `version` | The version of the dependency to manage, only required if used in templates | - | no |
|
217
|
+
| `path` | The path in which to install the dependency | - | yes |
|
218
|
+
| `type` | The archive type of the distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed` | `:zip` | yes |
|
219
|
+
| `platform_os_names` | A map of platform OS identifiers to OS names to use in templates | `RakeDependencies::PlatformNames::OS` | yes |
|
220
|
+
| `platform_cpu_names` | A map of platform CPU identifiers to CPU names to use in templates | `RakeDependencies::PlatformNames::CPU` | yes |
|
221
|
+
| `extractors` | A map of archive types to extractor classes, see notes for further details | Extractors for all supported types | yes |
|
222
|
+
| `distribution_directory` | The name of the directory under the supplied path into which the distribution was downloaded | `'dist'` | yes |
|
223
|
+
| `binary_directory` | The name of the directory under the supplied path into which to extract/copy the binaries | `'bin'` | yes |
|
224
|
+
| `file_name_template` | A template for the name of the downloaded file | - | yes |
|
225
|
+
| `source_binary_name_template` | A template for the name of the binary before rename after extraction/copying | - | no |
|
226
|
+
| `target_binary_name_template` | A template for the name to rename the binary to after extraction/copying | - | no |
|
227
|
+
| `strip_path_template` | A template for the path to strip within an archive before extracting | - | no |
|
216
228
|
|
217
229
|
Notes:
|
218
|
-
|
230
|
+
|
231
|
+
* The templates have the same instance variables in scope when rendered as
|
219
232
|
mentioned above.
|
220
233
|
* The extractors map has entries for the following keys:
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
234
|
+
* `:zip`: An extractor class for zip files
|
235
|
+
* `:tar_gz`: An extractor class for tar.gz files
|
236
|
+
* `:tgz`: An alias for `:tar_gz` using the same extractor class
|
237
|
+
* `:uncompressed`: An extractor class that copies the source to the
|
238
|
+
destination
|
226
239
|
* The extractor map can be overridden but should include entries for all of the
|
227
240
|
above.
|
228
241
|
|
229
242
|
### `RakeDependencies::Tasks::Install`
|
230
243
|
|
231
|
-
The `RakeDependencies::Tasks::Install` tasklib supports the following
|
244
|
+
The `RakeDependencies::Tasks::Install` tasklib supports the following
|
232
245
|
configuration parameters:
|
233
246
|
|
234
|
-
| Name | Description
|
235
|
-
|
236
|
-
| `name` | The name of the task, required if it should be different from the default
|
237
|
-
| `dependency` | The name of the dependency, used in status reporting
|
238
|
-
| `version` | The version of the dependency to manage, only required if used in templates
|
239
|
-
| `path` | The path in which to install the dependency
|
240
|
-
| `type` | The archive type of the original distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed`
|
241
|
-
| `
|
242
|
-
| `
|
243
|
-
| `
|
244
|
-
| `
|
247
|
+
| Name | Description | Default | Required |
|
248
|
+
|--------------------------|----------------------------------------------------------------------------------------------------|----------------------------------------|:--------:|
|
249
|
+
| `name` | The name of the task, required if it should be different from the default | `:install` | yes |
|
250
|
+
| `dependency` | The name of the dependency, used in status reporting | - | yes |
|
251
|
+
| `version` | The version of the dependency to manage, only required if used in templates | - | no |
|
252
|
+
| `path` | The path in which to install the dependency | - | yes |
|
253
|
+
| `type` | The archive type of the original distribution, one of `:zip`, `:tar_gz`, `:tgz` or `:uncompressed` | `:zip` | yes |
|
254
|
+
| `platform_os_names` | A map of platform OS identifiers to OS names to use in templates | `RakeDependencies::PlatformNames::OS` | yes |
|
255
|
+
| `platform_cpu_names` | A map of platform CPU identifiers to CPU names to use in templates | `RakeDependencies::PlatformNames::CPU` | yes |
|
256
|
+
| `binary_directory` | The name of the directory under the supplied path into which to extract/copy the binaries | `'bin'` | yes |
|
257
|
+
| `installation_directory` | The name of the directory into which the binary should be installed | - | yes |
|
258
|
+
| `binary_name_template` | A template for the name of the binary | - | yes |
|
245
259
|
|
246
260
|
Notes:
|
247
|
-
|
261
|
+
|
262
|
+
* The templates have the same instance variables in scope when rendered as
|
248
263
|
mentioned above.
|
249
264
|
|
250
265
|
### `RakeDependencies::Tasks::Fetch`
|
251
266
|
|
252
|
-
The `RakeDependencies::Tasks::Fetch` tasklib supports the following
|
267
|
+
The `RakeDependencies::Tasks::Fetch` tasklib supports the following
|
253
268
|
configuration parameters:
|
254
269
|
|
255
270
|
| Name | Description | Default | Required |
|
@@ -261,7 +276,7 @@ configuration parameters:
|
|
261
276
|
|
262
277
|
### `RakeDependencies::Tasks::Ensure`
|
263
278
|
|
264
|
-
The `RakeDependencies::Tasks::Fetch` tasklib supports the following
|
279
|
+
The `RakeDependencies::Tasks::Fetch` tasklib supports the following
|
265
280
|
configuration parameters:
|
266
281
|
|
267
282
|
| Name | Description | Default | Required |
|
@@ -278,14 +293,15 @@ configuration parameters:
|
|
278
293
|
| `install_task` | The full name including namespaces of the install task | `<current-namespace>:install` | yes |
|
279
294
|
|
280
295
|
Notes:
|
281
|
-
|
296
|
+
|
297
|
+
* The templates have the same instance variables in scope when rendered as
|
282
298
|
mentioned above.
|
283
299
|
* The needs_fetch method receives the same parameter map as mentioned above.
|
284
|
-
|
300
|
+
|
285
301
|
## Development
|
286
302
|
|
287
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
288
|
-
run `rake spec` to run the tests. You can also run `bin/console` for an
|
303
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
304
|
+
run `rake spec` to run the tests. You can also run `bin/console` for an
|
289
305
|
interactive prompt that will allow you to experiment.
|
290
306
|
|
291
307
|
To install this gem onto your local machine, run `bundle exec rake install`. To
|
@@ -319,13 +335,12 @@ openssl aes-256-cbc \
|
|
319
335
|
|
320
336
|
## Contributing
|
321
337
|
|
322
|
-
Bug reports and pull requests are welcome on GitHub at
|
323
|
-
https://github.com/infrablocks/rake_dependencies. This project is intended to
|
324
|
-
|
338
|
+
Bug reports and pull requests are welcome on GitHub at
|
339
|
+
https://github.com/infrablocks/rake_dependencies. This project is intended to be
|
340
|
+
a safe, welcoming space for collaboration, and contributors are expected to
|
325
341
|
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
326
342
|
conduct.
|
327
343
|
|
328
|
-
|
329
344
|
## License
|
330
345
|
|
331
346
|
The gem is available as open source under the terms of the
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RakeDependencies
|
2
|
+
module PlatformNames
|
3
|
+
CPU = {
|
4
|
+
x86_64: 'amd64',
|
5
|
+
x64: 'amd64',
|
6
|
+
x86: '386',
|
7
|
+
arm: 'arm',
|
8
|
+
arm64: 'arm64'
|
9
|
+
}
|
10
|
+
OS = {
|
11
|
+
darwin: 'darwin',
|
12
|
+
linux: 'linux',
|
13
|
+
mswin32: 'windows',
|
14
|
+
mswin64: 'windows'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -19,7 +19,8 @@ module RakeDependencies
|
|
19
19
|
parameter :path, required: true
|
20
20
|
parameter :type, default: :zip
|
21
21
|
|
22
|
-
parameter :
|
22
|
+
parameter :platform_cpu_names, default: PlatformNames::CPU
|
23
|
+
parameter :platform_os_names, default: PlatformNames::OS
|
23
24
|
|
24
25
|
parameter :distribution_directory, default: 'dist'
|
25
26
|
parameter :binary_directory, default: 'bin'
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'rake_factory'
|
2
2
|
require 'open-uri'
|
3
|
+
require 'rubygems'
|
3
4
|
|
4
5
|
require_relative '../template'
|
6
|
+
require_relative '../platform_names'
|
5
7
|
|
6
8
|
module RakeDependencies
|
7
9
|
module Tasks
|
@@ -12,7 +14,9 @@ module RakeDependencies
|
|
12
14
|
}
|
13
15
|
|
14
16
|
parameter :type, default: :zip
|
15
|
-
|
17
|
+
|
18
|
+
parameter :platform_cpu_names, default: PlatformNames::CPU
|
19
|
+
parameter :platform_os_names, default: PlatformNames::OS
|
16
20
|
|
17
21
|
parameter :distribution_directory, default: 'dist'
|
18
22
|
|
@@ -24,18 +28,19 @@ module RakeDependencies
|
|
24
28
|
|
25
29
|
action do
|
26
30
|
parameters = {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
version: version,
|
32
|
+
platform: platform,
|
33
|
+
platform_cpu_name: platform_cpu_name,
|
34
|
+
platform_os_name: platform_os_name,
|
35
|
+
ext: ext
|
31
36
|
}
|
32
37
|
|
33
38
|
uri = Template.new(uri_template)
|
34
|
-
|
35
|
-
|
39
|
+
.with_parameters(parameters)
|
40
|
+
.render
|
36
41
|
download_file_name = Template.new(file_name_template)
|
37
|
-
|
38
|
-
|
42
|
+
.with_parameters(parameters)
|
43
|
+
.render
|
39
44
|
download_file_directory = File.join(path, distribution_directory)
|
40
45
|
download_file_path = File.join(download_file_directory, download_file_name)
|
41
46
|
|
@@ -47,16 +52,20 @@ module RakeDependencies
|
|
47
52
|
|
48
53
|
private
|
49
54
|
|
50
|
-
def
|
51
|
-
|
55
|
+
def platform
|
56
|
+
Gem::Platform.local
|
52
57
|
end
|
53
58
|
|
54
|
-
def
|
55
|
-
|
59
|
+
def platform_os_name
|
60
|
+
platform_os_names[platform.os.to_sym]
|
61
|
+
end
|
62
|
+
|
63
|
+
def platform_cpu_name
|
64
|
+
platform_cpu_names[platform.cpu.to_sym]
|
56
65
|
end
|
57
66
|
|
58
67
|
def resolved_type
|
59
|
-
type.is_a?(Hash) ? type[platform].to_sym : type.to_sym
|
68
|
+
type.is_a?(Hash) ? type[platform.os.to_sym].to_sym : type.to_sym
|
60
69
|
end
|
61
70
|
|
62
71
|
def ext
|
@@ -75,4 +84,4 @@ module RakeDependencies
|
|
75
84
|
end
|
76
85
|
end
|
77
86
|
end
|
78
|
-
end
|
87
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rake_factory'
|
2
2
|
require 'zip'
|
3
|
+
require 'rubygems'
|
3
4
|
|
4
5
|
require_relative '../template'
|
5
6
|
require_relative '../extractors'
|
@@ -13,10 +14,10 @@ module RakeDependencies
|
|
13
14
|
}
|
14
15
|
|
15
16
|
parameter :type, default: :zip
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
parameter :platform_cpu_names, default: PlatformNames::CPU
|
19
|
+
parameter :platform_os_names, default: PlatformNames::OS
|
20
|
+
|
20
21
|
parameter :extractors, default: {
|
21
22
|
zip: Extractors::ZipExtractor,
|
22
23
|
tar_gz: Extractors::TarGzExtractor,
|
@@ -39,7 +40,8 @@ module RakeDependencies
|
|
39
40
|
parameters = {
|
40
41
|
version: version,
|
41
42
|
platform: platform,
|
42
|
-
|
43
|
+
platform_cpu_name: platform_cpu_name,
|
44
|
+
platform_os_name: platform_os_name,
|
43
45
|
ext: ext
|
44
46
|
}
|
45
47
|
|
@@ -81,16 +83,20 @@ module RakeDependencies
|
|
81
83
|
extractors[resolved_type]
|
82
84
|
end
|
83
85
|
|
84
|
-
def
|
85
|
-
|
86
|
+
def platform
|
87
|
+
Gem::Platform.local
|
86
88
|
end
|
87
89
|
|
88
|
-
def
|
89
|
-
|
90
|
+
def platform_os_name
|
91
|
+
platform_os_names[platform.os.to_sym]
|
92
|
+
end
|
93
|
+
|
94
|
+
def platform_cpu_name
|
95
|
+
platform_cpu_names[platform.cpu.to_sym]
|
90
96
|
end
|
91
97
|
|
92
98
|
def resolved_type
|
93
|
-
type.is_a?(Hash) ? type[platform].to_sym : type.to_sym
|
99
|
+
type.is_a?(Hash) ? type[platform.os.to_sym].to_sym : type.to_sym
|
94
100
|
end
|
95
101
|
|
96
102
|
def ext
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'rake_factory'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
require_relative '../template'
|
2
5
|
|
3
6
|
module RakeDependencies
|
4
7
|
module Tasks
|
@@ -8,10 +11,8 @@ module RakeDependencies
|
|
8
11
|
"Install #{t.dependency}"
|
9
12
|
}
|
10
13
|
|
11
|
-
parameter :
|
12
|
-
|
13
|
-
linux: 'linux'
|
14
|
-
}
|
14
|
+
parameter :platform_cpu_names, default: PlatformNames::CPU
|
15
|
+
parameter :platform_os_names, default: PlatformNames::OS
|
15
16
|
|
16
17
|
parameter :dependency, required: true
|
17
18
|
parameter :version
|
@@ -27,7 +28,8 @@ module RakeDependencies
|
|
27
28
|
parameters = {
|
28
29
|
version: version,
|
29
30
|
platform: platform,
|
30
|
-
|
31
|
+
platform_cpu_name: platform_cpu_name,
|
32
|
+
platform_os_name: platform_os_name,
|
31
33
|
ext: ext
|
32
34
|
}
|
33
35
|
|
@@ -42,16 +44,22 @@ module RakeDependencies
|
|
42
44
|
cp binary_file_path, installation_directory
|
43
45
|
end
|
44
46
|
|
45
|
-
|
46
|
-
os_ids[platform]
|
47
|
-
end
|
47
|
+
private
|
48
48
|
|
49
49
|
def platform
|
50
|
-
|
50
|
+
Gem::Platform.local
|
51
|
+
end
|
52
|
+
|
53
|
+
def platform_os_name
|
54
|
+
platform_os_names[platform.os.to_sym]
|
55
|
+
end
|
56
|
+
|
57
|
+
def platform_cpu_name
|
58
|
+
platform_cpu_names[platform.cpu.to_sym]
|
51
59
|
end
|
52
60
|
|
53
61
|
def resolved_type
|
54
|
-
type.is_a?(Hash) ? type[platform].to_sym : type.to_sym
|
62
|
+
type.is_a?(Hash) ? type[platform.os.to_sym].to_sym : type.to_sym
|
55
63
|
end
|
56
64
|
|
57
65
|
def ext
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 3.2.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- lib/rake_dependencies.rb
|
240
240
|
- lib/rake_dependencies/extractors.rb
|
241
241
|
- lib/rake_dependencies/kernel_extensions.rb
|
242
|
+
- lib/rake_dependencies/platform_names.rb
|
242
243
|
- lib/rake_dependencies/task_sets.rb
|
243
244
|
- lib/rake_dependencies/task_sets/all.rb
|
244
245
|
- lib/rake_dependencies/tasks.rb
|