Class: Cup::Server::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/cup/server/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gem_root_path(*params) ⇒ Object



30
31
32
33
# File 'lib/cup/server/app.rb', line 30

def self.gem_root_path *params
  # uses a file relative version so that it points to the live files during development
  File.expand_path(File.join('../../../..', *params), __FILE__)
end

Instance Method Details

#buildObject



39
40
41
# File 'lib/cup/server/app.rb', line 39

def build
  @build_result ||= Cup.build
end

#gem_root_path(*params) ⇒ Object



62
63
64
# File 'lib/cup/server/app.rb', line 62

def gem_root_path *params
  self.class.gem_root_path *params
end

#view(template, options = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/cup/server/app.rb', line 47

def view (template, options={})
  build

  options = {
    :scope => view_scope(options.delete(:javascripts_scheme) || :debug),
    :layout => true
  }.merge options

  slim template, options
end

#view_scope(javascripts_scheme = :debug) ⇒ Object



43
44
45
# File 'lib/cup/server/app.rb', line 43

def view_scope(javascripts_scheme=:debug)
  @view_scope = ViewScope.new self, @build_result, javascripts_scheme
end

#visualsObject



58
59
60
# File 'lib/cup/server/app.rb', line 58

def visuals
  @visuals ||= VisualSpecs.get
end