Skip to content

Instantly share code, notes, and snippets.

@codesoda
Last active August 29, 2015 14:26
Show Gist options
  • Save codesoda/1b7278c4f674f9fc1755 to your computer and use it in GitHub Desktop.
Save codesoda/1b7278c4f674f9fc1755 to your computer and use it in GitHub Desktop.
Sinatra Template
--color
--format Fuubar
--require spec_helper
AllCops:
RunRailsCops: true
Exclude:
- 'db/**/*'
LineLength:
Description: 'Limit lines to 100 characters.'
Enabled: true
Max: 100
Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false
StringLiterals:
Enabled: true
EnforcedStyle: single_quotes
require 'sinatra'
require 'sinatra/base'
class MyApp < Sinatra::Base
get '/' do
[ 200, { 'SERVER' => 'MyApp' }, 'OK' ]
end
end
require './app'
MyApp.run!
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
source 'https://rubygems.org'
gem 'sinatra'
gem 'puma'
guard 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
# watch(/^.+\.gemspec/)
end
guard 'shotgun' do
watch(%r{^(app|assets|lib|config)/(.)*.(rb|css|js|haml)})
end
# guard 'rspec', :version => 2, :cli => "--color --format nested --require spec_helper" do
# watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
# watch(%r{^config/boot\.rb$}) { "spec" }
# watch(%r{^app/(.+)\.rb$}) { "spec/app" }
# watch(%r{^lib/(.+)\.rb$}) { "spec/lib" }
# watch('spec/spec_helper.rb') { "spec" }
# end
web: bundle exec puma -C config/puma.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment