Skip to content

Instantly share code, notes, and snippets.

@bdunnette
Last active August 29, 2015 14:10
Show Gist options
  • Save bdunnette/c5676407a71206302dbb to your computer and use it in GitHub Desktop.
Save bdunnette/c5676407a71206302dbb to your computer and use it in GitHub Desktop.
Start a basic Couchapp using AngularJS & CornerCouch
#!/bin/bash
couchapp generate $1
cd $1/_attachments
rm -Rf script/ style/
rm index.html
wget https://github.com/angular/angular-seed/archive/master.zip
unzip master.zip
mv angular-seed-master/app/* .
mv angular-seed-master/bower.json ..
rm -Rf master.zip angular-seed-master/
cd ..
rm -Rf vendor/couchapp/
bower_dir="_attachments/bower_components"
echo {\"directory\":\"$bower_dir\"} > .bowerrc
echo $bower_dir > .gitignore
bower uninstall -S html5-boilerplate
bower install
bower install -S bootstrap fontawesome CornerCouch
couchapp generate function validate_doc_update
normalize="html5-boilerplate\/css\/normalize.css"
h5bp="html5-boilerplate\/css\/main.css"
bootstrap="bootstrap\/dist\/css\/bootstrap.css"
fontawesome="fontawesome\/css\/font-awesome.css"
sed "s/$normalize/$bootstrap/g" "_attachments/index.html" | sed "s/$h5bp/$fontawesome/g" | sed "s/<script src=\"app.js\"><\/script>/<script src=\"app.js\"><\/script>\n <script src=\"bower_components\/CornerCouch\/angular-cornercouch.js\"><\/script>/g"> _attachments/index.html.tmp && mv _attachments/index.html.tmp _attachments/index.html
sed "s/'ngRoute'/'ngRoute',\n 'CornerCouch'/g" "_attachments/app.js" | sed "s/}]);/}]).\nrun(function(\$rootScope, cornercouch) {\n\$rootScope.server = cornercouch();\n\$rootScope.server.session();\n});/g" > _attachments/app.js.tmp && mv _attachments/app.js.tmp _attachments/app.js
echo "" >> _attachments/app.js
git init && git add . && git commit -am "initial commit"
couchapp push $1 && couchapp autopush $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment