effective_developer 0.8.4 → 0.8.6

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: 8fba16ab5113f2da3b2868adf4bf3637728a1fa014ee77f3145e20662f7388dc
4
- data.tar.gz: b178128f65a9ac17b175e4346289fba89c5bbead7d7102d6af33ac84f9cbf012
3
+ metadata.gz: b4301272f072221d257e3be2d165b8c6029701e6128493c2ee0c53442027925d
4
+ data.tar.gz: 7183377a4e8dc061e6814e40affc5bc2d163e5251816afa5ad45b968364885ba
5
5
  SHA512:
6
- metadata.gz: c204417a800c42f41e313ee4c4af7301988224baf9ccce225f1a8bdb12cf519bd6c52003a5636c9461a8045f5e27f1ad4f3f6a1b21278913d60109d6a86d2b80
7
- data.tar.gz: e7238d4b8592aab380b80dfcb9fc82c2a45e9be0534c9cfc5f13258135df6d9c7fb5ce6e60edcf4329d8682c6ec0d99711fb381cefee9e3fed0e3f68cfd63c1b
6
+ metadata.gz: fcb5e9f23ccf6e57db2b0246a75d422d567a67ea5b7a775586155bb791a9723cdb5ce64c26e7628a794808190db954412f3e624cc6d051d57caa68f32764d997
7
+ data.tar.gz: 13c8ec6760dbc76e7f6afef9c8a07d735c9529bff16c053941b176a4f97982d3baef3cf6896df5af648dd3d5ae9415be4a54cbf03efda13c63399665120e2113
@@ -16,11 +16,14 @@ module Effective
16
16
  def replace!(old_value, new_value)
17
17
  raise("old_value cannot contain a \' character") if old_value.include?("'")
18
18
  raise("new_value cannot contain a \' character") if new_value.include?("'")
19
+
20
+ total = 0
19
21
 
20
22
  places.each do |table, columns|
21
23
  columns.each do |column|
22
24
  sql = "SELECT COUNT(*) FROM #{table} WHERE #{column} ILIKE '%#{old_value}%'"
23
25
  existing = ActiveRecord::Base.connection.execute(sql).first['count'].to_i
26
+ total += existing
24
27
 
25
28
  puts "Replacing #{existing} occurrences of #{old_value} with #{new_value} in #{table}.#{column}"
26
29
 
@@ -28,22 +31,28 @@ module Effective
28
31
  ActiveRecord::Base.connection.execute(sql)
29
32
  end
30
33
  end
31
-
32
- true
34
+
35
+ total
33
36
  end
34
37
 
35
38
  def count(old_value)
36
39
  raise("old_value cannot contain a \' character") if old_value.include?("'")
37
40
 
41
+ total = 0
42
+
38
43
  places.each do |table, columns|
39
44
  columns.each do |column|
40
45
  sql = "SELECT COUNT(*) FROM #{table} WHERE #{column} ILIKE '%#{old_value}%'"
41
46
  existing = ActiveRecord::Base.connection.execute(sql).first['count'].to_i
47
+ total += existing
42
48
 
43
49
  puts "There are #{existing} occurrences of #{old_value} in #{table}.#{column}"
44
50
  end
45
51
  end
52
+
53
+ total
46
54
  end
55
+ alias_method :find, :count
47
56
 
48
57
  end
49
58
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.8.4'.freeze
2
+ VERSION = '0.8.6'.freeze
3
3
  end
@@ -0,0 +1,16 @@
1
+ # rails bundle:update_effective_gems
2
+ namespace :bundle do
3
+ task :update_effective_gems do
4
+ puts "Updating all effective gems..."
5
+
6
+ effective_gems = File.readlines('Gemfile').map(&:strip).select { |line| line.start_with?('gem "effective_') }
7
+ effective_gems = effective_gems.map { |line| line.split('"')[1] } # Extract gem name
8
+
9
+ effective_gems.each do |gem_name|
10
+ puts "Updating #{gem_name}..."
11
+ system("bundle update --conservative #{gem_name}") || abort
12
+ end
13
+
14
+ puts "All done updating effective gems"
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-18 00:00:00.000000000 Z
11
+ date: 2025-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -120,6 +120,7 @@ files:
120
120
  - lib/tasks/reset_pk_sequence.rake
121
121
  - lib/tasks/sidekiq_clear.rake
122
122
  - lib/tasks/test_reset.rake
123
+ - lib/tasks/update_effective_gems.rake
123
124
  - lib/tasks/upgrade_forms.rake
124
125
  - lib/tasks/validate.rake
125
126
  homepage: https://github.com/code-and-effect/effective_developer