Class: Minirails::Builder
- Inherits:
-
Struct
- Object
- Struct
- Minirails::Builder
- Defined in:
- lib/minirails.rb
Instance Attribute Summary collapse
-
#specfile ⇒ Object
Returns the value of attribute specfile.
Instance Method Summary collapse
-
#define(name = nil, opts = {}, &block) ⇒ Object
DSL API.
- #spawn ⇒ Object
-
#start(num) ⇒ Object
internals.
Instance Attribute Details
#specfile ⇒ Object
Returns the value of attribute specfile
64 65 66 |
# File 'lib/minirails.rb', line 64 def specfile @specfile end |
Instance Method Details
#define(name = nil, opts = {}, &block) ⇒ Object
DSL API
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/minirails.rb', line 67 def define(name = nil, opts = {}, &block) type = opts[:type] || :rails klazz = { rails: RailsApp, rack: RackApp, blank: App }[type] if opts[:initialize] parent = apps.find {|a| a.name == opts[:initialize] } apps << WrappedApp.new(klazz.new(name, block), parent) else apps << klazz.new(name, block) end end |
#spawn ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/minirails.rb', line 90 def spawn boot require "foreman/engine/cli" engine = Foreman::Engine::CLI.new apps.each.with_index do |app, index| engine.register( app.name || "web-#{index}", "#{File.($0)} #{File.(specfile)} #{index}", cwd: Dir.pwd ) end engine.start end |
#start(num) ⇒ Object
internals
84 85 86 87 88 |
# File 'lib/minirails.rb', line 84 def start(num) boot apps[num].init apps[num].call end |