lib/nutcracker/web/app.rb in nutcracker-web-0.0.1 vs lib/nutcracker/web/app.rb in nutcracker-web-0.0.2
- old
+ new
@@ -1,28 +1,30 @@
require 'haml'
require 'sinatra'
-require 'eco'
-require 'sprockets'
require 'json'
module Nutcracker
module Web
class App < Sinatra::Base
enable :inline_templates
set :root, File.expand_path('../'*4,__FILE__)
- set :assets, Sprockets::Environment.new { |env|
- %w(javascripts stylesheets templates).each { |asset|
- env.append_path File.join(settings.root,"assets/#{asset}")
- }
- }
get '/' do
haml :index
end
def overview
- Thread.current[:nutcracker].overview rescue
+ $nutcracker.overview rescue
JSON.parse File.read File.join(settings.root,"example.json")
+ end
+
+ def self.assets
+ require 'sprockets'
+ Sprockets::Environment.new { |env|
+ %w(javascripts stylesheets templates).each { |asset|
+ env.append_path File.join(settings.root,"assets/#{asset}")
+ }
+ }
end
end
end
end