Last active
December 15, 2015 13:28
-
-
Save alejandrobernardis/5267148 to your computer and use it in GitHub Desktop.
Alternative to ANT
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
| # Configrautions: | |
| # =============== | |
| .SILENT: help reset env front-dependencies back-dependencies deploy \ | |
| compress compress-html compress-css compress-js \ | |
| coffee coffee-watch less less-watch | |
| .PHONY: help reset env front-dependencies back-dependencies deploy \ | |
| compress compress-html compress-css compress-js \ | |
| coffee coffee-watch less less-watch | |
| downloads=$(CURDIR)/.downloads | |
| deploy=$(CURDIR)/deploy | |
| public=$(CURDIR)/public | |
| static=$(CURDIR)/public/static | |
| vendors=$(CURDIR)/public/static/vendors | |
| node=/usr/local/bin/node | |
| npm=/usr/local/bin/npm | |
| coffeec=$(CURDIR)/node_modules/.bin/coffee | |
| lessc=$(CURDIR)/node_modules/.bin/lessless | |
| lessw=$(CURDIR)/node_modules/.bin/less-monitor | |
| chtml=/Volumes/Amelie/alejandro/development/software/www/htmlcompressor.jar | |
| ccss=/Volumes/Amelie/alejandro/development/software/www/yuicompressor.jar | |
| cjs=/Volumes/Amelie/alejandro/development/software/www/yuicompressor.jar | |
| py=/usr/bin/python | |
| java=/usr/bin/java | |
| done=\n\033[32mDONE!\033[39m\n | |
| hr=\n------------------------------ | |
| # Commands: | |
| # ========= | |
| help: | |
| printf '\n* Usage:' | |
| printf '\n make reset|env|deploy' | |
| printf '\n' | |
| printf '\nDependencies:' | |
| printf '\n - \`front-dependencies\`, \`back-dependencies\`' | |
| printf '\n' | |
| printf '\nCompress [compress (all) or compress-x]:' | |
| printf '\n - \`html\`, \`css\`, \`js\`' | |
| printf '\n' | |
| printf '\nCompilers:' | |
| printf '\n - \`coffee\`, \`less\`' | |
| printf '\n' | |
| printf '\nWatchers:' | |
| printf '\n - \`coffee-watch\`, \`less-watch\`' | |
| printf '\n' | |
| printf '\n' | |
| reset: | |
| rm -fR $(public) $(downloads) $(deploy) $(CURDIR)/node_modules $(CURDIR)/bin | |
| env: reset | |
| make front-dependencies && make back-dependencies | |
| printf '\nCreating environment:$(hr)' | |
| printf '\n* Creating directories...' | |
| printf '\n* Creating files...' | |
| mkdir -p $(public)/data $(static)/{css,img,js} $(CURDIR)/bin | |
| touch $(static)/css/styles.min.css | |
| touch $(static)/js/scripts.min.js | |
| touch $(public)/index.html | |
| printf '$(hr)$(done)' | |
| chown -R amelie:staff $(CURDIR) | |
| open . | |
| front-dependencies: | |
| printf '\nSetting front dependencies:$(hr)' | |
| rm -fR $(downloads) $(vendors) | |
| mkdir -p $(downloads) $(vendors)/{angularjs/i18n,lodash,jquery,require} | |
| printf '\n* Downloading AngularJS...' | |
| curl -s -o $(vendors)/angularjs/angular.min.js http://code.angularjs.org/1.0.5/angular.min.js | |
| curl -s -o $(vendors)/angularjs/angular-bootstrap-prettify.min.js http://code.angularjs.org/1.0.5/angular-bootstrap-prettify.min.js | |
| curl -s -o $(vendors)/angularjs/angular-cookies.min.js http://code.angularjs.org/1.0.5/angular-cookies.min.js | |
| curl -s -o $(vendors)/angularjs/angular-loader.min.js http://code.angularjs.org/1.0.5/angular-loader.min.js | |
| curl -s -o $(vendors)/angularjs/angular-resource.min.js http://code.angularjs.org/1.0.5/angular-resource.min.js | |
| curl -s -o $(vendors)/angularjs/angular-sanitize.min.js http://code.angularjs.org/1.0.5/angular-sanitize.min.js | |
| curl -s -o $(vendors)/angularjs/i18n/angular-locale_en-us.js http://code.angularjs.org/1.0.5/i18n/angular-locale_en-us.js | |
| curl -s -o $(vendors)/angularjs/i18n/angular-locale_es-es.js http://code.angularjs.org/1.0.5/i18n/angular-locale_es-es.js | |
| curl -s -o $(vendors)/angularjs/i18n/angular-locale_es.js http://code.angularjs.org/1.0.5/i18n/angular-locale_es.js | |
| printf '\n* Downloading Lo-Dash...' | |
| curl -s -o $(vendors)/lodash/lodash.underscore.min.js https://raw.github.com/bestiejs/lodash/v1.1.0/dist/lodash.underscore.min.js | |
| printf '\n* Downloading jQuery...' | |
| curl -s -o $(vendors)/jquery/jquery.min.js http://code.jquery.com/jquery-1.9.1.min.js | |
| printf '\n* Downloading Require...' | |
| curl -s -o $(vendors)/require/require.min.js http://requirejs.org/docs/release/2.1.5/minified/require.js | |
| printf '\n* Downloading AUI...' | |
| curl -s -o $(downloads)/aui-flat-pack-5.1-m2.zip https://maven.atlassian.com/content/groups/public/com/atlassian/aui/aui-flat-pack/5.1-m2/aui-flat-pack-5.1-m2.zip | |
| unzip -qo $(downloads)/aui-flat-pack-5.1-m2.zip -d $(downloads) | |
| mv -f $(downloads)/aui/aui $(vendors)/aui | |
| rm -fR $(downloads) | |
| chown -R amelie:staff $(CURDIR) | |
| printf '$(hr)$(done)' | |
| back-dependencies: | |
| printf '\nSetting back dependencies:$(hr)\n' | |
| rm -fR $(CURDIR)/node_modules | |
| $(npm) install | |
| chown -R amelie:staff $(CURDIR) | |
| printf '$(hr)$(done)' | |
| # Tools | |
| # ===== | |
| deploy: coffee less | |
| printf '\nCreating deploy:$(hr)' | |
| printf '\n* Creating directories...' | |
| rm -fR $(deploy) | |
| mkdir -p $(deploy) | |
| printf '\n* Copying files...' | |
| cp -R ./public ./deploy/ | |
| find $(deploy) -type f \( -iname '*.coffee' -or -iname '*.less' \) -exec rm -f {} ';' | |
| printf '$(hr)$(done)' | |
| compress: deploy compress-html compress-css compress-js | |
| compress-html: | |
| printf '\nCompressing HTML:$(hr)' | |
| printf '\n* Processing files...' | |
| find $(deploy) -iname '*.html' -exec $(java) -jar $(chtml) --compress-js --compress-css -t html -o {} {} ';' | |
| printf '$(hr)$(done)' | |
| compress-css: | |
| printf '\nCompressing CSS:$(hr)' | |
| printf '\n* Processing files...' | |
| find $(deploy) -iname '*.css' -exec $(java) -jar $(ccss) -o {} {} ';' | |
| printf '$(hr)$(done)' | |
| compress-js: | |
| printf '\nCompressing JS:$(hr)' | |
| printf '\n* Processing files...' | |
| find $(deploy) -iname '*.js' -exec $(java) -jar $(cjs) -o {} {} ';' | |
| printf '$(hr)$(done)' | |
| coffee: | |
| printf '\nCompiling Coffee Scripts:$(hr)' | |
| printf '\n* Processing files...' | |
| $(coffeec) --compile $(public) | |
| printf '$(hr)$(done)' | |
| coffee-watch: | |
| printf '\nWatching Coffee Scripts:$(hr)\n' | |
| $(coffeec) --watch --compile $(public) | |
| less: | |
| printf '\nCompiling Less:$(hr)' | |
| printf '\n* Processing files...' | |
| $(lessc) --directory $(public) &> /dev/null | |
| printf '$(hr)$(done)' | |
| less-watch: | |
| printf '\nWatching Less:$(hr)\n' | |
| $(node) $(lessw) --directory $(public) |
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
| { | |
| "name": "Requirements", | |
| "version": "1.0.0", | |
| "dependencies": { | |
| "coffee-script": "1.6.2", | |
| "less": "1.3.3", | |
| "lessless": "0.2.15", | |
| "less-monitor": "0.2.0", | |
| "jshint": "1.1.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment