miga-base 1.3.15.6 → 1.3.15.7

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: 8916ac865e1757da585e0733f702774651ebd14904945d8f92328a2c78776e7f
4
- data.tar.gz: 016f4ba658e387607f79bc131ae4d34a362cc6b4d2be1a91314fdbdf67099513
3
+ metadata.gz: bfa29b8ed7a76baa9e4d4dd95f446894009cf94827ba2a21b9eb3c0f70e9ce7e
4
+ data.tar.gz: f62bf672f2cbd1ee8a6faf5d92c57585387d8b9178b870eaa0988b061f19640f
5
5
  SHA512:
6
- metadata.gz: 8dbb5768f3af98c8f69b7a8e6bbcca27044353bfc1437972927c5a67a2aa28d8a94c870875571b2361b3912f6ef3bdf495346b231607e4f51fb1f53b11116f91
7
- data.tar.gz: 84b1efa30ab43926a3ab651ffe4f33822b661b165b9a284f3f9b7320e1614f7496be1052534a004115cee52e96bac34a86c189b81fe075bd789ce407c20fead4
6
+ metadata.gz: 10c0c19433ae493b30d7891577d6f8550714f6dbacdb42ce5e52ef180a77d8c78bfe2f2c6675c440623eaeb9792f4bf81cddc7b98628d08016c2f9ff1e8f13c4
7
+ data.tar.gz: a56c23c70bdc95a1b2c3b2060dfc8b436accd206fe6e60af01401383ed736ee156b6b2a0eeed4e678c88ec1febeea17b96067b0657ce9ad9749509a9cca74d82
@@ -80,7 +80,7 @@ class MiGA::Cli::Action::Db < MiGA::Cli::Action
80
80
  cli.puts "# Host: #{manif[:host]}"
81
81
  cli.puts "# Manifest last update: #{manif[:last_update]}"
82
82
  list_databases(manif) and return
83
- db = db_requested(manif)
83
+ db_sym, db = db_requested(manif)
84
84
  list_versions(db) and return
85
85
  ver = version_requested(db)
86
86
  check_target and return
@@ -88,7 +88,7 @@ class MiGA::Cli::Action::Db < MiGA::Cli::Action
88
88
  # Download and expand
89
89
  file = download_file(@ftp, ver[:path], cli[:reuse_archive])
90
90
  check_digest(ver, file)
91
- unarchive(file)
91
+ unarchive(file, db_sym.to_s)
92
92
  register_database(manif, db, ver)
93
93
  end
94
94
 
@@ -168,7 +168,7 @@ class MiGA::Cli::Action::Db < MiGA::Cli::Action
168
168
  db = manif[:databases][cli[:database]]
169
169
  raise 'Cannot find database in this host' if db.nil?
170
170
 
171
- db
171
+ [cli[:database], db]
172
172
  end
173
173
 
174
174
  def version_requested(db)
@@ -240,13 +240,28 @@ class MiGA::Cli::Action::Db < MiGA::Cli::Action
240
240
  cli.num_suffix(ver[:size_unarchived], true) + ')'
241
241
  end
242
242
 
243
- def unarchive(file)
243
+ def unarchive(file, db_name)
244
244
  cli.say "Unarchiving #{file}"
245
+ tmp_archive = File.join(cli[:local], '.TMP_ARCHIVE')
246
+ FileUtils.mkdir_p(tmp_archive)
245
247
  MiGA::MiGA.run_cmd <<~CMD
246
- cd #{cli[:local].shellescape} \
248
+ cd #{tmp_archive.shellescape} \
247
249
  && tar -zxf #{file.shellescape} \
248
250
  && rm #{file.shellescape}
249
251
  CMD
252
+
253
+ target = File.join(cli[:local], db_name)
254
+ source = File.join(tmp_archive, db_name)
255
+ if Dir.exist?(target)
256
+ cli.say 'Replacing previous version'
257
+ tmp = File.join(tmp_archive, "#{db_name}.old")
258
+ File.rename(target, tmp)
259
+ File.rename(source, target)
260
+ File.rm_rf(tmp)
261
+ else
262
+ File.rename(source, target)
263
+ end
264
+ Dir.unlink(tmp_archive) if Dir.empty?(tmp_archive)
250
265
  end
251
266
 
252
267
  def register_database(manif, db, ver)
@@ -10,8 +10,8 @@ class MiGA::Cli::Action::Env < MiGA::Cli::Action
10
10
 
11
11
  def perform
12
12
  puts <<~BASH
13
- MIGA="#{MiGA::MiGA.root_path}"
14
- MIGA_HOME=${MIGA_HOME:-"$HOME"}
13
+ export MIGA="#{MiGA::MiGA.root_path}"
14
+ export MIGA_HOME=${MIGA_HOME:-"$HOME"}
15
15
  . "$MIGA_HOME/.miga_rc"
16
16
  # Ensure MiGA & submodules are first in PATH
17
17
  export PATH="$MIGA/bin:$PATH"
data/lib/miga/version.rb CHANGED
@@ -12,7 +12,7 @@ module MiGA
12
12
  # - String indicating release status:
13
13
  # - rc* release candidate, not released as gem
14
14
  # - [0-9]+ stable release, released as gem
15
- VERSION = [1.3, 15, 6].freeze
15
+ VERSION = [1.3, 15, 7].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
@@ -20,7 +20,7 @@ module MiGA
20
20
 
21
21
  ##
22
22
  # Date of the current gem relese.
23
- VERSION_DATE = Date.new(2024, 6, 5)
23
+ VERSION_DATE = Date.new(2024, 6, 17)
24
24
 
25
25
  ##
26
26
  # References of MiGA
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.15.6
4
+ version: 1.3.15.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-05 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons