Skip to content

Instantly share code, notes, and snippets.

@ezrarush
Created January 20, 2016 18:02
Show Gist options
  • Save ezrarush/acc7643d8ea69dfad1a4 to your computer and use it in GitHub Desktop.
Save ezrarush/acc7643d8ea69dfad1a4 to your computer and use it in GitHub Desktop.
# =====================================================================================================
# Template for generating an authentication example
# =====================================================================================================
# Requirements:
# -------------
#
# * Ruby >= 1.9.3
# * Rails >= 4
# Usage:
# ------
#
# $ rails new authentication-example --skip-bundle --template this-gist.rb
#
# =====================================================================================================
# ----- Use Thin ----------------------------------------------------------------------------------
begin
require 'thin'
gem 'thin'
rescue LoadError
end
# ----- Remove CoffeeScript, Sass and "all that jazz" ---------------------------------------------
comment_lines 'Gemfile', /gem 'coffee/
comment_lines 'Gemfile', /gem 'sass/
comment_lines 'Gemfile', /gem 'uglifier/
uncomment_lines 'Gemfile', /gem 'therubyracer/
# ----- Add gems into Gemfile ---------------------------------------------------------------------
gem 'warden'
gem 'bcrypt'
# ----- Disable asset logging in development ------------------------------------------------------
environment 'config.assets.logger = false', env: 'development'
gem 'quiet_assets', group: "development"
# ----- Install gems ------------------------------------------------------------------------------
run "bundle install"
# ----- Generate a resource to authenticate -------------------------------------------------------
generate :controller, "Time show"
route "root 'time#show'"
run "rm -f app/controllers/time_controller.rb"
file "app/controllers/time_controller.rb", <<-CODE
class TimeController < ApplicationController
def show
render text: Time.now
end
end
CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment