Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding vagrant RAILS_ENV

- adding an env required modifying Gemfile, application.rb, database.yml,
  file in config/environments, and to social_media.yml
- adding more recipes in order to update rubygems, install mysql client,
  and setup bash configuration
  • Loading branch information...
commit af9b1bde06a4b475540be0a72915f50dd147c65e 1 parent ada47d1
@scottmuc scottmuc authored
View
2  Gemfile
@@ -43,7 +43,7 @@ gem 'bcrypt-ruby', '~> 3.0.0'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
#
-group :test, :development do
+group :test, :development, :vagrant do
gem "rspec-rails", "~> 2.6"
gem "factory_girl_rails", "~> 3.0"
gem "faker", "~> 1.0"
View
6 Vagrantfile
@@ -10,12 +10,18 @@ Vagrant::Config.run do |config|
config.vm.forward_port 5432, 5432 # postgres
config.vm.forward_port 6379, 6379 # redis
+ config.vm.forward_port 3000, 3000 # rails s
config.vm.provision :chef_solo do |chef|
+ config.vm.share_folder "workspace", "/home/vagrant/workspace", "#{HERE}"
+
chef.cookbooks_path = ["#{INFRA_DIR}/site-cookbooks", "#{INFRA_DIR}/cookbooks"]
chef.add_recipe("apt")
chef.add_recipe("heroku_addons::postgresql")
chef.add_recipe("heroku_addons::redis")
+ chef.add_recipe("workstation::rubygems")
+ chef.add_recipe("workstation::mysql")
+ chef.add_recipe("workstation::bash")
chef.json = {
:postgresql => {
:version => "9.1",
View
2  config/application.rb
@@ -4,7 +4,7 @@
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
- Bundler.require(*Rails.groups(:assets => %w(development test)))
+ Bundler.require(*Rails.groups(:assets => %w(development test vagrant)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
View
12 config/database.yml
@@ -29,4 +29,14 @@ staging:
adapter: postgresql
database: victorykit_development
pool: 5
- timeout: 5000
+ timeout: 5000
+
+vagrant:
+ adapter: postgresql
+ database: victorykit_vagrant
+ pool: 5
+ timeout: 5000
+ encoding: unicode
+ host: localhost
+ username: postgres
+ password: password
View
43 config/environments/vagrant.rb
@@ -0,0 +1,43 @@
+Victorykit::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+
+ config.action_mailer.delivery_method = :file
+ config.action_mailer.default_url_options = {
+ :host => '127.0.0.1',
+ :port => 3000
+ }
+end
View
2  config/social_media.yml
@@ -9,3 +9,5 @@ staging: *default
test: *default
development: *default
+
+vagrant: *default
View
3  infra/site-cookbooks/heroku_addons/recipes/postgresql.rb
@@ -14,5 +14,6 @@
include_recipe 'postgresql::server'
service 'postgresql' do
- action [:enable, :start]
+ action :start
+ provider Chef::Provider::Service::Init
end
View
14 infra/site-cookbooks/workstation/recipes/bash.rb
@@ -0,0 +1,14 @@
+template '/home/vagrant/.bashrc' do
+ owner 'vagrant'
+ group 'vagrant'
+ mode 0644
+ source 'bashrc.erb'
+end
+
+template '/home/vagrant/.bash_profile' do
+ owner 'vagrant'
+ group 'vagrant'
+ mode 0644
+ source 'bash_profile.erb'
+end
+
View
1  infra/site-cookbooks/workstation/recipes/mysql.rb
@@ -0,0 +1 @@
+package 'libmysqlclient-dev'
View
3  infra/site-cookbooks/workstation/recipes/rubygems.rb
@@ -0,0 +1,3 @@
+execute 'update ruby gems' do
+ command 'gem update --system'
+end
View
28 infra/site-cookbooks/workstation/templates/default/bash_profile.erb
@@ -0,0 +1,28 @@
+BLACK="\[\e[0;30m\]"
+DGRAY="\[\e[1;30m\]"
+BLUE="\[\e[0;34m\]"
+LBLUE="\[\e[1;34m\]"
+GREEN="\[\e[0;32m\]"
+LGREEN="\[\e[1;32m\]"
+CYAN="\[\e[0;36m\]"
+LCYAN="\[\e[1;36m\]"
+RED="\[\e[0;31m\]"
+LRED="\[\e[1;31m\]"
+PURPLE="\[\e[0;35m\]"
+LPURPLE="\[\e[1;35m\]"
+BROWN="\[\e[0;33m\]"
+YELLOW="\[\e[1;33m\]"
+LGRAY="\[\e[0;37m\]"
+WHITE="\[\e[1;37m\]"
+RESET_COLOR="\[\e[0m\]"
+
+if [[ -n "$PS1" ]]; then
+ export PS1="$BLUE victorykit $CYAN\\w${GREEN} ? ${RESET_COLOR}"
+ export SUDO_PS1="$BLUE\\u$WHITE in $LGRAY\\w\\n${RED}λ ${RESET_COLOR}"
+fi
+
+if [ -f ~/.bashrc ];
+then
+ source ~/.bashrc
+fi
+
View
2  infra/site-cookbooks/workstation/templates/default/bashrc.erb
@@ -0,0 +1,2 @@
+alias ls='ls --color=auto'
+export RAILS_ENV="vagrant"
Please sign in to comment.
Something went wrong with that request. Please try again.