Sha256: ff44b038fd161ca3c5e9d520107ab8e8932a85620f2ca28975e339f4b5bf55ca

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

require 'sinatra/base'
require 'tilt/erubis'
require 'json'
require 'yaml'

require_relative '<%= @gen.wormname %>/helpers'
require_relative '<%= @gen.wormname %>/racks'

module <%= @gen.camelname %>
  class App < Sinatra::Base
    helpers do
      include <%= @gen.camelname %>::Helpers
    end

    get '/' do
      headers 'Vary' => 'Accept'

      respond_to do |wants|
        wants.html do
          @content = '<h1>Hello from <%= @gen.camelname %></h1>'
          @title = '<%= @gen.camelname %>'
          @github_url = CONFIG['github_url']
          erb :index, layout: :default
        end

        wants.json do
          {
            app: '<%= @gen.camelname %>'
          }.to_json
        end
      end
    end

    # start the server if ruby file executed directly
    run! if app_file == $0
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skellington-0.8.1 lib/sinatra/templates/lib/app.rb.eruby
skellington-0.8.0 lib/sinatra/templates/lib/app.rb.eruby
skellington-0.7.5 lib/templates/lib/app.rb.eruby
skellington-0.7.4 lib/templates/lib/app.rb.eruby
skellington-0.7.3 lib/templates/lib/app.rb.eruby