Last active
May 5, 2016 13:25
-
-
Save justinmoh/8cc6eed3ea18a5dc0ba6f58f2175a404 to your computer and use it in GitHub Desktop.
Revisions
-
justinmoh revised this gist
May 5, 2016 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -115,12 +115,13 @@ function config_xdebug() { if [[ ${line_count} -lt 3 ]]; then local content='zend_extension=xdebug.so\n \nxdebug.remote_enable=1\nxdebug.remote_connect_back=1\nxdebug.remote_port=9000\nxdebug.scream=0\nxdebug.cli_color=1\nxdebug.show_local_vars=1\nxdebug.ide_key=vagrant\nxdebug.remote_host=192.168.10.10' echo -e ${content} | sudo tee ${xdebug_ini_path} sudo service php7.0-fpm restart fi printf " * xdebug.ini is configured.\n" } ################################################################################ -
justinmoh revised this gist
May 5, 2016 . 1 changed file with 19 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -84,7 +84,7 @@ function apt_install_this() { function check_rvm() { local result=$(type rvm >/dev/null 2>&1 || echo 'nope'); printf "Checking %s...\n" "RVM"; if [[ ${result} = 'nope' ]]; then printf "\n"; @@ -106,6 +106,23 @@ function install_rvm() { rvm requirements; } function config_xdebug() { printf "Checking xdebug configuration...\n" local xdebug_ini_path='/etc/php/7.0/mods-available/xdebug.ini'; local line_count=$(grep -c '' ${xdebug_ini_path}); if [[ ${line_count} -lt 3 ]]; then local content='zend_extension=xdebug.so\n \nxdebug.remote_enable=1\nxdebug.remote_connect_back=1\nxdebug.remote_port=9000\nxdebug.scream=0\nxdebug.cli_color=1\nxdebug.show_local_vars=1\nxdebug.ide_key=vagrant\n' echo -e ${content} | sudo tee ${xdebug_ini_path} fi printf " * xdebug.ini is configured:\n" } ################################################################################ # Main ################################################################################ @@ -117,6 +134,7 @@ function install_rvm() { # done apt_install_this $wanted_packages && \ config_xdebug && \ check_rvm && \ modify_npm_global_dir && \ echo "Wanted packages are checked and installed."; -
justinmoh revised this gist
Apr 26, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -102,7 +102,7 @@ function install_rvm() { curl -sSL https://get.rvm.io | bash -s stable --ruby; source /home/vagrant/.rvm/scripts/rvm; rvm requirements; } -
justinmoh revised this gist
Apr 26, 2016 . 1 changed file with 14 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,11 +21,16 @@ sudo timedatectl set-timezone Asia/Kuala_Lumpur function modify_npm_global_dir() { # @url https://docs.npmjs.com/getting-started/fixing-npm-permissions printf "Checking NPM global directory...\n" if [[ ${USER} == "root" ]]; then echo "The after.sh provisioner should be running as vagrant." echo "Try adding privileged: false after the provisioner script." exit 0; fi local npm_global_dir_name='.npm-global'; local npm_global_path="${HOME}/${npm_global_dir_name}"; if [[ ! -d "${npm_global_path}" ]]; then mkdir -p ${npm_global_path} && \ @@ -36,16 +41,17 @@ function modify_npm_global_dir() { local result=$( npm config get prefix | grep '.npm-global$' ); if [[ "${result}" = "" ]]; then npm config set prefix ${npm_global_path} && \ printf " * NPM global directory set to %s\n" "${npm_global_path}"; else local npm_prefix="$( npm config get prefix )"; printf " * NPM global directory path is %s\n" "${npm_prefix}"; fi local profile_path="${HOME}/.profile"; local result=$( grep '^export PATH=$HOME/.npm-global/bin:$PATH$' ${profile_path} ); if [[ "${result}" = "" ]]; then echo -e '\nexport PATH=$HOME/.npm-global/bin:$PATH' >> ${profile_path} && \ printf " * NPM global bin path included in PATH variable.\n" else printf " * NPM global directory & bin path checked and looks fine.\n" -
justinmoh revised this gist
Apr 26, 2016 . 1 changed file with 26 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,22 +19,37 @@ sudo timedatectl set-timezone Asia/Kuala_Lumpur # Function declaration ################################################################################ function modify_npm_global_dir() { # @url https://docs.npmjs.com/getting-started/fixing-npm-permissions printf "Checking npm global directory...\n" local user='/home/vagrant'; local npm_global_dir_name='.npm-global'; local npm_global_path="${user}/${npm_global_dir_name}"; if [[ ! -d "${npm_global_path}" ]]; then mkdir -p ${npm_global_path} && \ printf " * Created directory %s\n" "${npm_global_path}" else printf " * ${npm_global_path} exists.\n"; fi local result=$( npm config get prefix | grep '.npm-global$' ); if [[ "${result}" = "" ]]; then npm config set prefix "${npm_global_path}" && \ printf " * NPM global directory set to %s\n" "${npm_global_path}"; else printf " * NPM global directory path is already ${npm_global_path}\n"; fi local profile_path="${user}/.profile"; local result=$( grep '^export PATH=~/.npm-global/bin:$PATH$' ${profile_path} ); if [[ "${result}" = "" ]]; then echo -e '\nexport PATH=~/.npm-global/bin:$PATH' >> ${profile_path} && \ printf " * NPM global bin path included in PATH variable.\n" else printf " * NPM global directory & bin path checked and looks fine.\n" fi } function apt_is_installed() { @@ -97,5 +112,5 @@ function install_rvm() { apt_install_this $wanted_packages && \ check_rvm && \ modify_npm_global_dir && \ echo "Wanted packages are checked and installed."; -
justinmoh revised this gist
Apr 26, 2016 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,24 @@ sudo timedatectl set-timezone Asia/Kuala_Lumpur # Function declaration ################################################################################ function change_npm_global_dir() { # @url https://docs.npmjs.com/getting-started/fixing-npm-permissions printf "Checking npm global directory...\n" [[ ! -d ~/.npm-global ]] && mkdir -p ~/.npm-global && \ printf " * Created directory %s\n" "~/.npm-global" local result=$( npm config get prefix | grep '.npm-global$' ) [[ "${result}" = "" ]] && npm config set prefix '~/.npm-global' && \ printf " * NPM global directory set to %s\n" `npm config get prefix` local result=$( grep '^export PATH=~/.npm-global/bin:$PATH$' ~/.profile ) [[ "${result}" = "" ]] && ( echo -e '\nexport PATH=~/.npm-global/bin:$PATH' >> ~/.profile ) && \ printf " * NPM global bin path included in PATH variable.\n" printf " * NPM global directory checked and looks fine.\n" } function apt_is_installed() { dpkg -s "${1}" >/dev/null 2>&1 || echo 'nope'; } @@ -79,4 +97,5 @@ function install_rvm() { apt_install_this $wanted_packages && \ check_rvm && \ change_npm_global_dir && \ echo "Wanted packages are checked and installed."; -
justinmoh revised this gist
Apr 25, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,8 @@ wanted_packages="php7.0-intl"; # General ################################################################################ # sudo ln -sf /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime sudo timedatectl set-timezone Asia/Kuala_Lumpur # sudo apt-get update; -
justinmoh revised this gist
Apr 25, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,8 @@ wanted_packages="php7.0-intl"; # General ################################################################################ sudo ln -sf /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime # sudo apt-get update; ################################################################################ -
justinmoh revised this gist
Apr 22, 2016 . 1 changed file with 31 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,15 +16,15 @@ wanted_packages="php7.0-intl"; # Function declaration ################################################################################ function apt_is_installed() { dpkg -s "${1}" >/dev/null 2>&1 || echo 'nope'; } function apt_install_this() { # We could accept multiple inputs, seperated by space. while [[ "${1}" != "" ]]; do local package="${1}"; local result=$(apt_is_installed ${package}); printf "Checking %s...\n" "${package}"; @@ -39,6 +39,31 @@ function install_this() { done } function check_rvm() { local result=$(type rvm >/dev/null 2>&1 || echo 'nope'); printf "Checking %s...\n" "${package}"; if [[ ${result} = 'nope' ]]; then printf "\n"; install_rvm; else printf " * RVM is installed\n"; fi } function install_rvm() { # @url https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma # @url https://rvm.io/rvm/install gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3; curl -sSL https://get.rvm.io | bash -s stable --ruby; source /usr/local/rvm/scripts/rvm; rvm requirements; } ################################################################################ # Main ################################################################################ @@ -49,5 +74,6 @@ function install_this() { # install_this(${wanted_package}); # done apt_install_this $wanted_packages && \ check_rvm && \ echo "Wanted packages are checked and installed."; -
justinmoh created this gist
Apr 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ #!/usr/bin/env bash # If you would like to do some extra provisioning you may # add any commands you wish to this file and they will # be run after the Homestead machine is provisioned. wanted_packages="php7.0-intl"; ################################################################################ # General ################################################################################ # sudo apt-get update; ################################################################################ # Function declaration ################################################################################ function is_installed() { dpkg -s "${1}" >/dev/null 2>&1 || echo 'nope'; } function install_this() { # We could accept multiple inputs, seperated by space. while [[ "${1}" != "" ]]; do package="${1}"; result="$(is_installed ${package})"; printf "Checking %s...\n" "${package}"; if [[ ${result} = 'nope' ]]; then printf "\n"; sudo apt-get install --yes "${package}"; else printf " * %s is installed\n" "${package}"; fi shift done } ################################################################################ # Main ################################################################################ # for wanted_package in ${wanted_packages}; do # echo ${wanted_package} # # install_this(${wanted_package}); # done install_this $wanted_packages && \ echo "Wanted packages are checked and installed.";