bullet_train-super_scaffolding 1.6.0 → 1.6.1
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: 9b7efadfb9aedfb0c4f903bd3a3d3cfb4434049c028f36ceba9e431bb9b7fe49
|
4
|
+
data.tar.gz: 1ed8a32334f0f72d859abfdea2ab689a5e7222f452344254a5bc46ebda8069c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f68150179ed016be2eb00f51500eaaedae7b5f84dd851118422c4fe78024e4506f83ce47aa35d9526b7a6cb2f1a1e3d3692c694d124551436bd9498a1dd531c
|
7
|
+
data.tar.gz: 6934fcc20f30bf18d9a29c3d5b878a83612b01697af0226defa7c94bf7543c5423534f6397bd6bef472d2f63578d5558059df9ebb73ca8f7894aae0063bddc7b
|
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.1
|
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
|