bullet_train-super_scaffolding 1.0.42 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 695ce6d408d1cb821d6fd5672b9877f5387ee1dbd4baaeac04c6f51933fd3ad4
|
4
|
+
data.tar.gz: 22fc5ed6ec8df0617560da233a492835354faf636ac010f007116728bd3a36ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4c8d5afb02e06b48107ef53bd95bdf42632587f45a886c89ed3f3ad938f6db80294e4025a896dac89c7e5ece79aa527ea67514fe8b3bbff3446f6e1acb99c1e
|
7
|
+
data.tar.gz: e7a5bfdbda2bccab756affe5b27f82eb94c5d419127be93e6bca0e8dc3f94f9556e6ae8c1bcebf0801e462d4b57c214a7c0d1527b6d9df90f07aa90ec49643ff
|
@@ -15,6 +15,11 @@ module Scaffolding::FileManipulator
|
|
15
15
|
lines[(within + 1)..(Scaffolding::BlockManipulator.find_block_end(starting_from: within, lines: lines) + 1)]
|
16
16
|
end
|
17
17
|
|
18
|
+
# TODO I was running into an error in a downstream application where it couldn't find silence_logs? We should implement it in this package.
|
19
|
+
def self.silence_logs?
|
20
|
+
ENV["SILENCE_LOGS"].present?
|
21
|
+
end
|
22
|
+
|
18
23
|
def self.replace_line_in_file(file, content, in_place_of, options = {})
|
19
24
|
begin
|
20
25
|
target_file_content = File.read(file)
|
@@ -66,7 +71,7 @@ module Scaffolding::FileManipulator
|
|
66
71
|
end
|
67
72
|
|
68
73
|
def self.write(file_name, lines, strip: true)
|
69
|
-
puts "Updating '#{file_name}'." unless
|
74
|
+
puts "Updating '#{file_name}'." unless silence_logs?
|
70
75
|
if strip
|
71
76
|
File.open(file_name, "w+") do |file|
|
72
77
|
file.puts(lines.join.strip + "\n")
|
@@ -10,6 +10,11 @@ def legacy_resolve_template_path(file)
|
|
10
10
|
end.compact.first || raise("Couldn't find the Super Scaffolding template for `#{file}` in any of the following locations:\n\n#{BulletTrain::SuperScaffolding.template_paths.join("\n")}")
|
11
11
|
end
|
12
12
|
|
13
|
+
# TODO I was running into an error in a downstream application where it couldn't find silence_logs? We should implement it in this package.
|
14
|
+
def silence_logs?
|
15
|
+
ENV["SILENCE_LOGS"].present?
|
16
|
+
end
|
17
|
+
|
13
18
|
def legacy_replace_in_file(file, before, after)
|
14
19
|
puts "Replacing in '#{file}'." unless silence_logs?
|
15
20
|
target_file_content = File.read(file)
|
@@ -231,10 +231,18 @@ class Scaffolding::Transformer
|
|
231
231
|
transformed_file_content.join
|
232
232
|
end
|
233
233
|
|
234
|
-
|
234
|
+
# TODO I was running into an error in a downstream application where it couldn't find silence_logs? We should implement it in this package.
|
235
|
+
def silence_logs?
|
236
|
+
ENV["SILENCE_LOGS"].present?
|
237
|
+
end
|
238
|
+
|
239
|
+
def scaffold_file(file, overrides: false)
|
235
240
|
transformed_file_content = get_transformed_file_content(file)
|
236
241
|
transformed_file_name = transform_string(file)
|
237
242
|
|
243
|
+
# Remove `_overrides` from the file name if we're sourcing from a local override folder.
|
244
|
+
transformed_file_name.gsub!("_overrides", "") if overrides
|
245
|
+
|
238
246
|
transformed_directory_name = File.dirname(transformed_file_name)
|
239
247
|
unless File.directory?(transformed_directory_name)
|
240
248
|
FileUtils.mkdir_p(transformed_directory_name)
|
@@ -266,6 +274,22 @@ class Scaffolding::Transformer
|
|
266
274
|
scaffold_file(file)
|
267
275
|
end
|
268
276
|
end
|
277
|
+
|
278
|
+
# Allow local developers to override just certain files of a directory.
|
279
|
+
override_path = begin
|
280
|
+
resolve_template_path(directory + "_overrides")
|
281
|
+
rescue RuntimeError
|
282
|
+
nil
|
283
|
+
end
|
284
|
+
|
285
|
+
if override_path
|
286
|
+
Dir.foreach(override_path) do |file|
|
287
|
+
file = "#{directory}_overrides/#{file}"
|
288
|
+
unless File.directory?(resolve_template_path(file))
|
289
|
+
scaffold_file(file, overrides: true)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
269
293
|
end
|
270
294
|
|
271
295
|
def add_line_to_file(file, content, hook, 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.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -178,7 +178,7 @@ licenses:
|
|
178
178
|
metadata:
|
179
179
|
homepage_uri: https://github.com/bullet-train-co/bullet_train-super_scaffolding
|
180
180
|
source_code_uri: https://github.com/bullet-train-co/bullet_train-super_scaffolding
|
181
|
-
post_install_message:
|
181
|
+
post_install_message:
|
182
182
|
rdoc_options: []
|
183
183
|
require_paths:
|
184
184
|
- lib
|
@@ -193,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
-
signing_key:
|
196
|
+
rubygems_version: 3.1.6
|
197
|
+
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Bullet Train Super Scaffolding
|
200
200
|
test_files: []
|