Script to setup and run lenses app.
- Clone or download/unzip the repo
- Open terminal and go to the repo directory you just created (e.g.
cd ~/Desktop/utility-scripts) - Run
./lenes-setup.sh setup. The clones the UI, installs bower dependencies and runs python SimpleHTTPServer. - Open browser and go to
http://localhost:8008/lenses-freeform/demo.html(orhttp://localhost:8008/lens-compose/demo.htmlfor linear version)
NOTE Script installs the files in HOME_DIR/Documents/lenses. If that directory exists it backs up that directory to lenses.bck. If both exist setup scrips exits without installing. Remove either directory and run the script again.
There are 4 variables on top of lenses-setup.sh:
ROOT=~/Documents
HOME_DIR="$ROOT/lenses"
COMPOSER="lenses-freeform" #lens-composer
GIT_ORG="lenses" #lenses
ROOTis where the lenses direcotry will be created. You can change it to~/Desktopor anything else (~means your home directory)HOME_DIRis the name of directory. Keep the$ROOT/part but you can modifylensesto any other name.COMPOSERis the UI version you want: uselenses-freeformfor the freeform version orlens-composerfor linear.GIT_ORG(Advanced) is the github user/organization which has the composer code. If you forklenses-freeformorlens-composeryou can change that to your github account.
lenses-setup.sh run-serverruns python server. If you have lenses setup but just want to run http server use this (similar topython -m SimpleHTTPServer 8008)lenses-setup.sh kill-serverShuts down the server.lenses-setup.sh updateupdates your code base. IMPORTANT NOTE If you have modified the code of UI or one of the already existing components runing update scripts overwrites your changes. If you have only created a new component in a new directory inlensesfolder it will be safe.
- If by running
./lenses-setup.sh setupyou getPermission deniederror trychmod u+x lenses-setup.shto give execute permission to script. You might need to dosudo chmod u+x lenses-setup.shif former command didn't work (though it is a red flag that there is a problem on your computer setup)
For any other problems please file an issue
- Runs git status on every component directory (e.g. lens-*). Run inside development (e.g. lenses) directory
For Lenses:
find . -name 'lens*' -type d -depth 1 -exec sh -c 'echo "\n \x1B[0;33m CHECKING STATUS IN {} \x1B[0m \n"' \; -exec git -C {} status \;
For Thelma:
find . -name 'th-*' -type d -depth 1 -exec sh -c 'echo "\n \x1B[0;33m CHECKING STATUS IN {} \x1B[0m \n"' \; -exec git -C {} status \;
- Replace all lens-* bower directories with git directories. This script is meant to be run once after bower installing all the componets. (USE WITH CAUTION! It removes the existing lens-* directories)
curl -u [USERNAME] -s https://api.github.com/orgs/lenses/repos?per_page=100 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo|
exclude_repos = ["thelmacheer", "th-footnote","th-line-graph","th-multistep", "th-two-column","thelma-charts", "thelma", "thelma-component-demo", "thelma-components", "thelma-core", "thelma-data", "thelma-utils", "thelma-text", "thelmanews.github.io"]
%x[rm -rf #{repo["name"]}]
unless exclude_repos.include?(repo["name"])
%x[git clone #{repo["ssh_url"]} ]
end
}'
- Clone all lenses repos:
curl -s https://api.github.com/orgs/lenses/repos?per_page=100 | grep ssh_url | grep lens- | sed s/\"ssh_url\"\://g | sed s/\"//g | sed s/,//g | xargs -I {} -n 1 git clone {}