bullet_train-super_scaffolding 1.2.21 → 1.2.22

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: 223f16f152b545b1554a030ef0f492740fa59825d34f62ffc4685aadb6b7882e
4
- data.tar.gz: cda0b98a79b3d69c020e0ff61b7d4e40cb9029a382a760041cb2f3d6ec306d61
3
+ metadata.gz: 626091dfa183016d4944a4708cd94b6378c28be9732b8b98e8b54ad167de115c
4
+ data.tar.gz: 353cb3c7e7d7b601235ed0cb2762e48303037c0af10fcefb9f200347ad2acab0
5
5
  SHA512:
6
- metadata.gz: 5ccd6e1495cd0f281bec5c3474694d43effb3fbad17dd438e808733526e7dcebb0f9584f4d3c375aaebbf44871cca3c2ca11b0f41ed801a9e537f30edfa7d896
7
- data.tar.gz: 3949161365fc870eb977eb9962482123c8d30da896def52807ef0936dc86fd4089385a6147c94fcec71242d1fd988f60eb286f82f6e5b71bf5c0cc9bccf51dea
6
+ metadata.gz: ba96da3da40d384c9f36ba1f257470640ba9b2c95303536b80ef670cc1144301595e1ebfb0c6d83a4b32748e05eb361dbbb65b947ec8c8ab0316f33dfeb426be
7
+ data.tar.gz: 3051a564684d6a8cd46268bdeacd58bfa821d83aa462d63f1a1154b3b0fc9e7bf52cb0b590c1d3c1bc6c95638781d216240bb0058a42a748e7c4616558cf02de
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.2.21"
3
+ VERSION = "1.2.22"
4
4
  end
5
5
  end
@@ -398,10 +398,11 @@ class Scaffolding::RoutesFileManipulator
398
398
  existing_concerns.map! { |e| e.tr(":", "").tr("\"", "").squish&.to_sym }
399
399
  existing_concerns.filter! { |e| e.present? }
400
400
  existing_concerns << concern
401
+ existing_concerns.uniq!
401
402
  if line.include?("concerns:")
402
403
  lines[line_number].gsub!(/concerns: \[(.*)\]/, "concerns: [#{existing_concerns.map { |e| ":#{e}" }.join(", ")}]")
403
- elsif line.ends_with?(" do")
404
- lines[line_number].gsub!(/ do$/, " concerns: [#{existing_concerns.map { |e| ":#{e}" }.join(", ")}] do")
404
+ elsif line.squish.ends_with?(" do")
405
+ lines[line_number].gsub!(/ do$/, ", concerns: [#{existing_concerns.map { |e| ":#{e}" }.join(", ")}] do")
405
406
  else
406
407
  lines[line_number].gsub!(/resources :(.*)$/, "resources :\\1, concerns: [#{existing_concerns.map { |e| ":#{e}" }.join(", ")}]")
407
408
  end
@@ -668,6 +668,18 @@ class Scaffolding::Transformer
668
668
  type = parts.join(":")
669
669
  boolean_buttons = type == "boolean"
670
670
 
671
+ if first_table_cell && ["trix_editor", "ckeditor", "text_area"].include?(type)
672
+ puts ""
673
+ puts "The first attribute of your model cannot be any of the following types:".red
674
+ puts "1. trix_editor"
675
+ puts "2. ckeditor"
676
+ puts "3. text_area"
677
+ puts ""
678
+ puts "Please ensure you have another attribute type as the first attribute for your model and try again."
679
+
680
+ exit
681
+ end
682
+
671
683
  # extract any options they passed in with the field.
672
684
  # will extract options declared with either [] or {}.
673
685
  type, attribute_options = type.scan(/^(.*){(.*)}/).first || type
@@ -1523,6 +1535,12 @@ class Scaffolding::Transformer
1523
1535
  unless cli_options["skip-model"]
1524
1536
  scaffold_add_line_to_file("./app/models/scaffolding/completely_concrete/tangible_thing.rb", "def collection\n absolutely_abstract_creative_concept.completely_concrete_tangible_things\nend\n\n", METHODS_HOOK, prepend: true)
1525
1537
  scaffold_add_line_to_file("./app/models/scaffolding/completely_concrete/tangible_thing.rb", "include Sortable\n", CONCERNS_HOOK, prepend: true)
1538
+
1539
+ migration = Dir.glob("db/migrate/*").last
1540
+ migration_lines = File.open(migration).readlines
1541
+ parent_line_idx = Scaffolding::FileManipulator.find(migration_lines, "t.references :#{parent.downcase}")
1542
+ new_lines = Scaffolding::BlockManipulator.insert_line("t.integer :sort_order", parent_line_idx, migration_lines, false)
1543
+ Scaffolding::FileManipulator.write(migration, new_lines)
1526
1544
  end
1527
1545
 
1528
1546
  unless cli_options["skip-table"]
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.2.21
4
+ version: 1.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-11 00:00:00.000000000 Z
11
+ date: 2023-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  - !ruby/object:Gem::Version
193
193
  version: '0'
194
194
  requirements: []
195
- rubygems_version: 3.4.1
195
+ rubygems_version: 3.3.7
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Bullet Train Super Scaffolding