alterity 1.4.1 → 1.4.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: 20a0079693908430f136c8f85839cdfa2a39872a4ec021a9014b5fd8bf27c493
4
- data.tar.gz: 388fcc530f490f858e344eaf2a24e1287b275cae3b33739ced28b7a1a8a42d9f
3
+ metadata.gz: 17e41112c9c2dbf07aa9115bbe62ead1666d8802f0ce67a57bb5c9390ff85ecf
4
+ data.tar.gz: 815373d5f3832cea20695a067c2e7ecaf7823bddb5ca7769a5de2f42e371cc01
5
5
  SHA512:
6
- metadata.gz: '095a935c8a09050ddfe41c0b149c167a9264d9f343260c06501717fe54fabd31cdb134634db009db13468efbe7f88ccff120889095e854edf2295f9523d15bc1'
7
- data.tar.gz: 701b4b23a3478f4b8c3302371b41f5b70acbea0410e2dc5b5430ad88dd97f80926d211ea11f821cb43f4f33d6e66a14163e14fe7e94d85a3f9825d294b9b1fc1
6
+ metadata.gz: 7ea71bf4f05a6413e864dce3f781dd3231a7832022bc21b890bdafeb4ca3e522222118929723f35495655a97863d60db1619f973c6f3b5d970c7c5cb63fcfe6b
7
+ data.tar.gz: ace1c68c92fe85b4704034be10f166b66e392777de6ebf1aafdc151fa6eb1e0ccb0e61fb636754507853fe6a33fbe5431bf38f347d915486435a58af6f432a47
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Alterity
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.2"
5
5
  end
data/lib/alterity.rb CHANGED
@@ -53,7 +53,7 @@ class Alterity
53
53
  altered_table = table.delete("`")
54
54
  alter_argument = %("#{updates.gsub('"', '\\"').gsub('`', '\\\`')}")
55
55
  prepared_command = config.command.call(altered_table, alter_argument).to_s.gsub(/\n/, "\\\n")
56
- puts "[Alterity] Will execute: #{prepared_command}"
56
+ puts "[Alterity] Will execute: #{sanitize(prepared_command)}"
57
57
  config.before_command&.call(prepared_command)
58
58
 
59
59
  result_str = +""
@@ -71,6 +71,11 @@ class Alterity
71
71
  raise("[Alterity] Command failed. Full output: #{result_str}") unless exit_status.success?
72
72
  end
73
73
 
74
+ def sanitize(command)
75
+ return command unless config.password.present?
76
+ command.gsub(config.password, '[filtered]')
77
+ end
78
+
74
79
  def set_database_config
75
80
  db_config_hash = ActiveRecord::Base.connection_db_config.configuration_hash
76
81
  %i[host port database username password].each do |key|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alterity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Maximin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-28 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2