Skip to content

Instantly share code, notes, and snippets.

@ijobling
Last active November 8, 2017 11:41
Show Gist options
  • Save ijobling/eea54fd61f0058fd21953e775dde3943 to your computer and use it in GitHub Desktop.
Save ijobling/eea54fd61f0058fd21953e775dde3943 to your computer and use it in GitHub Desktop.
##########################################################################
#### Script to install Ungit in Codio
##########################################################################
#### Instructions
#### Ungit requires Node but Codio Site requires Ruby Stack (https://codio.com/home/stacks/a42c197a-d5e8-4d4b-b5c4-69da95308b13/?tab=details)
#### From the Codio Dashboard, create a new project, importing git repo selecting Ruby stack
#### Open a Terminal window from the Tools->Terminal window
#### Copy the contents of this file to a file called 'ungit.sh' in the root of your machines file system
### Then run the script in the terminal window by typing
### bash ungit.sh
#### End of Instructions
##########################################################################
echo
echo " START OF AUTOMATED INSTALL"
echo
# set the hostname variable
CODIO_HOST=`cat /etc/hostname`
WORKSPACE="$HOME/workspace"
# set colour output = echo -e '\E[1;33;44m'
# remove colour = ; tput sgr0
# See http://www.tldp.org/LDP/abs/html/colorizing.html for colour codes
echo -e '\E[1;33;44m' "Install Ungit"; tput sgr0
sudo npm install -g ungit
# to install specific version (1.1.33 in this example) use sudo npm install -g ungit@"v1.1.33"
echo -e '\E[1;33;44m' "Set up /etc/init/ungit.conf"; tput sgr0
cd /etc/init
sudo touch ungit.conf
sudo chmod 777 ungit.conf
echo '
# testservice - test service job file
description "Ungit"
author "freddy"
# Stanzas
#
# Stanzas control when and how a process is started and stopped See a list of stanzas here:
# http://upstart.ubuntu.com/wiki/Stanzas When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Specify the user account which the service should run under
setuid codio
# Specify working directory
chdir /home/codio/workspace
# Specify the process/command to start, e.g.
exec ungit
'> ungit.conf
echo -e '\E[1;33;44m' "Set up ungitrc.conf"; tput sgr0
cd ~
echo '
{
"bugtracking": false,
"logRESTRequests": false,
"port": 9500
}' > .ungitrc
echo -e '\E[1;33;44m' "Preview - Setup Menu - editing .codio file"; tput sgr0
echo '
{
"commands": {
"PHP Version": "php --version"
},
"preview": {
"Visit Ungit": "https://{{domain}}:9500/#/repository?path=%2Fhome%2Fcodio%2Fworkspace"
}
}' > ~/workspace/.codio
echo -e '\E[1;33;44m' "remove ungit.sh"; tput sgr0
cd ~/workspace
rm ungit.sh
echo -e '\E[1;33;44m' "Start Ungit"; tput sgr0
echo -e '\E[1;33;44m' "Only required post install, ungit.conf will autostart ungit in future"; tput sgr0
ungit --port=9500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment