bullet_train-super_scaffolding 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70a403bf2e245f8843548f1f20f0cccaa3195b4d2f26aa9e3977a7b134bbfbdc
4
- data.tar.gz: f0afe6854f9f764a8c100f3022ec013d11fd51a3011c8b1ebe4831049fa5b710
3
+ metadata.gz: fad70b09de2e66feebad90398591dc8022a19eb29d431cf6cc4bf9211c9ff2b7
4
+ data.tar.gz: 274eb7661ee67564d1856674af6a7e554fc1bae87795a5614fb6bca537ab4669
5
5
  SHA512:
6
- metadata.gz: b935a5defa4a2417f61f4772f9e7539dd724196a6cafcce299a035c827d7675e45523b551b80479d6041191adce72a15c1ba999977d56695bb77de4b602e8225
7
- data.tar.gz: a045389719135c5d40416b2afcf59240b5db456c7b415e7adfcf6bd8f0aaeb3b893269bbcd741d279e16289d853a806c7a23735cd0146a00b5bb8602eff6d48c
6
+ metadata.gz: aa68a6e711a10f484b7a59b1fec2928679022ac34b6d91963dee1121ad0f0a906c55bc8715f523a390cc81589ed2bf21090e3caa5cda60ab5dac44fdb85f7641
7
+ data.tar.gz: 9009df2aad5105f58baa3825883019e6c2d1cb62872811ca8ffcfda8c7e902165b7278ba0aad384c183151241eeed94fc10e7084a24dca664b9ee5b84fa835f1
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -3,6 +3,15 @@ require "bullet_train/super_scaffolding/engine"
3
3
 
4
4
  module BulletTrain
5
5
  module SuperScaffolding
6
- # Your code goes here...
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
@@ -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
- $super_scaffolding_template_paths.reverse.map do |base_path|
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
- # desc "Explaining what the task does"
2
- # task :bullet_train_super_scaffolding do
3
- # # Task goes here
4
- # end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_scaffolding
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver