Skip to content

Instantly share code, notes, and snippets.

@martinhbramwell
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinhbramwell/43971112afba7132059d to your computer and use it in GitHub Desktop.
Save martinhbramwell/43971112afba7132059d to your computer and use it in GitHub Desktop.
Meteor Package Test Video Script
# Install prerequisites
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
# -- 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 --
sudo apt-get install -y oracle-java7-installer # for starrynight
# -- Install Sublime Text editor and linter --
sudo apt-get install -y sublime-text-installer
# -- Install and configure git --
sudo apt-get install -y git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global push.default simple
# -- Install other tools --
sudo apt-get install -y gksu # often useful
sudo apt-get install -y ssh # for Git
sudo apt-get install -y build-essential libssl-dev # for nvm
sudo apt-get install -y curl # for Meteor
# Prepare SSH
mkdir -p .ssh
chmod 700 .ssh
pushd .ssh
touch authorized_keys # Edit to add allowed connections
touch id_rsa # Edit to add private key
touch id_rsa.pub # Edit to add public key
chmod 600 authorized_keys
chmod 600 id_rsa
chmod 644 id_rsa.pub
popd
# Obtain Starrynight
mkdir -p ~/projects
cd ~/projects
# git clone git@github.com:awatson1978/starrynight.git
git clone git@github.com:warehouseman/starrynight.git
# Install Node Version Manager (nvm). . .DON’T
# git clone https://github.com/creationix/nvm.git ~/.nvm
# pushd ~/.nvm
# git checkout `git describe --abbrev=0 --tags`
# popd
# #
# # . . . and ensure it is runnable
# echo "" >> ~/.bashrc
# echo "#" >> ~/.bashrc
# echo "# nvm set up" >> ~/.bashrc
# echo ". ~/.nvm/nvm.sh" >> ~/.bashrc
# source ~/.bashrc
# nvm --version # verify
#
# Use nvm to install Node.js
# nvm ls-remote # what versions are there ?
# echo "export LATEST_NODE=0.12.7" >> ~/.bashrc
# source ~/.bashrc
# nvm install ${LATEST_NODE}
# echo ‘nvm alias default ${LATEST_NODE}’ >> ~/.bashrc
# source ~/.bashrc
# node --version # verify
#
# Install Node.js
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
# Install Sublime Text and esLint
# -- Install “eslint” --
sudo npm install -gy eslint
sudo npm install -gy eslint-plugin-react
#
# Find Sublime Text in “Start Menu” >> “Development”
# Secondary click and add to panel
#
# -- Install Package Control --
# Start sublime text and go to View >> Show Console
# Paste into the console the following
: “
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)
#
# -- Install SublimeLinter --
# 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
# In Package Control type : install package
# In the package installer list field type : MarkDownEditing
# In Package Control type : install package
# In the package installer list field type : SideBarEnhancements
# In Preferences >> Color Scheme >> Color Scheme - Default, pick 'IDLE'
# Install Meteor
curl https://install.meteor.com/ | sh
#
# Install Starrynight
cd ~/projects
sudo npm install ./starrynight -g
cd starrynight/website
meteor --port=8080
# Now open http://localhost:8080/ in a browser to view the documentation
# Prepare an empty Meteor application
mkdir -p ~/projects
cd ~/projects
meteor create helloworld
cd helloworld
meteor
#
# Prepare an empty GitHub project
# Log into https://github.com/warehouseman
# Click the big green “+ New repository” button, then :
# - Repository name - “helloworld_01”
# - Description - “A temporary repo while preparing a demo video”
# - Check → “Initialize this repository with a README”
# - Choose a .gitignore for Meteor
# - Choose MIT license (same as for Meteor)
# - Click the big green “Create repository” button
# Select the SSH clone string in bottom right corner, eg; git@github.com:yourself/helloworld_01.git
cd ~/projects
git clone git@github.com:yourself/helloworld_01.git
#
# Merge the Meteor project and the GitHub project
# Merge the Meteor created project into the GitHub created project
mv helloworld/* helloworld_01
mv helloworld/.meteor helloworld_01
# Get rid of the empty Meteor directory
rm -fr helloworld
# Rename the GitHub created directory
mv helloworld_01 helloworld
cd helloworld
#
# Test the Meteor project
# Type “meteor” and then open http://localhost:3000/ in a local browser.
meteor
# <ctrl>-c
#
# Commit changes
git pull # Already up to date
git add .meteor # Initial meteor config
git commit -a
git push
#
# Open the project in Sublime Text
# In Sublime Text go to File >> Open Folder and then open ~/projects/helloworld
#
#
# Follow Starrynight examples
starrynight generate-autoconfig
#
# #############################################
# #############################################
# #############################################
# #############################################
#
echo "add 3Gb"
echo "qemuFixedIP"
sudo apt-get -y remove mousepad
sudo nano /etc/hosts # pkgtstvid
sudo nano /etc/hostname
# Obligatory REBOOT
sudo apt-get install -y gksu # often useful
sudo apt-get install -y ssh # for Git
s
# Prepare SSH
mkdir -p .ssh
chmod 700 .ssh
pushd .ssh
touch authorized_keys # Edit to add allowed connections
touch id_rsa # Edit to add private key
touch id_rsa.pub # Edit to add public key
chmod 600 authorized_keys
chmod 600 id_rsa
chmod 644 id_rsa.pub
popd
# -- Install Sublime Text editor and linter --
sudo add-apt-repository -y ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install -y sublime-text-installer
# Find Sublime Text in “Start Menu” >> “Development”
# Secondary click and add to panel
#
# -- Install Package Control --
# Start sublime text and go to View >> Show Console
# Paste into the console the following
: “
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)
#
# -- Install SublimeLinter --
# Start sublime text and go to Preferences >> Package Control
# In Package Control type : install package
# In the package installer list field type : MarkDownEditing
# In Package Control type : install package
# In the package installer list field type : SideBarEnhancements
# In Package Control type : install package
# In the package installer list field type :
# In Package Control type : install package
# In the package installer list field type :
# In Package Control type : install package
# In the package installer list field type :
# In Package Control type : install package
# In the package installer list field type :
# In Preferences >> Color Scheme >> Color Scheme - Default, pick 'IDLE'
# #############################################
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}"
## THEN ....
# -- Get PPAs for Oracle Java 7 and Sublime Text editor --
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
# -- Install other tools --
sudo apt-get install -y build-essential libssl-dev # for nvm
sudo apt-get install -y libappindicator1 # for chrome
sudo apt-get install -y curl # for Meteor
# -- Install and configure git --
sudo apt-get install -y git
git config --global user.email "${YOUR_NAME}"
git config --global user.name "${YOUR_EMAIL}"
git config --global push.default simple
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
# 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
# -- Install Oracle Java 7 --
sudo apt-get install -y oracle-java7-installer # for selenium
# Install 'selenium-webdriver'
# sudo npm install -y selenium-webdriver
# Install Meteor
curl https://install.meteor.com/ | sh
# Make a projects directory
mkdir -p ~/projects
if [[ "you want to work on starrynight" ]]; then
pushd ~/projects
# git clone git@github.com:awatson1978/starrynight.git
git clone git@github.com:warehouseman/starrynight.git
pushd starrynight
git checkout develop
git remote -v
git remote add upstream git@github.com:awatson1978/starrynight.git
git remote -v
git fetch upstream
git checkout develop
git merge upstream/develop
sudo npm install ../starrynight -g
sudo npm link
pushd website
meteor --port=8080 &
echo "Go to http://localhost:8080/"
popd
popd
popd
else;
sudo npm install starrynight -g
fi;
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
# 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
wget https://github.com/tozd/meteor-test-runner/archive/master.zip
unzip master.zip
rm master.zip
mv meteor-test-runner-master/ tests # This initiales out test directory.
mv tests/configs/circle.yml . # Put this preliminary circle.yml in the project root
rm -fr tests/configs/
echo "Now edit tests/test-package.sh an replace . . . "
echo " meteor test-packages "
echo " . . . with . . . "
echo " ~/.meteor/meteor test-packages "
meteor create --package my:mnml
# Ensure TinyTests work
meteor test-packages
# Open browser to http://localhost:3000/
# <ctrl-c>
./tests/test-all.sh
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 or project"
# This instead of installing starrynight
npm link starrynight
# Now add nightwatch testing
starrynight generate-autoconfig --mnml
starrynight scaffold --framework nightwatch-minimal
starrynight run-tests --framework nightwatch
# *******************************************
# This is the configuration file for continuous integration of
# your project in CircleCi.
#
# The full reference is available at :
# https://circleci.com/docs/configuration
#
machine:
node:
# Cannot be certain that this build wlll work with all future versions: so specify.
version: 0.10.33
dependencies:
# Whatever is written to these directories during one build will be
# restored verbatim on every future build.
cache_directories:
- ~/.meteor
- ~/node_modules
# Dependencies of the build run before CircleCI's inferred commands
pre:
- mkdir -p ~/.meteor
# If Meteor is already cached, do not need to build it again.
- if [ ! -e ~/.meteor/meteor ]; then curl https://install.meteor.com | /bin/sh; fi
- npm install -g starrynight
# Dependencies of the build that replace CircleCI's inferred commands
override:
- mkdir -p ~/node_modules
# If WebDriver is already cached, do not need to build it again.
- if [ ! -d ~/node_modules/selenium-webdriver/ ]; then npm install --prefix ~ selenium-webdriver; else echo "Selenium Webdriver seems to be cached"; fi;
# Have symlink to a cached directory
- ln -s ~/node_modules node_modules
test:
# Test that replace CircleCI's inferred tests
override:
# Run the TinyTest tests of your Meteor app
# Note -- tests/test-all comes from this project:
# https://github.com/tozd/meteor-test-runner
- tests/test-all.sh
# Starrynight tests require a running copy of a Meteor app
# so start it up and push it into the background
- ~/.meteor/meteor:
background: true
# Run the Nightwatch tests of your Meteor app
- starrynight run-tests --framework nightwatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment