Skip to content
Browse files

basic setup/startup/shutdown/init_rails scripts

  • Loading branch information...
1 parent 06e8302 commit ed8404394b1fd21b3b6751aa97720d1396665585 @chadburrus chadburrus committed Jan 16, 2012
Showing with 93 additions and 0 deletions.
  1. +15 −0 init_rails.sh
  2. +65 −0 setup.sh
  3. +8 −0 shutdown.sh
  4. +5 −0 startup.sh
View
15 init_rails.sh
@@ -0,0 +1,15 @@
+bundle install
+read -p "Drop Db? [y/N]" DROP_DB
+if [ "$DROP_DB" == "y" ]
+then
+ rake db:drop
+ rake db:create
+fi
+rake db:migrate
+if [ "$DROP_DB" == "y" ]
+then
+ echo "run the following command (or some variation thereof) in the console to set up your first user"
+ echo "AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')"
+ bundle exec rails console
+fi
+bundle exec rails server
View
65 setup.sh
@@ -0,0 +1,65 @@
+# Consider this an overview of the steps rather than an actual script to run,
+# at least for the moment--there are some issues with running it straight
+# that I haven't had time to work out yet.
+echo This script is a process to follow, not a script to run, as there are bugs that break it for now. Open it and follow the steps.
+exit
+
+# Assumptions:
+# 1. The rails-base.box file is located in your $HOME directory
+# 2. git and VirtualBox have already been installed independently
+# 3. Github access has been configured (with shell access)
+# Future Work:
+# 1. Parameterize paths
+# a. Starting directory
+# b. Code location (devotion-cms)
+# c. Code location (helper apps (rbenv (might be hard/impossible), ruby-build))
+# d. Location of rails-base.box
+# 2. Parameterize Ruby version
+# 3. Github-specific key gen? (probably overkill and unnecessary)
+
+# start at home
+cd $HOME
+
+# pull down source -- assumes you have github access already
+git clone git@github.com:whitecl/devotion-cms.git
+
+# mv rails-base.box file
+mv rails-base.box devotion-cms/
+
+# we'll come back here later--keep a record of it for easy returns
+cd devotion-cms
+
+# install rbenv
+pushd ~
+git clone git://github.com/sstephenson/rbenv.git .rbenv
+echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
+echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
+# bounce shell - simply sourcing the .bash_profile should work, but I haven't really tried it
+exec $SHELL
+
+# install ruby-install rbenv command
+git clone git://github.com/sstephenson/ruby-build.git
+cd ruby-build
+./install.sh
+
+# install Ruby 1.9.3-p0
+rbenv install 1.9.3-p0
+
+# rehash rbenv
+rbenv rehash
+
+# install vagrant
+gem install vagrant
+
+# rehash rbenv -- just in case
+rbenv rehash
+
+# return to source
+popd
+
+# init virtual machine
+vagrant box add rails-base rails-base.box
+vagrant init rails-base
+
+# run startup script
+./startup.sh
View
8 shutdown.sh
@@ -0,0 +1,8 @@
+# turn off the VM
+vagrant halt
+
+# make sure it's dead
+# Note: May throw error as described @
+# https://github.com/mitchellh/virtualbox/issues/76
+# Haven't tried the patch yet
+vagrant destroy
View
5 startup.sh
@@ -0,0 +1,5 @@
+# boot the virtual machine
+vagrant up
+
+# login to the virtual machine
+vagrant ssh

0 comments on commit ed84043

Please sign in to comment.
Something went wrong with that request. Please try again.