Class: Xmvc::CLI
- Inherits:
-
Thor
- Object
- Thor
- Xmvc::CLI
- Defined in:
- lib/xmvc/cli.rb
Constant Summary collapse
- ARGV =
::ARGV.dup
Instance Method Summary collapse
- #build(name = :all, *params) ⇒ Object
- #generate(*params) ⇒ Object
-
#initialize(args = ARGV, config = {}, options = {}) ⇒ CLI
constructor
A new instance of CLI.
- #namespace(name) ⇒ Object
- #plugin ⇒ Object
- #stats ⇒ Object
Constructor Details
#initialize(args = ARGV, config = {}, options = {}) ⇒ CLI
Returns a new instance of CLI.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/xmvc/cli.rb', line 44 def initialize(args=ARGV, config={}, ={}) # Boot UI Xmvc.ui = UI::Shell.new(shell) host = config.delete(:host) || .delete(:host) unless host raise Xmvc::NoFramework.new("Xmvc is meant to be supplied with a framework extension, eg extjs-mvc, via Xmvc::CLI.start(ARGV, {:framework => Your::Framework})") end # Set the framework. Xmvc.host = host .delete(:shell) # New Vendors replaces host above Xmvc.vendors = .delete(:vendors) Xmvc::Config.setup() Xmvc.config = Xmvc::Config Xmvc.environment = Xmvc::Config[:environment] super end |
Instance Method Details
#build(name = :all, *params) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/xmvc/cli.rb', line 19 def build(name = :all, *params) Xmvc.ensure_in_app builder = Xmvc::Builder.new([], .dup) builder.invoke(name.to_sym, params) #Xmvc::BuilderManager.dispatch(name, *params) end |
#generate(*params) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/xmvc/cli.rb', line 11 def generate(*params) which = params.shift Xmvc.ensure_in_app unless which == 'app' Xmvc::Generator.dispatch(which, , *params) Xmvc::Config.render end |
#namespace(name) ⇒ Object
39 40 41 42 |
# File 'lib/xmvc/cli.rb', line 39 def namespace(name) Xmvc.ensure_in_app Xmvc::Generator.dispatch("namespace", name) end |
#plugin ⇒ Object
27 28 29 30 |
# File 'lib/xmvc/cli.rb', line 27 def plugin Xmvc.ensure_in_app Xmvc::Plugin.new('Frak') end |
#stats ⇒ Object
33 34 35 36 |
# File 'lib/xmvc/cli.rb', line 33 def stats Xmvc.ensure_in_app Xmvc::Stats.dispatch end |