Class: MVCLI::App
- Inherits:
-
Object
- Object
- MVCLI::App
- Defined in:
- lib/mvcli/app.rb
Class Attribute Summary collapse
-
.root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
- #call(command) ⇒ Object
-
#initialize ⇒ App
constructor
A new instance of App.
- #main(argv = ARGV.dup, input = $stdin, output = $stdout, log = $stderr, env = ENV.dup) ⇒ Object
- #root ⇒ Object
- #route_file ⇒ Object
Constructor Details
#initialize ⇒ App
Returns a new instance of App.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mvcli/app.rb', line 12 def initialize @router = Router.new Actions.new root @router.instance_eval route_file.read, route_file.to_s, 1 [:providers, :controllers, :forms, :models].each do |path| ActiveSupport::Dependencies.autoload_paths << root.join('app', path.to_s) end @middleware = Middleware.new @middleware << MVCLI::Middleware::ExitStatus.new @middleware << MVCLI::Middleware::ExceptionLogger.new @middleware << Provisioning::Middleware.new @middleware << @router end |
Class Attribute Details
.root ⇒ Object
Returns the value of attribute root.
38 39 40 |
# File 'lib/mvcli/app.rb', line 38 def root @root end |
Class Method Details
.main(*args) ⇒ Object
45 46 47 |
# File 'lib/mvcli/app.rb', line 45 def self.main(*args) new.main *args end |
Instance Method Details
#call(command) ⇒ Object
25 26 27 |
# File 'lib/mvcli/app.rb', line 25 def call(command) @middleware.call command end |
#main(argv = ARGV.dup, input = $stdin, output = $stdout, log = $stderr, env = ENV.dup) ⇒ Object
41 42 43 |
# File 'lib/mvcli/app.rb', line 41 def main(argv = ARGV.dup, input = $stdin, output = $stdout, log = $stderr, env = ENV.dup) call Command.new(argv, input, output, log, env) end |
#root ⇒ Object
29 30 31 |
# File 'lib/mvcli/app.rb', line 29 def root self.class.root or fail "Invalid App: undefined application root directory" end |
#route_file ⇒ Object
33 34 35 |
# File 'lib/mvcli/app.rb', line 33 def route_file root.join 'app/routes.rb' end |