Class: AppCommand::Generate
- Inherits:
-
Convoy::ActionCommand::Base
- Object
- Convoy::ActionCommand::Base
- AppCommand::Generate
- Defined in:
- lib/routes/generate.rb
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/routes/generate.rb', line 5 def execute begin @opts = @args = arguments @verbose = !@opts[:silent] @errors = [] @generated = [] @overwritten = [] opts_validate opts_routing rescue => e Blufin::Terminal::print_exception(e) end end |
#opts_routing ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/routes/generate.rb', line 61 def opts_routing Blufin::Terminal::execute_proc("Processing: #{Blufin::Terminal::format_highlight('Routes')}", Proc.new { rg, ro = EWorld::RouteWriter::write(@ui_project, @routes_to_write) @generated.concat(rg) @overwritten.concat(ro) }, verbose: @verbose) # Reformat front-end. Blufin::Terminal::execute_proc('Re-formatting UI codebase', Proc.new { Blufin::Terminal::execute('git add .', @project_path_ui, verbose: false) Blufin::Terminal::execute('yarn format', @project_path_ui, verbose: false) }, verbose: @verbose) puts if @verbose && !@generated.any? && !@overwritten.any? Blufin::Terminal::custom('Generated', 22, 'The following files were generated:', @generated) if @generated.any? Blufin::Terminal::custom('Overwritten', 55, 'The following files were overwritten:', @overwritten) if @overwritten.any? end |
#opts_validate ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/routes/generate.rb', line 29 def opts_validate # TODO - This cannot be hard-coded forever! group = 'fmm' # Get API Project. api_projects = Blufin::Projects.get_projects_as_array(group: group, types: [Blufin::Projects::TYPE_API_SIMPLE]) @api_project = Blufin::Projects.show_project_prompt(api_projects) # Get Quasar Project. ui_projects = Blufin::Projects.get_projects_as_array(group: group, types: [Blufin::Projects::TYPE_QUASAR]) @ui_project = Blufin::Projects.show_project_prompt(ui_projects) # Get project path(s). @project_path = Blufin::Projects::get_project_path(@api_project[Blufin::Projects::PROJECT_ID]) @project_path_ui = Blufin::Projects::get_project_path(@ui_project[Blufin::Projects::PROJECT_ID], true) puts if @verbose Blufin::Terminal::execute_proc("Scanning: #{Blufin::Terminal::format_highlight('Routes')}", Proc.new { eb = @errors.length @routes_to_write, re = EWorld::RouteScanner::scan(@ui_project) @errors.concat(re) eb == @errors.length }, verbose: @verbose) puts if @errors.any? && @verbose Blufin::ScannerError::output_cli(@errors, false) if @errors.any? end |