effective_developer 0.8.4 → 0.8.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4301272f072221d257e3be2d165b8c6029701e6128493c2ee0c53442027925d
|
4
|
+
data.tar.gz: 7183377a4e8dc061e6814e40affc5bc2d163e5251816afa5ad45b968364885ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
@@ -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
|
+
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:
|
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
|