rails_data_fix 0.1.2 → 0.1.3

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: 305ea02cd2e326f96a36e389f40315c1349fba330207f77a8b7e8fa945538f08
4
- data.tar.gz: dacada1ccc1d59f9baf4161bf74cd7382d408373be9df99e3a8a8561e5876857
3
+ metadata.gz: bc28a37226025ab6b7b8098bfa7efa7188ce820cd4a997df980c051e25dfba63
4
+ data.tar.gz: d51ff37dfc9b938cef62401729d8f66ca12d92244f869da6511ed38e074c3947
5
5
  SHA512:
6
- metadata.gz: 27fd858d5c597b49fff10c57e5618de11acef092a07a92243fb7242434c72f71931c218db99ee42f34641fbe2efa8c7c7ee26414957149fffcbe4add10500478
7
- data.tar.gz: 7d19568cfece9ed4f1c839380b2b8188d7e213908f0159d6835ea02b9070a22dbf7e518c01d5df7d08fd27e6f012b061f24477e6b1cff7cde94ecb0828579413
6
+ metadata.gz: f7a8e0fad7689c3c6388daff2b92f8a2ca3647094f3e27f8351ac2a7a733dbd2ebf44d9cd90a504fb6f9af7271b48dc23191fdcb3d08926f149a25b765159518
7
+ data.tar.gz: 630cef99f8dd1b1b6b780e500e39cfe18c5ba283ec48835bee70d5312dc4bdcaf8b45d4ccfcf67a49c16e38a415c1e16a9962d6bab8317f4dde1304306781f84
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- data_fix (0.1.0)
4
+ rails_data_fix (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -46,7 +46,7 @@ PLATFORMS
46
46
  x86_64-linux
47
47
 
48
48
  DEPENDENCIES
49
- data_fix!
49
+ rails_data_fix!
50
50
  rake (~> 13.0)
51
51
  rspec (~> 3.0)
52
52
  rubocop (~> 1.7)
data/README.org CHANGED
@@ -3,6 +3,19 @@
3
3
 
4
4
  Manage your data maintenance tasks like migrations.
5
5
 
6
+ #+begin_quote
7
+ I am not sure how it slipped through, but I realized there is
8
+ another gem, [[https://rubygems.org/gems/data_migrate/versions][data_migrate]], which does the same thing as =data_fix=.
9
+
10
+ ... well, I should actually say it the other way around, since
11
+ =data_migrate= has been around for longer and has been downloaded
12
+ extensively.
13
+
14
+ We keep using and maintaining =data_fix=, but if you are starting
15
+ from scratch, [[https://rubygems.org/gems/data_migrate/versions][data_migrate]] is probably a more complete and safer
16
+ choice.
17
+ #+end_quote
18
+
6
19
  * Introduction
7
20
 
8
21
  This Rails gem provides a set of tasks to manage DB data maintenance
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DataFix
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -56,20 +56,32 @@ namespace :data_fix do
56
56
  db_name = config["database"]
57
57
  backup_db_name = db_name.gsub(/\.sqlite3$/, "-#{Date.today.strftime('%Y-%m-%d')}.sqlite3")
58
58
  cmd = "cp \"#{db_name}\" \"#{backup_db_name}\""
59
- when "mysql2"
59
+ dry_run_msg = "WOULD RUN: #{cmd}"
60
+ when "mysql2"
60
61
  db_host = config["host"]
61
62
  db_name = config["database"]
62
63
  db_username = config["username"]
63
64
  db_password = config["password"]
64
65
  backup_db_name = "db/#{db_name}-#{Rails.env}-#{Date.today.strftime('%Y-%m-%d')}.sql"
65
- cmd = "mysqldump -u #{db_name} -p #{db_password} #{db_name} > \"#{backup_db_name}\""
66
+ cmd = "mysqldump -u #{db_name} -p#{db_password} #{db_name} > \"#{backup_db_name}\""
67
+ dry_run_msg = "WOULD RUN: #{cmd}"
68
+ else
69
+ dry_run_mgs = ""
66
70
  end
71
+
67
72
  if dry_run
68
- puts_and_log "WOULD RUN: #{cmd}"
69
- else
73
+ puts_and_log dry_run_msg
74
+ elsif cmd
70
75
  system cmd
76
+ puts_and_log "backup performed and available as #{backup_db_name}."
77
+ else
78
+ puts "WARNING: I don't know how to backup for #{config[:adapter]})"
79
+ while (answer != "Y" and answer != "n")
80
+ puts "Proceed anyway? [Y/n]"
81
+ read answer
82
+ end
83
+ exit unless answer == "Y"
71
84
  end
72
- puts_and_log "backup performed and available as #{backup_db_name}."
73
85
  end
74
86
 
75
87
  def df_status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_data_fix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " This gem provides a set of commands to manage data maintenance scripts
14
14
  of a Rails application like migrations. \n\nEach script has a timestamped name;