bullet_train-super_scaffolding 1.0.8 → 1.0.9

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: bfdc2fb6d3d94d5db53ecf46bd69b01cb429fa35d3e3d73439e98baf37badee6
4
- data.tar.gz: bb887c194a7c8e0bba622991344f846db4aa420b1474927fd2f4ad4d5a57de7a
3
+ metadata.gz: f2cb314ed84525cc6dafce8c9c1ddeec7b51486c8e759b1ab32b176791730e4f
4
+ data.tar.gz: 3d72bc268faeb84f61bec331bc5fda61e2d298e539ed184ce273d614d18303eb
5
5
  SHA512:
6
- metadata.gz: fcb7b79415897ad6e756d102295ddc78b59c2015e3410c6a31fb681c7b92066bf82bc9cf758e7a9d3e57b8dc2623e3402d9380c6f4434661b50476a345a21fe2
7
- data.tar.gz: 14ff4eaad35e66d4c7cc55f06c753b4a9e008457956f124603a722308d81520c97ee34cbefdbf27bdd45050f6c41d13d4ac01eb0fbe9c18d93cf9a8517032046
6
+ metadata.gz: 12fc83283e2bd199994e47457e09ad18f097cc61c80d10ec67b55e72971e198f76616fad859539ad2be547683a77b3a7abcbd725bb69cdc005566c679cb80324
7
+ data.tar.gz: 4e3ae7e9b86a6ae8341384081ca05b87aa71e0c0de4d4af9277c554a05d6ac5765064e840fa274ae428c9e016ada8d1e3e180f3f048f363c0d5eb2d06cbc17cb
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.0.8"
3
+ VERSION = "1.0.9"
4
4
  end
5
5
  end
@@ -276,7 +276,7 @@ class Scaffolding::Transformer
276
276
  begin
277
277
  target_file_content = File.read(transformed_file_name)
278
278
  rescue Errno::ENOENT => _
279
- puts "Couldn't find '#{transformed_file_name}'".red unless suppress_could_not_find
279
+ puts "Couldn't find '#{transformed_file_name}'".red unless (suppress_could_not_find || options[:suppress_could_not_find])
280
280
  return false
281
281
  end
282
282
 
@@ -756,7 +756,6 @@ class Scaffolding::Transformer
756
756
  end
757
757
 
758
758
  # field on the form.
759
- file_name = "./app/views/account/scaffolding/completely_concrete/tangible_things/_form.html.erb"
760
759
  field_attributes = {method: ":#{name}"}
761
760
  field_options = {}
762
761
 
@@ -800,7 +799,12 @@ class Scaffolding::Transformer
800
799
  end
801
800
 
802
801
  field_content = "<%= render 'shared/fields/#{type}'#{", " if field_attributes.any?}#{field_attributes.map { |key, value| "#{key}: #{value}" }.join(", ")} %>"
803
- scaffold_add_line_to_file(file_name, field_content, ERB_NEW_FIELDS_HOOK, prepend: true)
802
+
803
+ # TODO Add more of these from other packages?
804
+ is_core_model = ["Team", "User", "Membership"].include?(child)
805
+
806
+ scaffold_add_line_to_file("./app/views/account/scaffolding/completely_concrete/tangible_things/_form.html.erb", field_content, ERB_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find: is_core_model)
807
+ scaffold_add_line_to_file("./app/views/account/scaffolding/completely_concrete/tangible_things/_fields.html.erb", field_content, ERB_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find: !is_core_model)
804
808
  end
805
809
 
806
810
  #
@@ -1001,12 +1005,8 @@ class Scaffolding::Transformer
1001
1005
 
1002
1006
  # TODO The serializers can't handle these `has_rich_text` attributes.
1003
1007
  unless type == "trix_editor"
1004
- [
1005
- "./app/views/account/scaffolding/completely_concrete/tangible_things/_tangible_thing.json.jbuilder",
1006
- "./app/serializers/api/v1/scaffolding/completely_concrete/tangible_thing_serializer.rb"
1007
- ].each do |file|
1008
- scaffold_add_line_to_file(file, ":#{name},", RUBY_NEW_FIELDS_HOOK, prepend: true)
1009
- end
1008
+ scaffold_add_line_to_file("./app/views/account/scaffolding/completely_concrete/tangible_things/_tangible_thing.json.jbuilder", ":#{name},", RUBY_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find: true)
1009
+ scaffold_add_line_to_file("./app/serializers/api/v1/scaffolding/completely_concrete/tangible_thing_serializer.rb", ":#{name},", RUBY_NEW_FIELDS_HOOK, prepend: true)
1010
1010
 
1011
1011
  assertion = if type == "date_field"
1012
1012
  "assert_equal Date.parse(tangible_thing_data['#{name}']), tangible_thing.#{name}"
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.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-11 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails