bullet_train-super_scaffolding 1.6.0 → 1.6.2
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/version.rb +1 -1
- data/lib/scaffolding/script.rb +31 -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: 839704c2b3b349456b76b953e04d84a4c328261b3608b48fb8b80910103a632b
|
4
|
+
data.tar.gz: 16b194cc27b81d0fddd58c264b06eadc63631d1297e4267f4f35434a8b661983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d38f9a63b1d5ca5cd2c058fb4e6c101692c54bcd493f40cc5cac6cdee747cf13b08252368c3e4673e275015eb58687f3239204b2e7686c41398d59372c4f64c
|
7
|
+
data.tar.gz: bbf19eae23f789dbdd75a905fa3a9e8b0bde3b1f0fe1f6a25716ed62a4b0b99a3a251a97c943e435877d17de04aaa093227a95254aa6d2ed47d4fc6e19b9b911
|
data/lib/scaffolding/script.rb
CHANGED
@@ -50,6 +50,19 @@ def standard_protip
|
|
50
50
|
puts "If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f` ."
|
51
51
|
end
|
52
52
|
|
53
|
+
def git_status
|
54
|
+
`git status`.split("\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
def has_untracked_files?(status_lines)
|
58
|
+
status_lines.include?("Untracked files:")
|
59
|
+
end
|
60
|
+
|
61
|
+
# All untracked files begin with a tab (i.e. - "\tapp/models/model.rb").
|
62
|
+
def get_untracked_files(status_lines)
|
63
|
+
`git ls-files --other --exclude-standard`.split("\n")
|
64
|
+
end
|
65
|
+
|
53
66
|
def check_required_options_for_attributes(scaffolding_type, attributes, child, parent = nil)
|
54
67
|
tableized_parent = nil
|
55
68
|
|
@@ -183,7 +196,24 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
|
|
183
196
|
puts "Adding new fields to #{child} with '#{generation_command}'".green
|
184
197
|
end
|
185
198
|
puts ""
|
186
|
-
|
199
|
+
|
200
|
+
unless @options["skip-migration-generation"]
|
201
|
+
untracked_files = has_untracked_files?(git_status) ? get_untracked_files(git_status) : []
|
202
|
+
generation_thread = Thread.new { `#{generation_command}` }
|
203
|
+
generation_thread.join # Wait for the process to finish.
|
204
|
+
|
205
|
+
newly_untracked_files = has_untracked_files?(git_status) ? get_untracked_files(git_status) : []
|
206
|
+
if (newly_untracked_files - untracked_files).size.zero?
|
207
|
+
error_message = <<~MESSAGE
|
208
|
+
Since you have already created the #{child} model, Super Scaffolding won't allow you to re-create it.
|
209
|
+
You can either delete the model and try Super Scaffolding again, or add the `--skip-migration-generation`
|
210
|
+
flag to Super Scaffold the classic Bullet Train way.
|
211
|
+
MESSAGE
|
212
|
+
puts ""
|
213
|
+
puts error_message.red
|
214
|
+
exit 1
|
215
|
+
end
|
216
|
+
end
|
187
217
|
end
|
188
218
|
end
|
189
219
|
|
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.2
|
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-10-
|
11
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|