Module: Gazebo

Defined in:
lib/cli.rb,
lib/gazebo.rb,
lib/auto_loader.rb

Defined Under Namespace

Classes: DatabaseTasks

Constant Summary collapse

Router =
Router.new
VERSION =
"0.1.5"
LOAD_PATHS =
[
  "app/models",
  "app/controllers"
]

Class Method Summary collapse

Class Method Details

.appObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gazebo.rb', line 16

def self.app
  fetch_routes

  app = Proc.new do |env|
    req = Rack::Request.new(env)
    res = Rack::Response.new
    Gazebo::Router.run(req, res)
    res
  end

  app = Rack::Builder.new do
    use ShowExceptions
    use StaticAssetServer
    run app
  end.to_app
end

.fetch_routesObject



37
38
39
40
41
42
43
# File 'lib/gazebo.rb', line 37

def self.fetch_routes
  file = File.join(ROOT, "config/routes.rb")

  File.open(file) do |f|
    self.class_eval(f.read)
  end
end

.root=(root) ⇒ Object



33
34
35
# File 'lib/gazebo.rb', line 33

def self.root=(root)
  const_set("ROOT", root)
end

.seedObject



45
46
47
48
49
50
51
# File 'lib/gazebo.rb', line 45

def self.seed
  file = File.join(ROOT, "db/seeds.rb")

  File.open(file) do |f|
    self.class_eval(f.read)
  end
end