Last active
August 29, 2015 14:26
-
-
Save codesoda/1b7278c4f674f9fc1755 to your computer and use it in GitHub Desktop.
Sinatra Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --color | |
| --format Fuubar | |
| --require spec_helper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2.2.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| require 'sinatra/base' | |
| class MyApp < Sinatra::Base | |
| get '/' do | |
| [ 200, { 'SERVER' => 'MyApp' }, 'OK' ] | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require './app' | |
| MyApp.run! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| gem 'sinatra' | |
| gem 'puma' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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