Skip to content
Newer
Older
100755 70 lines (54 sloc) 2.24 KB
f80e5d0 @joshfng Adding the shell script
authored
1 #!/bin/bash
2 # created by Josh Frye | joshfng@gmail.com
3
4 shopt -s extglob
5 set -e
6
7 # Check if the user has sudo privileges.
8 sudo -v >/dev/null 2>&1 || { echo $(whoami) has no sudo privileges ; exit 1; }
9
10 echo "Creating install dir..."
11 cd && mkdir -p railsready/src && cd railsready && touch install.log
12 echo "done.."
13
14 # Update the system before going any further
15 echo "Updating system..."
16 sudo apt-get update >> install.log && sudo apt-get -y upgrade >> install.log
17 echo "done.."
18
19 # Install build tools
20 echo "Installing build tools..."
21 sudo apt-get -y install \
22 wget build-essential libxslt1.1 libssl-dev libxslt1-dev libxml2 libffi-dev libyaml-dev libreadline5-dev zlib1g-dev >> install.log
23 echo "done..."
24
25 echo "Installing libs needed for sqlite and mysql..."
26 sudo apt-get -y install sqlite3 libsqlite3-dev libmysqlclient16-dev libmysqlclient16 >> install.log
27 echo "done..."
28
29 # Install imagemagick
30 echo "Installing imagemagick (this may take awhile)..."
31 sudo apt-get -y install imagemagick libmagick9-dev >> install.log
32 echo "done..."
33
34 # Install git-core
35 echo "Installing git..."
36 sudo apt-get -y install git-core >> install.log
37 echo "done..."
38
39 # Install Ruby
40 echo "Downloading Ruby 1.9.2p136"
41 cd src && wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz
42 echo "done..."
43 echo "Extracting Ruby 1.9.2p136"
44 tar -xzf ruby-1.9.2-p136.tar.gz >> ~/railsready/install.log
45 echo "done..."
46 echo "Building Ruby 1.9.2p136 (this may take awhile and build output may appear on screen)..."
47 cd ruby-1.9.2-p136 && ./configure >> ~/railsready/install.log && make >> ~/railsready/install.log && sudo make install >> ~/railsready/install.log
48 echo "done..."
49
50 # Reload bash
51 echo "Reloading bashrc so ruby and rubygems are available..."
52 source ~/.bashrc
53 echo "done..."
54
55 echo "Installing Bundler, Passenger and Rails.."
56 sudo gem install bundler passenger rails --no-ri --no-rdoc >> ~/railsready/install.log
57 echo "done..."
58
59 echo "Installation is complete!"
60
61 cd ~/railsready/
62
63 # Create a test app
64 echo "Creating a dummy Rails app for testing"
65 touch testapp.log
66 rails new testapp >> testapp.log && cd testapp && bundle install >> testapp.log && cd ../
67 echo "testapp installed and bundle install ran"
68
69 echo "Dummy Rails app install complete! To start the server run 'cd ~/railsready/testapp && rails s'"
Something went wrong with that request. Please try again.