lib/guinness/application.rb in guinness-0.0.2 vs lib/guinness/application.rb in guinness-0.1.0
- old
+ new
@@ -2,40 +2,21 @@
attr_accessor :settings, :builder
def initialize(options = {})
@settings = { output_dir: '../' }.merge options
-
+
app = self
- @builder = Rack::Builder.new do
+ @builder = Rack::Builder.new do |builder|
use Rack::CommonLogger
use Rack::ShowStatus # Nice looking 404s and other messages
use Rack::ShowExceptions # Nice looking errors
+ use Rack::Static, :urls => ["/stylesheets", "/javascripts", "/images"]
run Guinness::Server.new app
end
end
- def drink
+ def serve
Rack::Handler::Thin.run @builder, Port: 9393
- end
-
- def build
- FileUtils.cd @settings[:root] do
- # collect all files that don't start with '_'
- files = Dir[File.join('**', '*')].reject { |f| f =~ /(^_|\/_)/ }
-
- files.each do |file|
- path = File.join @settings[:output_dir], file
-
- if Tilt[path]
- body = Guinness::View.new(file).render
- File.open(path.chomp(File.extname(path)), 'w') { |f| f.write body }
- elsif Dir.exists? file
- FileUtils.mkpath path
- else
- FileUtils.cp file, path
- end
- end
- end
end
end