Last active
August 29, 2015 14:18
-
-
Save kgmyshin/dcc9356e568536503ed5 to your computer and use it in GitHub Desktop.
rails new new_project_name -m template.rb
This file contains 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
gem 'haml-rails' | |
gem 'erb2haml' | |
gem_group :development, :test do | |
gem 'hirb' | |
gem 'hirb-unicode' | |
gem 'pry-rails' | |
gem 'pry-doc' | |
gem 'pry-byebug' | |
gem 'rspec-rails', '~> 3.0' | |
end | |
file '.pryrc', <<-CODE | |
begin | |
require 'hirb' | |
rescue LoadError | |
# Missing goodies, bummer | |
end | |
if defined? Hirb | |
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling | |
Hirb::View.instance_eval do | |
def enable_output_method | |
@output_method = true | |
@old_print = Pry.config.print | |
Pry.config.print = proc do |*args| | |
Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args) | |
end | |
end | |
def disable_output_method | |
Pry.config.print = @old_print | |
@output_method = nil | |
end | |
end | |
Hirb.enable | |
end | |
CODE | |
run_bundle | |
initializer 'secret_token.rb', <<-CODE | |
require 'securerandom' | |
def secure_token | |
token_file = Rails.root.join('.secret') | |
if File.exist?(token_file) | |
# Use the existing token. | |
File.read(token_file).chomp | |
else | |
# Generate a new token and store it in token_file. | |
token = SecureRandom.hex(64) | |
File.write(token_file, token) | |
token | |
end | |
end | |
#{@app_name.capitalize}::Application.config.secret_key_base = secure_token | |
CODE | |
run "echo \"Rails.application.config.assets.precompile += ['*.js', '*.css']\" >> config/initializers/assets.rb" | |
run "echo '.secret' >> .gitignore" | |
run "rails generate rspec:install" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment