Last active
August 29, 2015 14:26
-
-
Save martinhbramwell/37ef52134322340c14a8 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
# | |
# Install prerequisites | |
echo "Did you remember to prefix with sudo?" | |
read _ | |
# -- Get PPAs for Oracle Java 7 and Sublime Text editor -- | |
sudo add-apt-repository -y ppa:webupd8team/java | |
sudo add-apt-repository -y ppa:webupd8team/sublime-text-3 | |
sudo apt-get update | |
# -- Install Oracle Java 7 -- # for Nightwatch | |
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections | |
sudo apt-get -y install oracle-java7-installer | |
sudo tee /etc/apt/apt.conf.d/02proxy > /dev/null <<APTPRXY | |
Acquire::http::Proxy { "http://192.168.122.1:3142"; }; | |
Acquire::http::Proxy { deb.nodesource.com DIRECT; }; | |
APTPRXY | |
sed -i -e 's/XubTahrGolden/pkgtstvid/g' /etc/hosts | |
sed -i -e 's/XubTahrGolden/pkgtstvid/g' /etc/hostname | |
# -- Install Sublime Text editor and linter -- | |
sudo apt-get install -y sublime-text-installer | |
# -- Install other tools -- | |
sudo apt-get install -y build-essential libssl-dev # for selenium webdriver | |
sudo apt-get install -y libappindicator1 # for chrome | |
sudo apt-get install -y curl # for Meteor | |
sudo apt-get install -y tree # for demo convenience | |
sudo apt-get install -y git # for version control | |
pushd /tmp | |
# Install Node.js | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
sudo apt-get install -y nodejs | |
sudo apt-get -y autoremove | |
# Install 'chromedriver' | |
export CHROMEDRIVER_VERSION=$(wget -qO - http://chromedriver.storage.googleapis.com/LATEST_RELEASE) | |
echo "Will install ChromDriver version : ${CHROMEDRIVER_VERSION}" | |
wget http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip | |
sudo unzip -o chromedriver_linux64.zip -d /usr/local/bin | |
sudo chmod a+rx /usr/local/bin/chromedriver | |
# Install 'chrome' | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
sudo dpkg -i google-chrome-stable_current_amd64.deb | |
popd | |
# -- Install “eslint” -- | |
sudo npm install -gy eslint | |
sudo npm install -gy eslint-plugin-react | |
sudo npm install -gy babel-eslint | |
echo "Configure Sublime Text." | |
echo "Find it in accesories, add it to the panel and start it up." | |
echo "-- Install Package Control --" | |
echo "Go to View >> Show Console" | |
echo "Paste into the console the following :" | |
echo " | |
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) | |
" | |
echo "Go to Preferences >> Package Control" | |
echo "In Package Control type : install package" | |
echo "Install these two packages : MarkDownEditing & SideBarEnhancements" | |
echo "In Preferences >> Color Scheme >> Color Scheme - Default, pick 'IDLE' " | |
exit 0; | |
# ############################################# | |
# ############################################# | |
# ############################################# | |
# Install Meteor (separate window) | |
curl https://install.meteor.com/ | sh | |
export PROJECT_NAME="TinyTest4CircleCItmp" | |
export YOUR_NAME="Martin H. J. Bramwell" | |
export YOUR_EMAIL="mhb.warehouseman@gmail.com" | |
echo ${PROJECT_NAME} | |
echo ${YOUR_NAME} | |
echo ${YOUR_EMAIL} | |
## FIRST : | |
echo "Log in to GitHub" | |
echo "If replacing an existing project : " | |
echo " - Log in to CircleCI" | |
echo " - In to CircleCI stop watching ${PROJECT_NAME}" | |
echo " - In GitHub delete ${PROJECT_NAME}" | |
echo "In GitHub create ${PROJECT_NAME}" | |
# -- Configure git -- | |
git config --global user.email "${YOUR_NAME}" | |
git config --global user.name "${YOUR_EMAIL}" | |
git config --global push.default simple | |
# Make a projects directory | |
mkdir -p ~/projects | |
cd ~/projects | |
# Start a Meteor project | |
meteor create ${PROJECT_NAME} | |
cd ${PROJECT_NAME} | |
# Check Meteor can work | |
meteor | |
# Open browser to http://localhost:3000/ | |
# <ctrl-c> | |
# Show the files created by Meteor | |
ls -la | |
cat << LICMIT > LICENSE | |
The MIT License (MIT) | |
Copyright (c) 2015 Warehouseman | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
SOFTWARE. | |
LICMIT | |
cat << GITIG > .gitignore | |
.meteor/local | |
.meteor/meteorite | |
GITIG | |
cat << RDME > README.md | |
# ${PROJECT_NAME} | |
A bare minimum app and package for running TinyTest in CircleCI | |
RDME | |
wget https://raw.githubusercontent.com/airbnb/javascript/master/packages/eslint-config-airbnb/.eslintrc | |
# wget https://raw.githubusercontent.com/meteor/meteor/devel/scripts/admin/eslint/.eslintrc | |
# Start sublime text and go to Preferences >> Package Control | |
# In Package Control type : install package | |
# In the package installer list field type : SublimeLinter | |
# In Package Control type : install package | |
# In the package installer list field type : SublimeLinter-contrib-eslint | |
# Show the new files | |
ls -la | |
git init | |
git add . | |
git commit -m 'First commit' | |
git remote add origin git@github.com:FleetingClouds/${PROJECT_NAME}.git | |
# git remote set-url origin git@github.com:FleetingClouds/${PROJECT_NAME}.git | |
git push -u origin master | |
# Let's ask Meteor to create a skeleton package for us | |
meteor create --package yours:skeleton | |
tree | |
# Ensure TinyTests work | |
meteor test-packages | |
echo "NOW -- Open browser to http://localhost:3000/" | |
echo "<ctrl-c>" | |
echo "For continuous integration we need to have test results on the command line" | |
echo "Open the GitHub page : wget https://raw.githubusercontent.com/warehouseman/meteor-tinytest-runner/master/meteor-tinytest-runner.run" | |
wget https://raw.githubusercontent.com/warehouseman/meteor-tinytest-runner/master/meteor-tinytest-runner.run | |
chmod a+x meteor-tinytest-runner.run | |
# sudo chown -R ${USER}:${USER} ~/.npm | |
./meteor-tinytest-runner.run | |
./tests/tinyTests/test-all.sh | |
mv example_circle.yml circle.yml | |
git add packages | |
git add circle.yml | |
git add tests | |
git commit -m 'Added package and package testing' | |
git push -u origin master | |
echo "Now, go to CircleCI and get it to test our project" | |
# Let's add nightwatch testing | |
echo "Nightwatch tests applications end to end by directly controlling the browser. To install ..." | |
echo "Open the GitHub page : wget https://github.com/warehouseman/meteor-nightwatch-runner/raw/master/meteor-nightwatch-runner.run" | |
wget https://github.com/warehouseman/meteor-nightwatch-runner/raw/master/meteor-nightwatch-runner.run | |
chmod a+x meteor-nightwatch-runner.run | |
# sudo npm install -y --global bunyan | |
./meteor-nightwatch-runner.run | |
meteor & # Running meteor in the background | |
./tests/nightwatch/runTests.js | |
kill -9 $(jobs -p) | |
fg | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment