Sha256: e9b334f00b32c318a5ab371eba6b2b60caf5a187e5cbcde758763be6fbb3c784

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

class <%= @name.camelcase %>::Application
  <%- unless @no_views -%>
  before do
    content_type 'text/html'
  end
  <%- else -%>
  before do
    content_type 'application/vnd.api+json'
  end
  <%- 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

    <%- unless @no_views -%>
    # set CSRF
    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

7 entries across 7 versions & 1 rubygems

Version Path
aetherg-0.5.1 lib/templates/config/initializers/environment.rb
aetherg-0.5.0 lib/templates/config/initializers/environment.rb
aetherg-0.5.0.beta3 lib/templates/config/initializers/environment.rb
aetherg-0.5.0.beta2 lib/templates/config/initializers/environment.rb
aetherg-0.5.0.beta lib/templates/config/initializers/environment.rb
aetherg-0.3.4 lib/templates/config/initializers/environment.rb
aetherg-0.3.3 lib/templates/config/initializers/environment.rb