Method: Ufo::Command.dispatch
- Defined in:
- lib/ufo/command.rb
.dispatch(m, args, options, config) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ufo/command.rb', line 36 def dispatch(m, args, , config) # Old note: Configuring the DslEvalulator requires Ufo.root and Ufo.logger which # loads Ufo.config and Ufo::Config#load_project_config # This requires Ufo.role. # So we set Ufo.role before triggering Ufo.config loading check_project!(args) check_version_structure! # Special case for `ufo central` commands. # Dont want to call configure_dsl_evaluator # and trigger loading of config => .ufo/config.rb # Also, using ARGV instead of args because args is called by thor in multiple passes # For `ufo central update`: # * 1st pass: "central" # * 2nd pass: "update" configure_dsl_evaluator unless ARGV[0] == "central" # Allow calling for help via: # ufo command help # ufo command -h # ufo command --help # ufo command -D # # as well thor's normal way: # # ufo help command if args.length > 1 && !(args & help_flags).empty? args -= help_flags args.insert(-2, "help") end # ufo version # ufo --version # ufo -v version_flags = ["--version", "-v"] if args.length == 1 && !(args & version_flags).empty? args = ["version"] end super end |