Skip to content

Instantly share code, notes, and snippets.

@johnmeehan
Last active August 29, 2015 14:11
Show Gist options
  • Save johnmeehan/03d3104d4ef08b9858fb to your computer and use it in GitHub Desktop.
Save johnmeehan/03d3104d4ef08b9858fb to your computer and use it in GitHub Desktop.
A basic Rails Application Template- Haml-Rspec-Capybara-Guard-Livereload-Bootstrap-FactoryGirl
# require 'pry'; binding.pry
# Rails Project Template
# Run with:
# rails new MyApp -T -m http://.............
# John Meehan 2015
# Set the ruby version to that of the RVM
insert_into_file('Gemfile', "ruby '#{RUBY_VERSION}'\n", :before => /^ *gem 'rails'/, :force => false)
# Set the Gemset name based on the Rails app name
insert_into_file('Gemfile', "#ruby-gemset=#{@app_name}\n", :before => /^ *gem 'rails'/, :force => false)
puts "****** Gemfile *******"
gem 'haml'
gem "haml-rails"
gem 'bootstrap-sass'
gem "factory_girl_rails"
gem_group :development, :test do
gem "rspec-rails"
gem 'spring-commands-rspec'
end
gem 'shoulda-matchers', :group => :test
gem 'capybara', :group => :test
gem 'simplecov', :require => false, :group => :test
gem 'rubocop', require: false
# gem 'database_cleaner', :group => :test
gem_group :development do
gem 'annotate'
gem 'awesome_print'
gem 'guard'
gem 'guard-rspec', require: false
gem 'guard-livereload', require: false
gem 'guard-annotate', require: false
end
puts "****** Bundle *******"
run "bundle install"
puts "****** After Bundle *******"
generate 'haml:application_layout convert' #converts application.erb to haml
run "rm app/views/layouts/application.html.erb"
generate 'rspec:install'
puts "******* Bootstrap *********"
run "rm app/assets/stylesheets/application.css"
file "app/assets/stylesheets/application.scss", <<-CODE
@import "bootstrap-sprockets";
@import "bootstrap";
CODE
insert_into_file('app/assets/javascripts/application.js', "\n//= require bootstrap-sprockets", :after => /^ *\/\/= require jquery_ujs/, :force => false)
# puts "****** Binstub *******"
# run "bundle exec spring binstub --all"
puts "****** Guard Init *******"
run "bundle exec guard init"
puts "******** Simple Cov ********"
prepend_to_file 'spec/spec_helper.rb' do
"\nrequire \'simplecov\'\nSimpleCov.start \'rails\'\n\n"
end
puts "gitignore stuff ....."
append_file '.gitignore' do
'/coverage'
end
puts "****** GIT *******"
git :init
git add: "."
git commit: "-m 'First commit!'"
## Rails will Run bundle install AND binsubs itself after this!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment