Skip to content

Instantly share code, notes, and snippets.

@vitalyp
Last active August 29, 2015 14:16
Show Gist options
  • Save vitalyp/93ab6e922763c1939b7d to your computer and use it in GitHub Desktop.
Save vitalyp/93ab6e922763c1939b7d to your computer and use it in GitHub Desktop.
Koding Rails automize script
##################################################################
# Koding awesome Rails-script (c). Append it to your .bashrc file, in home directory.
# To start rails server manually you need to enable rvm initially:
# /bin/bash --login
# Then, navigate you Rails project directory, and start app server:
# cd ~/Applications/projectPath;
# rvm gemset use projectRvm;
# rails server -b 0.0.0.0
# Lets automize this process!
##################################################################
# 1. Define our project variables.
projectPath=~/Applications/projectPath # UPDATE !
projectRvm=projectRvm # UPDATE !
authorName="Sir" # UPDATE !
# 2. Add RVM to PATH for scripting. Probably, you already did it:
export PATH="$PATH:$HOME/.rvm/bin"
# 3. Define terminal palette:
green="\e[32m"
cyan="\e[36m"
blue="\e[34m"
lightblue="\e[94m"
black="\e[30m"
red="\e[31m"
darkgray="\e[90m"
bold="\e[1m"
norm="\e[0m"
title=$bold$black
# 4. Create an alias for: a) enable rvm; b) append "rails start" command to bash_history file:
alias oy='
echo "cd $projectPath;rvm gemset use $projectRvm;rails server -b 0.0.0.0" >> $HISTFILE;
echo -e "$green Rails server environment loading..";
echo -e "$cyan Great! Use bash history to proceed (press UP arrow key)!";
/bin/bash --login;'
# 5. We Almost finished! Say Hello:
echo -e "
$norm #########..
$title Welcome, $authorName !! Start with 'oy' command!
$red Have a Nice Day! $green ;)"
#########
# Finish! Start the new terminal, input 'oy' command, then press
# 'UP' arrow key, and press ENTER!
# Ariekdev@gmail.com, free for use and modify :))
#################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment