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 |
# 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 ActiveSupport::Dependencies.autoload_paths << root.join('app/providers') ActiveSupport::Dependencies.autoload_paths << root.join('app/controllers') @middleware = Middleware.new @middleware << Provisioning::Middleware.new @middleware << @router end |
Class Attribute Details
.root ⇒ Object
Returns the value of attribute root.
35 36 37 |
# File 'lib/mvcli/app.rb', line 35 def root @root end |
Class Method Details
.main(*args) ⇒ Object
42 43 44 |
# File 'lib/mvcli/app.rb', line 42 def self.main(*args) new.main *args end |
Instance Method Details
#call(command) ⇒ Object
22 23 24 |
# File 'lib/mvcli/app.rb', line 22 def call(command) @middleware.call command end |
#main(argv = ARGV.dup, input = $stdin, output = $stdout, log = $stderr, env = ENV.dup) ⇒ Object
38 39 40 |
# File 'lib/mvcli/app.rb', line 38 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
26 27 28 |
# File 'lib/mvcli/app.rb', line 26 def root self.class.root or fail "Invalid App: undefined application root directory" end |
#route_file ⇒ Object
30 31 32 |
# File 'lib/mvcli/app.rb', line 30 def route_file root.join 'app/routes.rb' end |