Module: Spinebox

Extended by:
Base
Defined in:
lib/spinebox.rb,
lib/spinebox/base.rb,
lib/spinebox/config.rb,
lib/spinebox/routes.rb,
lib/spinebox/command.rb,
lib/spinebox/version.rb,
lib/spinebox/compiler.rb,
lib/spinebox/reloader.rb,
lib/spinebox/generator.rb,
lib/spinebox/erb_context.rb,
lib/spinebox/templates/app/app/helpers/link_helper.rb

Defined Under Namespace

Modules: Base, Command, Compiler, Config, ERBContext, Generator, LinkHelper, Routes Classes: Reloader, RenderError

Constant Summary collapse

VERSION =
"0.0.15"

Class Method Summary collapse

Methods included from Base

boot!, root

Class Method Details

.appObject

Returns a rack builder app with the drawn routes



36
37
38
39
40
41
# File 'lib/spinebox/routes.rb', line 36

def app
  Routes.app || begin
    Spinebox.boot!
    Routes.app
  end
end

.assetsObject

Straight access to the assets



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

def assets
  config.assets
end

.configObject

Offers the configuration with the assets



27
28
29
30
# File 'lib/spinebox/config.rb', line 27

def config
  block = Proc.new if block_given?
  Config.configuration(&block)
end

.load_config!(config = "./config/config.rb") ⇒ Object

Load the config



43
44
45
# File 'lib/spinebox/config.rb', line 43

def load_config!(config = "./config/config.rb")
  load config
end

.load_helpers!Object

Load helpers and include into sprockets context



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/spinebox/erb_context.rb', line 61

def load_helpers!
  Spinebox::ERBContext.class_eval do
    Dir["app/helpers/*"].each do |helper|
      require("./#{helper}")
      include Spinebox.const_get(File.basename(helper, ".rb").classify)
    end
  end
  
  ::Sprockets::Context.instance_eval do
    include Spinebox::ERBContext
  end
end

.load_routes!(routes = "./config/routes.rb") ⇒ Object

Load the routes



44
45
46
# File 'lib/spinebox/routes.rb', line 44

def load_routes!(routes = "./config/routes.rb")
  load routes
end

.viewsObject

Straight access to the views



38
39
40
# File 'lib/spinebox/config.rb', line 38

def views
  config.views
end