Class: EWorld::JsDocsWriter
- Inherits:
-
BaseWriter
- Object
- BaseWriter
- EWorld::JsDocsWriter
- Defined in:
- lib/writers/js_docs_writer.rb
Constant Summary
Constants inherited from BaseWriter
BaseWriter::CLASS, BaseWriter::CLASS_LOWER, BaseWriter::IMPORTS, BaseWriter::PACKAGE
Class Method Summary collapse
-
.write(api_project, ui_project, js_data) ⇒ Object
Responsible for writing all the spring boot @RestController classes.
Methods inherited from BaseWriter
Class Method Details
.write(api_project, ui_project, js_data) ⇒ Object
Responsible for writing all the spring boot @RestController classes.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/writers/js_docs_writer.rb', line 7 def self.write(api_project, ui_project, js_data) 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] # TODO - This needs better data... @data = js_data target_file = "#{@project_path}/#{Blufin::Strings::remove_surrounding_slashes(@transient_data_ui[Blufin::Projects::CG_QUASAR_ROOT])}/#{Blufin::Strings::remove_surrounding_slashes(@transient_data_ui['JsDocsFile'])}" # Write the file. @overwritten << target_file if Blufin::Files::write_file_if_changed(target_file, Blufin::Arrays::convert_string_to_line_array(JSON.pretty_generate(@data, { indent: ' ' })), write_empty_trailing_line: true) return @generated, @overwritten end |