central 0.3.2 → 0.3.4
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/bin/central +4 -1
- data/lib/central.rb +28 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a64bd2fc8054ae30e37591f0363bc357dd1cd4ad568d76ed95c3e92058bb4df
|
4
|
+
data.tar.gz: e1ac4186fb8339717c42554a4c26b38636a7d2be55de43707c2fab5f89fa222a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a72d79f7f988363556bf722ad65c353463de06b65b74db2e085c7d22070bfd1ec0c5a29b6f9c3d80e6c9acf8346e47c8c4ea762ed8cf7976291d55ccdc5a41
|
7
|
+
data.tar.gz: 460c3b8fa559ee287a7fde43a6c6a97b4b517ecc8f67509a48f745a2dfaa63513e5c5901f47f1352ae2fb6d97c7af7bee6c40f0b854f1173a98eedb5aabaff66
|
data/bin/central
CHANGED
data/lib/central.rb
CHANGED
@@ -321,6 +321,29 @@ def symlink(from, to)
|
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
324
|
+
# extract archive, supports tar, zip, 7z
|
325
|
+
def extract(path, todir)
|
326
|
+
path = abs(path)
|
327
|
+
todir = abs(todir)
|
328
|
+
unless file_exists?(path)
|
329
|
+
fail "Archive file #{path} does not exists"
|
330
|
+
end
|
331
|
+
mkdir(todir)
|
332
|
+
info 'Extracting archive', "#{path} → #{todir}"
|
333
|
+
exit_code = nil, output = nil
|
334
|
+
if path.end_with?('.zip')
|
335
|
+
exit_code, output, = shell("unzip \"#{path}\" -d \"#{todir}\" 2>&1")
|
336
|
+
elsif path.end_with?('.7z')
|
337
|
+
exit_code, output, = shell("7z x -o\"#{todir}\" \"#{path}\" 2>&1")
|
338
|
+
else
|
339
|
+
exit_code, output, = shell("tar -xf \"#{path}\" -C \"#{todir}\" 2>&1")
|
340
|
+
end
|
341
|
+
unless exit_code.success?
|
342
|
+
error output
|
343
|
+
fail "Couldn't extract archive", path
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
324
347
|
# git clone url into a path
|
325
348
|
def git(url, path, branch: nil, silent: true, depth: nil)
|
326
349
|
path = abs(path)
|
@@ -355,14 +378,14 @@ def git(url, path, branch: nil, silent: true, depth: nil)
|
|
355
378
|
end
|
356
379
|
|
357
380
|
# download url into a path using curl
|
358
|
-
def curl(url, path, content_length_check: false, verbose: false)
|
381
|
+
def curl(url, path, content_length_check: false, verbose: false, flags: '-L -s -S')
|
359
382
|
path = abs(path)
|
360
383
|
if content_length_check and file_exists?(path)
|
361
|
-
content_length = curl_headers(url, verbose: verbose)['content-length'].to_i
|
384
|
+
content_length = curl_headers(url, verbose: verbose, flags: flags)['content-length'].to_i
|
362
385
|
return if file_size(path) == content_length
|
363
386
|
end
|
364
387
|
info 'Downloading', "#{url} → #{path}"
|
365
|
-
exit_code, output, = shell("curl
|
388
|
+
exit_code, output, = shell("curl #{flags} \"#{url}\"",
|
366
389
|
verbose: verbose, silent: true)
|
367
390
|
unless exit_code.success?
|
368
391
|
error output
|
@@ -373,8 +396,8 @@ def curl(url, path, content_length_check: false, verbose: false)
|
|
373
396
|
end
|
374
397
|
|
375
398
|
# get url response headers as Hash using curl
|
376
|
-
def curl_headers(url, method: 'HEAD', verbose: false)
|
377
|
-
exit_code, output, = shell("curl -I -X #{method}
|
399
|
+
def curl_headers(url, method: 'HEAD', verbose: false, flags: '-L -s -S')
|
400
|
+
exit_code, output, = shell("curl -I -X #{method} #{flags} \"#{url}\"",
|
378
401
|
verbose: verbose, silent: true)
|
379
402
|
unless exit_code.success?
|
380
403
|
error output
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Geurkov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: central dotfile management system
|
14
14
|
email: d.geurkov@gmail.com
|
@@ -23,7 +23,7 @@ homepage: https://github.com/troydm/central
|
|
23
23
|
licenses:
|
24
24
|
- LGPL-3.0
|
25
25
|
metadata: {}
|
26
|
-
post_install_message:
|
26
|
+
post_install_message:
|
27
27
|
rdoc_options: []
|
28
28
|
require_paths:
|
29
29
|
- lib
|
@@ -38,8 +38,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
|
-
rubygems_version: 3.
|
42
|
-
signing_key:
|
41
|
+
rubygems_version: 3.4.20
|
42
|
+
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: central dotfile management
|
45
45
|
test_files: []
|