Sha256: eab854c0b07184a1d33a1b7086aa3bb6a831c3b66e19cf7054a05769b7f36aa6
Contents?: true
Size: 1.88 KB
Versions: 8
Compression:
Stored size: 1.88 KB
Contents
<%= "require 'yaml'\n\n" if @with_database -%> class <%= @app_class_name %> < Sinatra::Application use Rack::Session::EncryptedCookie, secret: '<%= SecureRandom.hex 32 %>' set :app_file, __FILE__ set :server, :puma set :views, Proc.new { File.join(root, "app/views") } set :assets, Sprockets::Environment.new set :assets_manifest, %w(app.js app.css) use Rack::Csrf, raise: true <% if @with_database -%> configure do Sequel::Database.extension :pagination Sequel::Model.plugin :timestamps Sequel::Model.plugin :auto_validations, not_null: :presence, unique_opts: { only_if_modified: true } assets.append_path 'assets/stylesheets' assets.append_path 'assets/javascripts' end configure :development do require 'sinatra/reloader' require 'logger' register Sinatra::Reloader Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['development'], loggers: [Logger.new($stdout)] get '/assets/*' do env['PATH_INFO'].sub!('/assets', '') settings.assets.call(env) end end configure :test do Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['test'] end configure :production do # Serve assets via Nginx or Apache disable :static assets.js_compressor = :uglify assets.css_compressor = :sass Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['production'] end <% else -%> configure do assets.append_path 'assets/stylesheets' assets.append_path 'assets/javascripts' end configure :development do get '/assets/*' do env['PATH_INFO'].sub!('/assets', '') settings.assets.call(env) end end configure :production do # Serve assets via Nginx or Apache disable :static assets.js_compressor = :uglify assets.css_compressor = :sass end <% end -%> end
Version data entries
8 entries across 8 versions & 1 rubygems