bullet_train-super_scaffolding 1.0.1 → 1.0.2
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: fad70b09de2e66feebad90398591dc8022a19eb29d431cf6cc4bf9211c9ff2b7
|
4
|
+
data.tar.gz: 274eb7661ee67564d1856674af6a7e554fc1bae87795a5614fb6bca537ab4669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa68a6e711a10f484b7a59b1fec2928679022ac34b6d91963dee1121ad0f0a906c55bc8715f523a390cc81589ed2bf21090e3caa5cda60ab5dac44fdb85f7641
|
7
|
+
data.tar.gz: 9009df2aad5105f58baa3825883019e6c2d1cb62872811ca8ffcfda8c7e902165b7278ba0aad384c183151241eeed94fc10e7084a24dca664b9ee5b84fa835f1
|
@@ -3,6 +3,15 @@ require "bullet_train/super_scaffolding/engine"
|
|
3
3
|
|
4
4
|
module BulletTrain
|
5
5
|
module SuperScaffolding
|
6
|
-
|
6
|
+
mattr_accessor :template_paths, default: []
|
7
|
+
|
8
|
+
class Runner
|
9
|
+
def run
|
10
|
+
# Make `rake` invocation compatible with how this was run historically.
|
11
|
+
ARGV.shift
|
12
|
+
|
13
|
+
require "scaffolding/script"
|
14
|
+
end
|
15
|
+
end
|
7
16
|
end
|
8
17
|
end
|
data/lib/scaffolding/script.rb
CHANGED
@@ -1,18 +1,10 @@
|
|
1
|
-
require "active_support/inflector"
|
2
|
-
require "fileutils"
|
3
|
-
require "pry"
|
4
|
-
require "colorize"
|
5
|
-
require "scaffolding"
|
6
|
-
require "#{APP_ROOT}/config/initializers/inflections"
|
7
|
-
|
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 ||= []
|
12
|
-
|
13
1
|
# TODO these methods were removed from the global scope in super scaffolding and moved to `Scaffolding::Transformer`,
|
14
2
|
# but oauth provider scaffolding hasn't been updated yet.
|
15
3
|
|
4
|
+
require "scaffolding/transformer"
|
5
|
+
require "scaffolding/class_names_transformer"
|
6
|
+
require "scaffolding/routes_file_manipulator"
|
7
|
+
|
16
8
|
def legacy_replace_in_file(file, before, after)
|
17
9
|
puts "Replacing in '#{file}'."
|
18
10
|
target_file_content = File.read(file)
|
@@ -111,7 +111,8 @@ class Scaffolding::Transformer
|
|
111
111
|
# Originally all the potential source files were in the repository alongside the application.
|
112
112
|
# Now the files could be provided by an included Ruby gem, so we allow those Ruby gems to register their base
|
113
113
|
# path and then we check them in order to see which template we should use.
|
114
|
-
|
114
|
+
BulletTrain::SuperScaffolding.template_paths.reverse.map do |base_path|
|
115
|
+
base_path = Pathname.new(base_path)
|
115
116
|
resolved_path = base_path.join(file).to_s
|
116
117
|
File.exists?(resolved_path) ? resolved_path : file
|
117
118
|
end.compact.first
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
namespace :bullet_train do
|
2
|
+
desc "Next-level code generation"
|
3
|
+
task :super_scaffolding => :environment do
|
4
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
5
|
+
end
|
6
|
+
end
|