Skip to content

Instantly share code, notes, and snippets.

@JeffCohen
Last active February 3, 2018 19:09
Show Gist options
  • Save JeffCohen/8b81c334c313340d50810a88c0df2bfb to your computer and use it in GitHub Desktop.
Save JeffCohen/8b81c334c313340d50810a88c0df2bfb to your computer and use it in GitHub Desktop.
# This script is for Windows 10.
# The Windows Subsystem for Linux must be enabled before running this script.
#
# Run this script from a Windows bash session with:
#
# curl -sL https://gist.github.com/JeffCohen/8b81c334c313340d50810a88c0df2bfb/raw | bash -E -
cd
echo
echo "Web Development Setup Script for Windows, Version 0.20"
echo
echo "Welcome!"
echo
echo "You are about to setup Ruby on Rails on your Linux-on-Windows system."
echo "This will take about 25 minutes. Do not turn off your computer until this is complete."
echo
echo "All progress is being recorded to a file named install-log.txt"
echo
echo "Starting installation at $(date)" &>> ~/install-log.txt
# Based on GoRails
echo "Step 1 of 5: Updating your Linux environment with standard software development tools" | tee -a ~/install-log.txt
echo " substep 1 of 4..."
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - &>> ~/install-log.txt
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - &>> ~/install-log.txt
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list &>> ~/install-log.txt
sudo apt-get --yes update &>> ~/install-log.txt
sudo apt-get --yes install git-core curl zlib1g-dev build-essential &>> ~/install-log.txt
echo " substep 2 of 4..."
sudo apt-get --yes install libssl-dev libreadline-dev libyaml-dev &>> ~/install-log.txt
echo " substep 3 of 4..."
sudo apt-get --yes install libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev &>> ~/install-log.txt
echo " substep 4 of 4..."
sudo apt-get --yes install libcurl4-openssl-dev python-software-properties &>> ~/install-log.txt
sudo apt-get --yes install libffi-dev nodejs yarn &>> ~/install-log.txt
# me
sudo apt-get install whois &>> ~/install-log.txt
# From Brightbox googling
echo "Step 2 of 5: Installing Ruby 2.4 so you can write your own code" | tee -a ~/install-log.txt
sudo apt-get --yes install software-properties-common &>> ~/install-log.txt
sudo apt-add-repository ppa:brightbox/ruby-ng &>> ~/install-log.txt
sudo apt-get --yes update &>> ~/install-log.txt
sudo apt-get --yes install ruby2.4 ruby2.4-dev &>> ~/install-log.txt
echo "Step 3 of 5: Installing the RubyGems system so you can install cool things" | tee -a ~/install-log.txt
echo 'export "GEM_HOME=$HOME/.gem/ruby/2.4.0"' >> ~/.bashrc
echo 'export "PATH=$HOME/.gem/ruby/2.4.0/bin:$PATH"' >> ~/.bashrc
echo "gem: --no-document" >> ~/.gemrc
source ~/.bashrc
sudo gem update --system &>> ~/install-log.txt
sudo gem install bundler &>> ~/install-log.txt
echo "Step 4 of 5: Customizing the command-line environment to match the classroom" | tee -a ~/install-log.txt
echo 'set bell-style none' >> ~/.inputrc
source ~/.inputrc
echo "export LS_COLORS='di=1;36:ln=36:so=32:pi=33:ex=31:bd=36:cd=0:su=0:sg=0:tw=0:ow=0'" >> ~/.bashrc
echo 'export PS1="\w $ "' >> ~/.bashrc
echo 'alias ll="ls -l"' >> ~/.bashrc
echo 'cd ~ && mkdir -p /mnt/c/code && ln -sfn /mnt/c/code code' >> ~/.bashrc
echo 'cd ~/code' >> ~/.bashrc
source ~/.bashrc
curl -sL https://www.jeffcohenonline.com/templates/law713.rb -o "~/rails-template.rb"
curl -sL https://www.jeffcohenonline.com/templates/law-rc.txt -o "~/.railsrc"
echo "Step 5 of 5: Installing Ruby on Rails - this will take a while..." | tee -a ~/install-log.txt
sudo gem install rails &>> ~/install-log.txt
echo "Finished installation at $(date)" | tee -a ~/install-log.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment