lib/dry/web/roda/generators/umbrella_project.rb in dry-web-roda-0.6.3 vs lib/dry/web/roda/generators/umbrella_project.rb in dry-web-roda-0.7.0
- old
+ new
@@ -1,36 +1,27 @@
require "securerandom"
-require "dry/web/roda/generate"
-require "dry/web/roda/generators/inflections"
+require "dry/web/roda/generators/abstract_project"
require "dry/web/roda/generators/sub_app"
module Dry
module Web
module Roda
module Generators
- class UmbrellaProject
- attr_reader :generate, :sub_app_generator
+ class UmbrellaProject < AbstractProject
+ private
- def initialize
- @generate = Generate.new("umbrella_project")
- @sub_app_generator = Generators::SubApp.new
+ def add_boot
+ add_template("umbrella_project/boot.rb.tt", "system/boot.rb")
end
- def call(target_dir)
- generate.(target_dir, prepare_scope(target_dir))
+ def add_application
+ add_template("umbrella_project/application.rb.tt", "system/#{underscored_project_name}/application.rb")
+ end
+ def post_process_callback
Dir.chdir(target_dir) do
- sub_app_generator.("main", umbrella: target_dir)
+ Generators::SubApp.new("main", umbrella: target_dir).call
end
- end
-
- private
-
- def prepare_scope(target_dir)
- {
- underscored_app_name: Inflections.underscored_name(target_dir),
- camel_cased_app_name: Inflections.camel_cased_name(target_dir)
- }
end
end
end
end
end