bullet_train-super_scaffolding 1.0.17 → 1.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/show.html.erb +1 -1
- data/lib/bullet_train/super_scaffolding/exceptions.rb +1 -1
- data/lib/bullet_train/super_scaffolding/scaffolders/join_model_scaffolder.rb +8 -8
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- data/lib/scaffolding/routes_file_manipulator.rb +2 -2
- data/lib/scaffolding/script.rb +1 -1
- data/lib/scaffolding/transformer.rb +2 -2
- 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: 103b708503217ca9505cd05de197bb58f0a88900a96d5067903515673e120208
|
4
|
+
data.tar.gz: c2a6a0affea9aebf96164b74393a46a4ee4768853375c87f9adc3f8d22fafc9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bce5552db7c64dcf5339c14cd16aef67fc9ae7a474f43b97d5ab577c9e110fd678e3d315ea2f5e0c821141ad0c299bb42daa2d46d428df9587a24ffe7aa7b80
|
7
|
+
data.tar.gz: 38763907014cf239bd4404a2f0a47156c0c8f170cb2a3c62dd0843780a4a2daa91ee16018394f6ccb33f24742cfc7b2c39f13dae933001eac1382170eccb0ed4
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<% p.content_for :body do %>
|
9
9
|
<% with_attribute_settings object: @creative_concept, strategy: :label do %>
|
10
10
|
<%= render 'shared/attributes/text', attribute: :name %>
|
11
|
-
<%= render 'shared/attributes/
|
11
|
+
<%= render 'shared/attributes/text', attribute: :description %>
|
12
12
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
13
13
|
|
14
14
|
<div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-3">
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class BulletTrain::SuperScaffolding::CannotFindParentResourceException <
|
1
|
+
class BulletTrain::SuperScaffolding::CannotFindParentResourceException < RuntimeError
|
2
2
|
end
|
@@ -25,11 +25,11 @@ module BulletTrain
|
|
25
25
|
puts ""
|
26
26
|
puts " 2️⃣ Use `join-model` scaffolding to prepare the join model for use in `crud-field` scaffolding:".blue
|
27
27
|
puts ""
|
28
|
-
puts " bin/super-scaffold join-model Projects::AppliedTag project_id
|
28
|
+
puts " bin/super-scaffold join-model Projects::AppliedTag project_id{class_name=Project} tag_id{class_name=Projects::Tag}"
|
29
29
|
puts ""
|
30
30
|
puts " 3️⃣ Now you can use `crud-field` scaffolding to actually add the field to the form of the parent model:".blue
|
31
31
|
puts ""
|
32
|
-
puts " bin/super-scaffold crud-field Project tag_ids:super_select
|
32
|
+
puts " bin/super-scaffold crud-field Project tag_ids:super_select{class_name=Projects::Tag}"
|
33
33
|
puts ""
|
34
34
|
puts " 👋 Heads up! There will be one follow-up step output by this command that you need to take action on."
|
35
35
|
puts ""
|
@@ -38,15 +38,15 @@ module BulletTrain
|
|
38
38
|
end
|
39
39
|
|
40
40
|
child = argv[0]
|
41
|
-
primary_parent = argv[1].split("class_name=").last.split(",").first.split("
|
42
|
-
secondary_parent = argv[2].split("class_name=").last.split(",").first.split("
|
41
|
+
primary_parent = argv[1].split("class_name=").last.split(",").first.split("}").first
|
42
|
+
secondary_parent = argv[2].split("class_name=").last.split(",").first.split("}").first
|
43
43
|
|
44
44
|
# There should only be two attributes.
|
45
45
|
attributes = [argv[1], argv[2]]
|
46
46
|
|
47
47
|
# Pretend we're doing a `super_select` scaffolding because it will do the correct thing.
|
48
|
-
attributes = attributes.map { |attribute| attribute.gsub("
|
49
|
-
attributes = attributes.map { |attribute| attribute.gsub("
|
48
|
+
attributes = attributes.map { |attribute| attribute.gsub("{", ":super_select{") }
|
49
|
+
attributes = attributes.map { |attribute| attribute.gsub("}", ",required}") }
|
50
50
|
|
51
51
|
transformer = Scaffolding::Transformer.new(child, [primary_parent], @options)
|
52
52
|
|
@@ -60,14 +60,14 @@ module BulletTrain
|
|
60
60
|
inverse_has_many_through_transformer = Scaffolding::Transformer.new(primary_parent, [secondary_parent], @options)
|
61
61
|
|
62
62
|
# However, for the first attribute, we actually don't need the scope validator (and can't really implement it).
|
63
|
-
attributes[0] = attributes[0].gsub("
|
63
|
+
attributes[0] = attributes[0].gsub("}", ",unscoped}")
|
64
64
|
|
65
65
|
has_many_through_association = has_many_through_transformer.transform_string("completely_concrete_tangible_things")
|
66
66
|
source = transformer.transform_string("absolutely_abstract_creative_concept.valid_$HAS_MANY_THROUGH_ASSOCIATION")
|
67
67
|
source.gsub!("$HAS_MANY_THROUGH_ASSOCIATION", has_many_through_association)
|
68
68
|
|
69
69
|
# For the second one, we don't want users to have to define the list of valid options in the join model, so we do this:
|
70
|
-
attributes[1] = attributes[1].gsub("
|
70
|
+
attributes[1] = attributes[1].gsub("}", ",source=#{source}}")
|
71
71
|
|
72
72
|
# This model hasn't been crud scaffolded, so a bunch of views are skipped here, but that's OK!
|
73
73
|
# It does what we need on the files that exist.
|
@@ -194,13 +194,13 @@ class Scaffolding::RoutesFileManipulator
|
|
194
194
|
parts = parts.dup
|
195
195
|
resource = parts.pop
|
196
196
|
# TODO this doesn't take into account any options like we do in `find_resource`.
|
197
|
-
find_in_namespace(/resources :#{resource}#{options[:options] ? ", #{options[:options].gsub(/(
|
197
|
+
find_in_namespace(/resources :#{resource}#{options[:options] ? ", #{options[:options].gsub(/({)(.*)(})/, '{\2}')}" : ""}(,?\s.*)? do(\s.*)?$/, parts, within)
|
198
198
|
end
|
199
199
|
|
200
200
|
def find_resource(parts, options = {})
|
201
201
|
parts = parts.dup
|
202
202
|
resource = parts.pop
|
203
|
-
needle = /resources :#{resource}#{options[:options] ? ", #{options[:options].gsub(/(
|
203
|
+
needle = /resources :#{resource}#{options[:options] ? ", #{options[:options].gsub(/({)(.*)(})/, '{\2}')}" : ""}(,?\s.*)?$/
|
204
204
|
find_in_namespace(needle, parts, options[:within], options[:ignore])
|
205
205
|
end
|
206
206
|
|
data/lib/scaffolding/script.rb
CHANGED
@@ -36,7 +36,7 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
|
|
36
36
|
type = parts.join(":")
|
37
37
|
|
38
38
|
# extract any options they passed in with the field.
|
39
|
-
type, attribute_options = type.scan(/^(.*)
|
39
|
+
type, attribute_options = type.scan(/^(.*){(.*)}/).first || type
|
40
40
|
|
41
41
|
# create a hash of the options.
|
42
42
|
attribute_options = if attribute_options
|
@@ -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
|
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
|
|
@@ -591,7 +591,7 @@ class Scaffolding::Transformer
|
|
591
591
|
|
592
592
|
# extract any options they passed in with the field.
|
593
593
|
# will extract options declared with either [] or {}.
|
594
|
-
type, attribute_options = type.scan(/^(.*)
|
594
|
+
type, attribute_options = type.scan(/^(.*){(.*)}/).first || type
|
595
595
|
|
596
596
|
# create a hash of the options.
|
597
597
|
attribute_options = if attribute_options
|
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.
|
4
|
+
version: 1.0.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: 2022-03-
|
11
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|