bullet_train-super_scaffolding 1.6.6 → 1.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bullet_train/super_scaffolding/scaffolders/crud_field_scaffolder.rb +0 -1
- data/lib/bullet_train/super_scaffolding/scaffolders/crud_scaffolder.rb +8 -4
- data/lib/bullet_train/super_scaffolding/scaffolders/join_model_scaffolder.rb +3 -11
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- 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: 83562ede1a8ba63e0c7ce22d2ad4b847966bad0c1cd9b768aa7eec899587181d
|
4
|
+
data.tar.gz: 403160c7f8f5fe3250c8c2874272d9db05c95a52a38c516a206746f4180df8be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c6c3a03a78758c8347c1a3a1c841382ab55b486453bf7008358c6c42d6afff6159cf5f150f9cfba1684c91ade3b2c32f3ea26f766832badd2684fc3e875445d
|
7
|
+
data.tar.gz: d019a81d9810e3586ba355e011dd1fbf19779963ca049b4df88a65ccb274387c488e7e74e4593f31fc20335e46359b86019f7b418336bfb71e1e0d83fe30b317
|
@@ -8,7 +8,6 @@ module BulletTrain
|
|
8
8
|
puts "🚅 usage: bin/super-scaffold crud-field <Model> <attribute:type> <attribute:type> ... [options]"
|
9
9
|
puts ""
|
10
10
|
puts "E.g. add a description and body to Pages:"
|
11
|
-
puts " rails g migration add_description_etc_to_pages description:text body:text"
|
12
11
|
puts " bin/super-scaffold crud-field Page description:text_area body:text_area"
|
13
12
|
puts ""
|
14
13
|
puts "Options:"
|
@@ -8,18 +8,15 @@ module BulletTrain
|
|
8
8
|
puts "🚅 usage: bin/super-scaffold crud <Model> <ParentModel[s]> <attribute:type> <attribute:type> ..."
|
9
9
|
puts ""
|
10
10
|
puts "E.g. a Team has many Sites with some attributes:"
|
11
|
-
puts " rails g model Site team:references name:string url:text"
|
12
11
|
puts " bin/super-scaffold crud Site Team name:text_field url:text_area"
|
13
12
|
puts ""
|
14
13
|
puts "E.g. a Section belongs to a Page, which belongs to a Site, which belongs to a Team:"
|
15
|
-
puts " rails g model Section page:references title:string body:text"
|
16
14
|
puts " bin/super-scaffold crud Section Page,Site,Team title:text_field body:text_area"
|
17
15
|
puts ""
|
18
16
|
puts "E.g. an Image belongs to either a Page or a Site:"
|
19
17
|
puts " Doable! See https://bit.ly/2NvO8El for a step by step guide."
|
20
18
|
puts ""
|
21
19
|
puts "E.g. Pages belong to a Site and are sortable via drag-and-drop:"
|
22
|
-
puts " rails g model Page site:references name:string path:text"
|
23
20
|
puts " bin/super-scaffold crud Page Site,Team name:text_field path:text_area --sortable"
|
24
21
|
puts ""
|
25
22
|
puts "🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes."
|
@@ -32,6 +29,14 @@ module BulletTrain
|
|
32
29
|
|
33
30
|
child = argv[0]
|
34
31
|
parents = argv[1] ? argv[1].split(",") : []
|
32
|
+
|
33
|
+
# Raise an error if the developer skipped adding the parent and went straight to the attributes.
|
34
|
+
if FIELD_PARTIALS.keys.map(&:to_s).include?(parents.first.split(":").last)
|
35
|
+
puts "It looks like you forgot to add the model's parent to your scaffolding command.".red
|
36
|
+
puts "Add the parent name after the model and try again.".red
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
|
35
40
|
parents = parents.map(&:classify).uniq
|
36
41
|
parent = parents.first
|
37
42
|
child_parts = child.split("::")
|
@@ -83,7 +88,6 @@ module BulletTrain
|
|
83
88
|
unless parents.include?("Team")
|
84
89
|
raise "Parents for #{child} should trace back to the Team model, but Team wasn't provided. Please confirm that all of the parents tracing back to the Team model are present and try again.\n" \
|
85
90
|
"E.g.:\n" \
|
86
|
-
"rails g model Section page:references title:text body:text\n" \
|
87
91
|
"bin/super-scaffold crud Section Page,Site,Team title:text body:text\n"
|
88
92
|
end
|
89
93
|
|
@@ -11,29 +11,21 @@ module BulletTrain
|
|
11
11
|
puts ""
|
12
12
|
puts " Given the following example models:".blue
|
13
13
|
puts ""
|
14
|
-
puts " rails g model Project team:references name:string description:text"
|
15
14
|
puts " bin/super-scaffold crud Project Team name:text_field description:trix_editor"
|
16
15
|
puts ""
|
17
|
-
puts " rails g model Projects::Tag team:references name:string"
|
18
16
|
puts " bin/super-scaffold crud Projects::Tag Team name:text_field"
|
19
17
|
puts ""
|
20
|
-
puts " 1️⃣
|
21
|
-
puts ""
|
22
|
-
puts " rails g model Projects::AppliedTag project:references tag:references"
|
23
|
-
puts ""
|
24
|
-
puts " 👋 Don't run migrations yet! Sometimes Super Scaffolding updates them for you.".yellow
|
25
|
-
puts ""
|
26
|
-
puts " 2️⃣ Use `join-model` scaffolding to prepare the join model for use in `crud-field` scaffolding:".blue
|
18
|
+
puts " 1️⃣ Use `join-model` scaffolding to generate the join model for use in `crud-field` scaffolding:".blue
|
27
19
|
puts ""
|
28
20
|
puts " bin/super-scaffold join-model Projects::AppliedTag project_id{class_name=Project} tag_id{class_name=Projects::Tag}"
|
29
21
|
puts ""
|
30
|
-
puts "
|
22
|
+
puts " 2️⃣ Now you can use `crud-field` scaffolding to actually add the field to the form of the parent model:".blue
|
31
23
|
puts ""
|
32
24
|
puts " bin/super-scaffold crud-field Project tag_ids:super_select{class_name=Projects::Tag}"
|
33
25
|
puts ""
|
34
26
|
puts " 👋 Heads up! There will be one follow-up step output by this command that you need to take action on."
|
35
27
|
puts ""
|
36
|
-
puts "
|
28
|
+
puts " 3️⃣ Now you can run your migrations.".blue
|
37
29
|
exit
|
38
30
|
end
|
39
31
|
|
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.6.
|
4
|
+
version: 1.6.8
|
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-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|