Sha256: fe6cce350194bae0d77170bd438b5bba2cc5a09299bbd4a675ca2176c4d7991e

Contents?: true

Size: 906 Bytes

Versions: 2

Compression:

Stored size: 906 Bytes

Contents

class <%= @name.camelcase %>::Application
  before do
    content_type 'text/html'
  end

  <%- unless @no_views -%>
  set :views, Proc.new { File.join(root, "/app/views") }
  <%- end -%>

  configure do
    enable :logging
    <%- unless @no_views -%>
    enable :static_cache_control
    <%- end -%>
    file = File.new("#{root}/log/#{environment.to_s}.log", 'a+')

    <%- unless @no_database || @database == 'mongodb' || @database == 'mongo' -%>
    ActiveRecord::Base.logger = Logger.new(file)
    <%- end -%>

    file.sync = true
    use Rack::CommonLogger, file

    # set CSRF

    <%- unless @no_views -%>
    use Rack::Session::Cookie, key: _<%= @name %>.session, secret: $app_settings["csrf_token"]
    use Rack::Csrf, :raise => true
    <%- end %>

    <%- unless @no_views -%>
    # set layouts
    set :erb, :layout => :'layouts/application', :escape_html => true
    <%- end -%>
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aetherg-0.3.2 lib/templates/config/initializers/environment.rb
aetherg-0.3.1 lib/templates/config/initializers/environment.rb