Skip to content

Instantly share code, notes, and snippets.

@cgallemore
Created February 21, 2014 01:04
Show Gist options
  • Save cgallemore/9126816 to your computer and use it in GitHub Desktop.
Save cgallemore/9126816 to your computer and use it in GitHub Desktop.
Rails template to get up and running quickly with vagrant, to install run 'rails new project_name -m /path/to/rails_vagrant.rb'
file 'gitignore', <<-CODE
/.bundle
/.idea
/.vagrant
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
.DS_Store
config/database.yml
config/environments/local.rb
/coverage
CODE
file 'Vagrantfile', <<-CODE
Vagrant.configure('2') do |config|
config.vm.box = 'heroku'
config.vm.box_url = 'https://dl.dropboxusercontent.com/s/rnc0p8zl91borei/heroku.box'
config.vm.provider 'virtualbox' do |v|
# v.name = ''
end
# Make the Rails development server available on the host
config.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: false
# PostgreSQL
config.vm.network :forwarded_port, guest: 5432, host: 5555, auto_correct: false
#For Salt
config.vm.synced_folder 'salt/roots', '/srv'
config.vm.provision :salt do |salt|
salt.run_highstate = true
salt.minion_config = 'salt/minion'
salt.verbose = true
end
end
CODE
file 'salt/minion', <<-CODE
master: localhost
file_client: local
CODE
file 'salt/roots/salt/top.sls',<<-CODE
base:
'*':
- rails
CODE
file 'salt/roots/salt/rails/init.sls',<<-CODE
rails:
gem.installed:
- user: vagrant
bundle-install:
cmd.run:
- name: bundle install
- cwd: /vagrant
- user: vagrant
- require:
- gem: rails
CODE
file 'bin/reset',<<-CODE
#!/bin/bash
BIN_PATH=$(dirname $0)
$BIN_PATH/bundle install
$BIN_PATH/rake db:drop:all
$BIN_PATH/rake db:create:all
$BIN_PATH/rake db:migrate
$BIN_PATH/rake db:test:prepare
CODE
file 'bin/rspec',<<-CODE
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')
CODE
gem 'bootstrap-sass', '~> 2.3.2.1'
gem 'font-awesome-sass', '>= 3.2.1.4'
gem_group :development, :test do
gem 'debugger', '~> 1.6.5'
gem 'puma', '~> 2.6.0'
gem 'rspec-rails', '~> 2.14.0'
gem 'factory_girl_rails', '~> 4.2.1'
gem 'faker', '~> 1.2.0'
gem 'capybara', '~> 2.1.0'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment