bullet_train-super_scaffolding 1.0.0 → 1.0.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 +6 -1
- data/lib/scaffolding/transformer.rb +15 -4
- data/lib/scaffolding.rb +0 -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: 70a403bf2e245f8843548f1f20f0cccaa3195b4d2f26aa9e3977a7b134bbfbdc
|
4
|
+
data.tar.gz: f0afe6854f9f764a8c100f3022ec013d11fd51a3011c8b1ebe4831049fa5b710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b935a5defa4a2417f61f4772f9e7539dd724196a6cafcce299a035c827d7675e45523b551b80479d6041191adce72a15c1ba999977d56695bb77de4b602e8225
|
7
|
+
data.tar.gz: a045389719135c5d40416b2afcf59240b5db456c7b415e7adfcf6bd8f0aaeb3b893269bbcd741d279e16289d853a806c7a23735cd0146a00b5bb8602eff6d48c
|
data/lib/scaffolding/script.rb
CHANGED
@@ -2,8 +2,13 @@ require "active_support/inflector"
|
|
2
2
|
require "fileutils"
|
3
3
|
require "pry"
|
4
4
|
require "colorize"
|
5
|
+
require "scaffolding"
|
6
|
+
require "#{APP_ROOT}/config/initializers/inflections"
|
5
7
|
|
6
|
-
|
8
|
+
# TODO This is a hack to allow Super Scaffolding modules to register their path. We'll do this differently once we've
|
9
|
+
# properly migrated all the code into the Rails engine structure and Rails is being initialized as part of
|
10
|
+
# `bin/super-scaffold`.
|
11
|
+
$super_scaffolding_template_paths ||= []
|
7
12
|
|
8
13
|
# TODO these methods were removed from the global scope in super scaffolding and moved to `Scaffolding::Transformer`,
|
9
14
|
# but oauth provider scaffolding hasn't been updated yet.
|
@@ -106,6 +106,17 @@ class Scaffolding::Transformer
|
|
106
106
|
decode_double_replacement_fix(string)
|
107
107
|
end
|
108
108
|
|
109
|
+
def resolve_template_path(file)
|
110
|
+
# Figure out the actual location of the file.
|
111
|
+
# Originally all the potential source files were in the repository alongside the application.
|
112
|
+
# Now the files could be provided by an included Ruby gem, so we allow those Ruby gems to register their base
|
113
|
+
# path and then we check them in order to see which template we should use.
|
114
|
+
$super_scaffolding_template_paths.reverse.map do |base_path|
|
115
|
+
resolved_path = base_path.join(file).to_s
|
116
|
+
File.exists?(resolved_path) ? resolved_path : file
|
117
|
+
end.compact.first
|
118
|
+
end
|
119
|
+
|
109
120
|
def get_transformed_file_content(file)
|
110
121
|
transformed_file_content = []
|
111
122
|
|
@@ -115,7 +126,7 @@ class Scaffolding::Transformer
|
|
115
126
|
parents_to_repeat_for = []
|
116
127
|
gathered_lines_for_repeating = nil
|
117
128
|
|
118
|
-
File.open(file).each_line do |line|
|
129
|
+
File.open(resolve_template_path(file)).each_line do |line|
|
119
130
|
if line.include?("# 🚅 skip when scaffolding.")
|
120
131
|
next
|
121
132
|
end
|
@@ -213,9 +224,9 @@ class Scaffolding::Transformer
|
|
213
224
|
puts "Proceeding to generate '#{transformed_directory_name}'."
|
214
225
|
end
|
215
226
|
|
216
|
-
Dir.foreach(directory) do |file|
|
227
|
+
Dir.foreach(resolve_template_path(directory)) do |file|
|
217
228
|
file = "#{directory}/#{file}"
|
218
|
-
unless File.directory?(file)
|
229
|
+
unless File.directory?(resolve_template_path(file))
|
219
230
|
scaffold_file(file)
|
220
231
|
end
|
221
232
|
end
|
@@ -1175,7 +1186,7 @@ class Scaffolding::Transformer
|
|
1175
1186
|
end
|
1176
1187
|
|
1177
1188
|
files.each do |name|
|
1178
|
-
if File.directory?(name)
|
1189
|
+
if File.directory?(resolve_template_path(name))
|
1179
1190
|
scaffold_directory(name)
|
1180
1191
|
else
|
1181
1192
|
scaffold_file(name)
|
data/lib/scaffolding.rb
CHANGED
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.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: 2022-01
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|