bullet_train-super_scaffolding 1.12.2 → 1.13.0

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: be0df510fd098c114487239ac00e69b54856df38cef8655d61316f8119c1d9ce
4
- data.tar.gz: 0aec8526362652c9003780d54cd2245e5b137ececb2d162997588517f37e51c8
3
+ metadata.gz: c09f3265f2f2ac25a7263a439d8063a76824ea4cb71fce595a33539de4a38c77
4
+ data.tar.gz: 6bf546e51c6792abeb1eda3a917cb0002097020920a610b1ab7f05d7ab093b42
5
5
  SHA512:
6
- metadata.gz: 87e04a49f198d65ea4c71f67641b59c68387a61dfd064cf30ac42cfa3f987f612ca5bd9db5d0569f407f4d177b1a12c52f0e0e5b74a7d4042165dba526d011b5
7
- data.tar.gz: 313288579b1ccb287d0026c65d77d11da4b24527321719ddfb6f046b553ecd7b293666e140a1f0598a00e817c9eb848045091e835119eb6295fd67bdda7e1246
6
+ metadata.gz: 3f373fcd3eabb9486dc4b2d4aeffd6029d48a257292d8154dd215df985bb278794f492cb994748972dfd4b54932c597b751b4d6445c93a8c5bee6b9892898f43
7
+ data.tar.gz: 0cd5d3b9cd18b483fc8f90afc63264261e352068a01375f2df860cbb68a62cf5ee232355ae10b63ee554e28563ec0b5a148aaf6632f75df8b0a5e52c2f39c5c6
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.12.2"
3
+ VERSION = "1.13.0"
4
4
  end
5
5
  end
@@ -327,7 +327,19 @@ class Scaffolding::Transformer
327
327
 
328
328
  if target_file_content.include?(transformed_content) && !content_matches_model_name
329
329
  puts "No need to update '#{transformed_file_name}'. It already has '#{transformed_content}'." unless silence_logs?
330
-
330
+ elsif !target_file_content.include?(transform_hook)
331
+ unless options[:suppress_could_not_find_hook]
332
+ puts
333
+ puts "-------------------------------".yellow
334
+ puts "Heads up! We weren't able to find a super scaffolding hook where we expected it to be.".yellow
335
+ puts "In #{transformed_file_name}".yellow
336
+ puts "We expected to find a line like this:".yellow
337
+ puts transform_hook.yellow
338
+ puts
339
+ puts "See https://bullettrain.co/docs/super-scaffolding/targets for more details.".yellow
340
+ puts "-------------------------------".yellow
341
+ puts
342
+ end
331
343
  else
332
344
 
333
345
  new_target_file_content = []
@@ -967,10 +979,16 @@ class Scaffolding::Transformer
967
979
  "./app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb",
968
980
  "./app/controllers/api/v1/scaffolding/completely_concrete/tangible_things_controller.rb"
969
981
  ].each do |file|
982
+ # We usually do StrongParams stuff in the API controller and the Account controller inherits it from there.
983
+ # We _used_ to do StrongParams stuff directly in the Account controller. So for backwards compatibility we
984
+ # need to try to make updates in the Account controller, but if we can't find the target hook there's no need
985
+ # to show an error and make the developer think that they've broken something.
986
+ suppress_could_not_find_hook = file.match("/account/")
987
+
970
988
  if attribute.is_ids? || attribute.is_multiple?
971
- scaffold_add_line_to_file(file, "#{attribute.name}: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true)
989
+ scaffold_add_line_to_file(file, "#{attribute.name}: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
972
990
  if attribute.file_field? || attribute.active_storage_image?
973
- scaffold_add_line_to_file(file, "#{attribute.name}_removal: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true)
991
+ scaffold_add_line_to_file(file, "#{attribute.name}_removal: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
974
992
  end
975
993
  elsif attribute.type == "address_field"
976
994
  address_strong_params = <<~RUBY
@@ -985,11 +1003,11 @@ class Scaffolding::Transformer
985
1003
  :postal_code
986
1004
  ],
987
1005
  RUBY
988
- scaffold_add_line_to_file(file, address_strong_params, RUBY_NEW_ARRAYS_HOOK, prepend: true)
1006
+ scaffold_add_line_to_file(file, address_strong_params, RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
989
1007
  else
990
- scaffold_add_line_to_file(file, ":#{attribute.name},", RUBY_NEW_FIELDS_HOOK, prepend: true)
1008
+ scaffold_add_line_to_file(file, ":#{attribute.name},", RUBY_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
991
1009
  if attribute.file_field? || attribute.active_storage_image?
992
- scaffold_add_line_to_file(file, ":#{attribute.name}_removal,", RUBY_NEW_FIELDS_HOOK, prepend: true)
1010
+ scaffold_add_line_to_file(file, ":#{attribute.name}_removal,", RUBY_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
993
1011
  end
994
1012
  end
995
1013
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_scaffolding
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard