bartask 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a28ec79acd35a6b336145c815cfe1db335b77a39d9e129f4651d304a7e3821b
4
- data.tar.gz: 639e410f31d96ac1ff959276adcb7a83d7bf70737afdb9f361a52dab87e03e82
3
+ metadata.gz: 5c5bbc8dd14090413f10d88eb983b6c6e3f77343e46ba9995ac92d2e12347724
4
+ data.tar.gz: ee7829dd51a8423233b9f5a17665d54ce9af5747cbe0a540b2b4a8ca7f3513fe
5
5
  SHA512:
6
- metadata.gz: fb3ef91962d923d340416a975f022c4fb996b48517711d9932e53577aa47eef8addfc4b51582910207681b383d8872536e782cadf154c96b13d0aed1e99d2f63
7
- data.tar.gz: deed1e19a2eaa91dd6cf3c8e666c255488ec51597a81706689311ca887cdbd33323e3264989b4ff27b132132f1ec4bc599a2da84515bfcfc07c01f7d181cc4ce
6
+ metadata.gz: 68aeae9809b6dc91c22281e99c41673fd02d09fd2ff234d5c7bf09dfed5d460b6d2773d96ba7e2caf0d37b3c8383609d4429c66b471d43c385e15fe366a259f4
7
+ data.tar.gz: c7b953ba407b1ed8b4f1a68b8af6d7e7e86e4d51f01bf25935ba12d654bb55f20c674ea75ee05d0ebe71a8fc3028c8a61a22b71ba3d7c123e91e0c33cb9624e4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2025-09-25
4
+
5
+ - Show a confirm dialog before dumping and restoring
6
+
7
+ ## [0.1.1] - 2024-12-26
8
+
9
+ - Allow to specify the dump file path via args
10
+
3
11
  ## [0.1.0] - 2024-12-11
4
12
 
5
13
  - Initial release
data/lib/bartask/base.rb CHANGED
@@ -65,5 +65,13 @@ module Bartask
65
65
  options.push(*%w[--clean --no-owner --no-acl])
66
66
  options
67
67
  end
68
+
69
+ def confirm(message)
70
+ return true if ENV["BARTASK_SKIP_CONFIRM"] == "true" || ENV["RAILS_ENV"] == "test"
71
+
72
+ $stdout.print "#{message} (y/N): "
73
+ response = $stdin.gets.chomp
74
+ response.downcase == 'y' || response.downcase == 'yes'
75
+ end
68
76
  end
69
77
  end
@@ -3,6 +3,11 @@
3
3
  module Bartask
4
4
  class Dumper < Base
5
5
  def execute
6
+ unless confirm("Are you sure you want to dump the database to '#{dump_file_path}'?")
7
+ $stdout.puts "Dump operation cancelled."
8
+ return
9
+ end
10
+
6
11
  if mysql?
7
12
  system("mysqldump #{build_options_for_mysql.join(' ')} > #{dump_file_path}")
8
13
  elsif postgresql?
@@ -3,6 +3,11 @@
3
3
  module Bartask
4
4
  class Restorer < Base
5
5
  def execute
6
+ unless confirm("Are you sure you want to restore the database from '#{dump_file_path}'? This will overwrite existing data.")
7
+ $stdout.puts "Restore operation cancelled."
8
+ return
9
+ end
10
+
6
11
  if mysql?
7
12
  system("mysql #{build_options_for_mysql.join(' ')} < #{dump_file_path}", exception: true)
8
13
  elsif postgresql?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bartask
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bartask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-12-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- description:
28
26
  email:
29
27
  - yuuji.yaginuma@gmail.com
30
28
  executables:
@@ -49,7 +47,6 @@ licenses:
49
47
  - MIT
50
48
  metadata:
51
49
  homepage_uri: https://github.com/y-yagi/bartask
52
- post_install_message:
53
50
  rdoc_options: []
54
51
  require_paths:
55
52
  - lib
@@ -64,8 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
61
  - !ruby/object:Gem::Version
65
62
  version: '0'
66
63
  requirements: []
67
- rubygems_version: 3.5.22
68
- signing_key:
64
+ rubygems_version: 3.6.7
69
65
  specification_version: 4
70
66
  summary: Backup and Recovery tool for RDBMS of Rails development.
71
67
  test_files: []