effective_developer 0.6.8 → 0.6.9
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 +4 -4
- data/app/models/effective/form_upgrader.rb +32 -8
- data/lib/effective_developer/version.rb +1 -1
- data/lib/tasks/pg_pull.rake +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c86580e62fc1a59098e658e5b98c05391113df75d13ab858cdc49ff045ff0cdd
|
4
|
+
data.tar.gz: 2a99640bbb2152e3ac88c4d7f360e1f9075016c218fc4b3054c0e5052b688430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0943fad39d092da9bd58075184fa2fafdb78e48d33c48857ad775af9b319986cb1bf273610a2ac7c9ad801dca50033f39f28374074605f627d12c35b63c1a5d
|
7
|
+
data.tar.gz: 65bf51e762c888b44fb5e3d2aeddc88e7eb66b5b8b67227d72a347e1da44c9f72cc474ed681d661ac61dbcdcab2c1c7b3551a1e6f965a525a41b06729e1464b7
|
@@ -38,6 +38,8 @@ module Effective
|
|
38
38
|
private
|
39
39
|
|
40
40
|
SIMPLE_FORM_FOR_REGEX = /simple_form_for( |\()(\[:[^,]+, ?[^,]+\])?(([^,]+),)?.+do \|(\w+)\|/
|
41
|
+
SIMPLE_FORM_FOR_REGEX2 = /simple_form_for\((\w+).+?\) do \|(\w+)\|/
|
42
|
+
|
41
43
|
SIMPLE_FORM_INPUT_ATTRIBUTE = /\.input( |\():(\w+)/
|
42
44
|
SIMPLE_FORM_INPUT_AS_ONE = /(as: :(\w+))/
|
43
45
|
SIMPLE_FORM_INPUT_AS_TWO = /(:as => :(\w+))/
|
@@ -53,17 +55,38 @@ module Effective
|
|
53
55
|
# Replace simple_form_for
|
54
56
|
writer.all { |line| line.include?('simple_form_for') }.each do |line|
|
55
57
|
content = writer.lines[line]
|
58
|
+
|
59
|
+
# Try first time
|
56
60
|
matched = content.match(SIMPLE_FORM_FOR_REGEX)
|
57
|
-
raise("unable to match simple_form_for from:\n#{content}") unless matched.present?
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
+
if matched.present?
|
63
|
+
original = matched[0]
|
64
|
+
model = matched[2] || matched[4]
|
65
|
+
letter = matched[5]
|
62
66
|
|
63
|
-
|
67
|
+
if original && model && letter
|
68
|
+
content.sub!(original, "effective_form_with(model: #{model}) do |#{letter}|")
|
69
|
+
writer.replace(line, content)
|
70
|
+
next
|
71
|
+
end
|
72
|
+
end
|
64
73
|
|
65
|
-
|
66
|
-
|
74
|
+
# Try second time
|
75
|
+
matched = content.match(SIMPLE_FORM_FOR_REGEX2)
|
76
|
+
|
77
|
+
if matched.present?
|
78
|
+
original = matched[0]
|
79
|
+
model = matched[1]
|
80
|
+
letter = matched[2]
|
81
|
+
|
82
|
+
if original && model && letter
|
83
|
+
content.sub!(original, "effective_form_with(model: #{model}) do |#{letter}|")
|
84
|
+
writer.replace(line, content)
|
85
|
+
next
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
puts("unable to determine simple_form_for subject from:\n#{content}")
|
67
90
|
end
|
68
91
|
|
69
92
|
# Try to figure out klass again if its missing from filename
|
@@ -189,7 +212,8 @@ module Effective
|
|
189
212
|
when 'text' then 'text_area'
|
190
213
|
when 'url' then 'url_field'
|
191
214
|
else
|
192
|
-
|
215
|
+
puts("unknown input type #{input_type} (for attribute :#{attribute})")
|
216
|
+
'text_field'
|
193
217
|
end
|
194
218
|
end
|
195
219
|
|
data/lib/tasks/pg_pull.rake
CHANGED
@@ -18,8 +18,8 @@ namespace :pg do
|
|
18
18
|
args.with_defaults(defaults.compact.merge(env_keys.compact).merge(keywords))
|
19
19
|
|
20
20
|
# Validate Config
|
21
|
-
config = ActiveRecord::Base.configurations[Rails.env]
|
22
21
|
configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env)
|
22
|
+
config = configs.first
|
23
23
|
|
24
24
|
if configs.length > 1 && args.database.blank?
|
25
25
|
puts "Multiple database configs exist for #{Rails.env} environment."
|
@@ -102,8 +102,8 @@ namespace :pg do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
# Validate Config
|
105
|
-
config = ActiveRecord::Base.configurations[Rails.env]
|
106
105
|
configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env)
|
106
|
+
config = configs.first
|
107
107
|
|
108
108
|
if configs.length > 1 && args.database.blank?
|
109
109
|
puts "Multiple database configs exist for #{Rails.env} environment."
|
@@ -151,8 +151,8 @@ namespace :pg do
|
|
151
151
|
{ username: uri.user, password: uri.password, host: uri.host, port: (uri.port || 5432), database: uri.path.sub('/', '') }
|
152
152
|
else
|
153
153
|
# Validate Config
|
154
|
-
config = ActiveRecord::Base.configurations[Rails.env]
|
155
154
|
configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env)
|
155
|
+
config = configs.first
|
156
156
|
|
157
157
|
if configs.length > 1 && args.database.blank?
|
158
158
|
puts "Multiple database configs exist for #{Rails.env} environment."
|
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.6.
|
4
|
+
version: 0.6.9
|
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: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|