Skip to content

Instantly share code, notes, and snippets.

@madzhuga
Created April 5, 2015 18:25
Show Gist options
  • Save madzhuga/4875c98eea03811d1611 to your computer and use it in GitHub Desktop.
Save madzhuga/4875c98eea03811d1611 to your computer and use it in GitHub Desktop.
Minimal Rails 4.2 application
# Using minimal rails application using rackup
# Rails 4.2.0
# ruby 2.1
#
# Start:
# bundle exec RAILS_ENV=production rackup -p 3000 -s thin
#
# And open:
#
# http://localhost:3000/hello/world
#
require "rails"
require "action_controller/railtie"
class MyApp < Rails::Application
routes.append do
get "/hello/world" => "hello#world"
end
config.cache_classes = true
config.middleware.delete "Rack::Lock"
config.middleware.delete "ActionDispatch::Flash"
config.middleware.delete "Rack::ETag"
config.middleware.delete "ActionDispatch::BestStandardsSupport"
config.middleware.delete "ActionDispatch::ShowExceptions"
config.middleware.delete "ActionDispatch::DebugExceptions"
config.middleware.delete "ActiveSupport::Cache::Strategy::LocalCache::Middleware"
config.middleware.delete "ActionDispatch::RemoteIp"
config.middleware.delete "ActionDispatch::Cookies"
config.middleware.delete "ActionDispatch::Callbacks"
config.middleware.delete "ActionDispatch::Session::CookieStore"
config.middleware.delete "Rack::Head"
# config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk"
end
class HelloController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
def world
render :text => "Hello world!"
end
end
MyApp.initialize!
puts ">> Starting Rails lightweight stack"
Rails.configuration.middleware.each do |middleware|
puts "use #{middleware.inspect}"
end
puts "run #{Rails.application.class.name}.routes"
run MyApp
source 'https://rubygems.org'
gem 'thin'
gem 'rails', '4.2.0'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment