Module: Grass

Defined in:
lib/grass.rb,
lib/grass/key.rb,
lib/grass/cache.rb,
lib/grass/render.rb,
lib/grass/source.rb,
lib/grass/version.rb,
lib/grass/file_sync.rb,
lib/grass/render/page.rb,
lib/grass/render/text.rb,
lib/grass/render/view.rb,
lib/grass/endpoints/api.rb,
lib/grass/render/layout.rb,
lib/grass/render/script.rb,
lib/grass/endpoints/front.rb,
lib/grass/render/renderer.rb,
lib/grass/render/stylesheet.rb,
lib/grass/helpers/i18n_helper.rb,
lib/grass/render/yui_renderer.rb,
lib/grass/helpers/render_helper.rb

Defined Under Namespace

Modules: Cache, FileSync, Helpers, Render Classes: API, Front, Key, Source

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.app_rootObject



25
26
27
# File 'lib/grass.rb', line 25

def app_root
  @@app_root ||= "#{self.root}/app".gsub("//","/")
end

.cacheObject



29
30
31
32
33
34
# File 'lib/grass.rb', line 29

def cache
  $cache ||= begin
    config = self.load_config('cache')
    Dalli::Client.new config.delete("servers").split(","), config.symbolize_keys!
  end
end

.cache=(cache) ⇒ Object



36
37
38
# File 'lib/grass.rb', line 36

def cache=cache
  $cache = cache
end

.envObject



40
41
42
# File 'lib/grass.rb', line 40

def env
  ENV['RACK_ENV'] ||= "development"
end

.gem_rootObject



13
14
15
# File 'lib/grass.rb', line 13

def gem_root
  @@gemroot ||= File.expand_path('../..', __FILE__)
end

.load_config(file) ⇒ Object



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

def load_config file
  db_conf = YAML.load(ERB.new(File.read("#{Grass.root}/config/#{file}.yml")).result)[self.env]
end

.rootObject



17
18
19
# File 'lib/grass.rb', line 17

def root
  @@root ||= find_root_with_flag("Procfile", Dir.pwd).to_s
end

.root=(root) ⇒ Object



21
22
23
# File 'lib/grass.rb', line 21

def root= root
  @@root = root
end