Skip to content

Instantly share code, notes, and snippets.

@buyaka
Last active August 29, 2015 14:17
Show Gist options
  • Save buyaka/6587fc7a55606539cde6 to your computer and use it in GitHub Desktop.
Save buyaka/6587fc7a55606539cde6 to your computer and use it in GitHub Desktop.
#rails new <APPNAME> -T -m app_template.rb -d mysql
source_paths << File.dirname(__FILE__)
gem 'devise'
gem 'cancan'
gem 'mysql2'
gem 'therubyracer', platforms: :ruby
gem 'materialize-sass'
run 'bundle install'
file 'app/assets/javascripts/application.js', <<-JS
//= require materialize-sprockets
JS
run 'rm app/assets/stylesheets/application.css'
file 'README.md', <<-CSS
@import "materialize";
CSS
# Read me
run 'rm README.rdoc'
file 'README.md', <<-README
## Template for rapid Rails prototypes
* Rails 4
* Mysql
* No tests / specs
* Material design
README
file '.gitignore', <<-IGNORE
*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html
# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
#config/initializers/secret_token.rb
#config/secrets.yml
## Environment normalisation:
/.bundle
/vendor/bundle
# these should all be checked in to normalise the environment:
Gemfile.lock, .ruby-version, .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json
# Ignore pow environment settings
.powenv
IGNORE
# Templates
file 'app/views/shared/_errors.html.erb', <<-ERRORS
<% if object.errors.any? %>
<div class="alert alert-error">
<a class="close" data-dismiss="alert">&#215;</a>
<ul>
<% object.errors.full_messages.each do |msg| %>
<%= content_tag :li, msg %>
<% end %>
</ul>
</div>
<% end %>
ERRORS
# Authentication
generate "devise:install"
generate "devise member"
generate " devise:views"
generate "controller welcome index"
route 'root to: "welcome#index"'
# Clean database.yml
gsub_file 'config/database.yml', / username: \S+\n password:\n/, ''
# Git
git :init
git add: "."
git commit: "-a -m 'Initial commit'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment