Created
February 27, 2012 22:34
-
-
Save k33g/1927612 to your computer and use it in GitHub Desktop.
Lazy.Coder Shell Script : create express.js app with dependencies
This file contains hidden or 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/sh | |
#chmod a+x lazy.coder.sh | |
#parameter : application name : ./lazy.coder.sh <application_name> | |
#Libs | |
#Gimme names | |
LIB1=jquery | |
LIB2=underscore.js | |
LIB3=backbone.js | |
LIB4=tempo | |
LIB5=speculoos | |
#files names | |
RLIB1=jquery.min.js | |
RLIB2=underscore-min.js | |
RLIB3=backbone-min.js | |
RLIB4=tempo.js | |
RLIB5=speculoos.js | |
#création de l'application $1 (express) | |
express $1 | |
#installation des libs client | |
gimme install $LIB1 $LIB2 $LIB3 $LIB4 $LIB5 -o ./$1/public/javascripts | |
#installation twitter bootstrap | |
curl http://twitter.github.com/bootstrap/assets/bootstrap.zip -o bootstrap.zip | |
unzip bootstrap.zip | |
cp -r bootstrap/css/* $1/public/stylesheets | |
cp -r bootstrap/img/* $1/public/images | |
cp -r bootstrap/js/* $1/public/javascripts | |
rm -r bootstrap.zip bootstrap | |
echo '<html>' > $1/public/index.html | |
echo ' <head>' >> $1/public/index.html | |
echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' >> $1/public/index.html | |
echo ' <link href="stylesheets/bootstrap.css" rel="stylesheet" type="text/css">' >> $1/public/index.html | |
echo ' <link href="stylesheets/bootstrap-responsive.css" rel="stylesheet" type="text/css">' >> $1/public/index.html | |
echo ' <link href="stylesheets/style.css" rel="stylesheet" type="text/css">' >> $1/public/index.html | |
echo ' </head>' >> $1/public/index.html | |
echo ' <body>' >> $1/public/index.html | |
echo ' <div class="hero-unit" style="padding-top:15px; padding-bottom:15px;">' >> $1/public/index.html | |
echo ' <h1>Lazy.Coder</h1>' >> $1/public/index.html | |
echo ' </div>' >> $1/public/index.html | |
echo ' </body>' >> $1/public/index.html | |
echo ' <script src="javascripts/'$RLIB1'"></script>' >> $1/public/index.html | |
echo ' <script src="javascripts/'$RLIB2'"></script>' >> $1/public/index.html | |
echo ' <script src="javascripts/'$RLIB3'"></script>' >> $1/public/index.html | |
echo ' <script src="javascripts/'$RLIB4'"></script>' >> $1/public/index.html | |
echo ' <script src="javascripts/'$RLIB5'"></script>' >> $1/public/index.html | |
echo ' <script src="javascripts/bootstrap.js"></script>' >> $1/public/index.html | |
echo ' <script>' >> $1/public/index.html | |
echo ' $(document).ready(function() { ' >> $1/public/index.html | |
echo ' ' >> $1/public/index.html | |
echo ' console.log("Lazy.Coder ...");' >> $1/public/index.html | |
echo ' ' >> $1/public/index.html | |
echo ' });' >> $1/public/index.html | |
echo ' </script>' >> $1/public/index.html | |
echo '</html>' >> $1/public/index.html | |
#Express views | |
echo '<html>' > $1/views/layout.ejs | |
echo ' <head>' >> $1/views/layout.ejs | |
echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' >> $1/views/layout.ejs | |
echo ' <link href="stylesheets/bootstrap.css" rel="stylesheet" type="text/css">' >> $1/views/layout.ejs | |
echo ' <link href="stylesheets/bootstrap-responsive.css" rel="stylesheet" type="text/css">' >> $1/views/layout.ejs | |
echo ' <link href="stylesheets/style.css" rel="stylesheet" type="text/css">' >> $1/views/layout.ejs | |
echo ' </head>' >> $1/views/layout.ejs | |
echo ' <%- body %>' >> $1/views/layout.ejs | |
echo '</html>' >> $1/views/layout.ejs | |
echo '<div class="hero-unit" style="padding-top:15px; padding-bottom:15px;">' > $1/views/index.ejs | |
echo ' <h1><%= title %></h1>' >> $1/views/index.ejs | |
echo '</div>' >> $1/views/index.ejs | |
echo '<script src="javascripts/'$RLIB1'"></script>' >> $1/views/index.ejs | |
echo '<script src="javascripts/'$RLIB2'"></script>' >> $1/views/index.ejs | |
echo '<script src="javascripts/'$RLIB3'"></script>' >> $1/views/index.ejs | |
echo '<script src="javascripts/'$RLIB4'"></script>' >> $1/views/index.ejs | |
echo '<script src="javascripts/'$RLIB5'"></script>' >> $1/views/index.ejs | |
echo '<script src="javascripts/bootstrap.js"></script>' >> $1/views/index.ejs | |
echo '<script>' >> $1/views/index.ejs | |
echo ' $(document).ready(function() { ' >> $1/views/index.ejs | |
echo ' ' >> $1/views/index.ejs | |
echo ' console.log("Lazy.Coder ...");' >> $1/views/index.ejs | |
echo ' ' >> $1/views/index.ejs | |
echo ' });' >> $1/views/index.ejs | |
echo '</script>' >> $1/views/index.ejs | |
#Express routes | |
echo '/*--- Home ---*/' > $1/routes/index.js | |
echo '' > $1/routes/index.js | |
echo 'exports.index = function(req, res){' >> $1/routes/index.js | |
echo ' res.render("index.ejs", { title : "Lazy.Coder …" });' >> $1/routes/index.js | |
echo '};' >> $1/routes/index.js | |
#mise à jour des dépendances | |
cd $1 | |
npm install -d | |
#installation de ejs / templating côté serveur | |
npm install ejs | |
#installation de everyauth | |
npm install everyauth | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍