Class: EWorld::ControllerWriter
- Inherits:
-
BaseWriter
- Object
- BaseWriter
- EWorld::ControllerWriter
- Defined in:
- lib/writers/controller_writer.rb
Constant Summary collapse
- PACKAGE_NAME =
'controllers'
- ROOT_PATH =
'{{--ROOT-PATH--}}'
- METHODS =
'{{--METHODS--}}'
Constants inherited from BaseWriter
BaseWriter::CLASS, BaseWriter::CLASS_LOWER, BaseWriter::IMPORTS, BaseWriter::PACKAGE
Class Method Summary collapse
-
.write(api_project, ui_project, controllers) ⇒ Object
Responsible for writing all the spring boot @RestController classes.
Methods inherited from BaseWriter
Class Method Details
.write(api_project, ui_project, controllers) ⇒ Object
Responsible for writing all the spring boot @RestController classes.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/writers/controller_writer.rb', line 12 def self.write(api_project, ui_project, controllers) raise RuntimeError, "Expected project type to be: #{Blufin::Projects::TYPE_API_SIMPLE}, instead got: #{api_project[Blufin::Projects::TYPE]}" unless api_project[Blufin::Projects::TYPE] == Blufin::Projects::TYPE_API_SIMPLE raise RuntimeError, "Expected project type to be: #{Blufin::Projects::TYPE_QUASAR}, instead got: #{ui_project[Blufin::Projects::TYPE]}" unless ui_project[Blufin::Projects::TYPE] == Blufin::Projects::TYPE_QUASAR @generated = [] @overwritten = [] @project_path = Blufin::Projects::get_project_path(api_project[Blufin::Projects::PROJECT_ID]) @project_path_api = Blufin::Projects::get_project_path(api_project[Blufin::Projects::PROJECT_ID], true) @project_path_ui = Blufin::Projects::get_project_path(ui_project[Blufin::Projects::PROJECT_ID], true) @transient_data_api = api_project[Blufin::Projects::TRANSIENT_DATA] @transient_data_ui = ui_project[Blufin::Projects::TRANSIENT_DATA] @controller_path = "#{EWorld::BaseWriter::get_java_path_for(@project_path, @transient_data_api['ControllerPath'])}/#{PACKAGE_NAME}" # Loop controllers. controllers.each { |clazz, data| write_controller(clazz, data) } # TODO - REMOVE # puts @transient_data_api.to_yaml # puts @transient_data_ui.to_yaml # puts # puts "\x1B[38;5;154m#{controllers.to_yaml}\x1B[0m" return @generated, @overwritten end |