# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2015, Sebastian Staudt

unless defined? Gallerist
  $LOAD_PATH << File.join(__dir__, 'lib')
  require 'gallerist'
end

warmup do |app|
  error = []
  Gallerist::App.enable :show_exceptions
  Rack::MockRequest.new(app).get '/',
    'rack.errors' => $stderr,
    'rack.warmup' => true,
    'rack.warmup.error' => error
  Gallerist::App.disable :show_exceptions unless Gallerist::App.development?
  raise error.first unless error.empty?
end

map '/assets' do
  run Gallerist::App.sprockets
end

run Gallerist::App

# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2015, Sebastian Staudt

unless defined? Gallerist
  $LOAD_PATH << File.join(__dir__, 'lib')
  require 'gallerist'
end

warmup do |app|
  error = []
  Gallerist::App.enable :show_exceptions
  Rack::MockRequest.new(app).get '/',
    'rack.errors' => $stderr,
    'rack.warmup' => true,
    'rack.warmup.error' => error
  Gallerist::App.disable :show_exceptions unless Gallerist::App.development?
  raise error.first unless error.empty?

  Rack::MockRequest.new(app).get '/assets/main.css'
  Rack::MockRequest.new(app).get '/assets/main.js'
end

map '/assets' do
  run Gallerist::App.sprockets
end

run Gallerist::App

Use warmup to precompile assets
Use warmup to precompile assets
