Permalink
Browse files

pretty post-install message to make sure you have mongodb/etc. instal…

…led, and basic app creation commands
  • Loading branch information...
1 parent de4700b commit 6f9ca61fbd3b6d020f479ad4a17a6b83a2dcbf07 @lancejpollard lancejpollard committed Oct 5, 2012
Showing with 327 additions and 108 deletions.
  1. +6 −15 Makefile
  2. +1 −1 README.md
  3. +0 −90 bin/dependencies
  4. +287 −0 bin/install
  5. +31 −0 bin/tower.css
  6. +2 −2 package.json
View
@@ -16,7 +16,7 @@ NODE_VERSION_LT_6 = $(shell node -e "console.log(process.version < 'v0.6.0')")
PATH_SEP = $(shell node -e "console.log(require('path').sep)")
# darwin (mac), linux, win32 (windows)
OS = $(shell node -e "console.log(process.platform)")
-DEPENDENCIES = bin$(PATH_SEP)dependencies
+INSTALL = bin$(PATH_SEP)install
ifeq (win32,$(OS))
# Windows:
@@ -27,21 +27,12 @@ else
endif
install-dependencies:
- $(shell $(DEPENDENCIES))
+ @$(shell $(INSTALL) dependencies)
-check-node-version:
-ifeq ($(NODE_VERSION_LT_8),true)
- @echo ""
-ifeq ($(NODE_VERSION_LT_6),true)
- @echo "> You're using an unsupported version of node ($(NODE_VERSION))."
-else
- @echo "> You're using an outdated version of node ($(NODE_VERSION))."
-endif
- @echo "> Please upgrade to the latest version node >= v0.8.2."
- @echo ""
-endif
+install-message:
+ @$(INSTALL) message
-post-install: install-dependencies check-node-version
+post-install: install-dependencies install-message
all: clean
$(GRUNT) --config $(RUN)grunt.coffee
@@ -178,4 +169,4 @@ define get-processes
$(shell ps -ef | grep -e '$(1)' | grep -v grep)
endef
-.PHONY: all test-memory test-mongodb test test-all test-client build dist check-phantomjs check-grunt check-forever build-test-client start-test-client post-install check-node-version
+.PHONY: all test-memory test-mongodb test test-all test-client build dist check-phantomjs check-grunt check-forever build-test-client start-test-client post-install
View
@@ -9,8 +9,8 @@ Built on top of Node's Connect and Express, modeled after Ruby on Rails. Built
Follow me [@viatropos](http://twitter.com/viatropos).
- **IRC**: #towerjs on irc.freenode.net
-- **Ask a question**: http://stackoverflow.com/questions/tagged/towerjs
- **Issues**: https://github.com/viatropos/tower/issues
+- **Ask a question**: http://stackoverflow.com/questions/tagged/towerjs
- **Roadmap**: https://github.com/viatropos/tower/blob/master/ROADMAP.md
- **Latest Docs**: https://github.com/viatropos/tower/wiki
View
@@ -1,90 +0,0 @@
-#!/usr/bin/env node
-
-// process.env.NODE_PATH.split(':'), process.config.variables.node_prefix
-// global npm on windows: C:\Program Files (x86)\nodejs\node_modules\
-// global node on windows: process.execPath == C:\Program Files (x86)\nodejs\node.exe
-// if process.cwd().match(dirname(process.execPath)) then maybe assume it's npm install -g
-var fs = require('fs');
-var path = require('path');
-var os = require('os');
-
-// @todo normalize install/global directories in a more robust way, for comparison.
-function normalize(directory) {
- return directory.split(path.sep).slice(0, 3).join(path.sep);
-}
-
-function uniq(array) {
- return Object.keys(arrayToHash(array));
-};
-
-function arrayToHash(array) {
- var hash = {};
-
- array.forEach(function(item) {
- if (!hash[item]) {
- hash[item] = true;
- }
- });
-
- return hash;
-}
-
-// Old code, but maybe useful later.
-//
-// '/usr/local/lib/node_modules/tower' => '/usr/local'
-// 'C:\Program Files (x86)\nodejs\node_modules\tower' => 'C:\Program Files (x86)\nodejs'
-//var installDirectory = normalize(process.cwd());
-// '/usr/local/Cellar/node/0.8.2/bin'
-//var globalDirectory = normalize(path.dirname(process.execPath));
-//var isGlobal = installDirectory === globalDirectory;
-
-// this lets us know if we ran `npm install` vs. `npm link tower`, etc.
-// the ORIGINAL npm command args
-var npmArgs;
-if (process.env.npm_config_argv) {
- npmArgs = JSON.parse(process.env.npm_config_argv).original;
-} else {
- npmArgs = [];
-}
-var npmOptions = arrayToHash(npmArgs);
-var isGlobal = !!(npmOptions['-g'] || npmOptions['--global']);
-var isGlobalLink = !!(npmArgs[0] == 'link' && npmArgs.length == 1);
-var isLocalLink = !!(npmArgs[0] == 'link' && npmArgs.length > 1 && npmArgs[0].charAt(0) != '-');
-var isRemote = !!npmArgs.join(' ').match('git://')
-
-var packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
-var dependencies = [];
-
-var testDependencies = Object.keys(packageJSON['testDependencies']);
-var globalDependencies = Object.keys(packageJSON['globalDependencies']);
-var localDependencies = Object.keys(packageJSON['localDependencies']);
-
-// if you're linking to local app on mac/linux, assuming you have built the project,
-// copy the new tower project.
-//if (isLocalLink && os.platform().match(/darwin|linux/)) {
-// process.stdout.write('rm vendor/javascripts/tower.js');
-// process.stdout.write('cp ' + path.join(__dirname, '../dist/tower.js') + ' vendor/javascripts/tower.js');
-//}
-
-// if it's installed from the git repo, install everything.
-if (!isLocalLink && !isGlobalLink && fs.existsSync('.gitignore')) {
- dependencies = dependencies.concat(testDependencies).concat(globalDependencies).concat(localDependencies);
-} else {
- if (isGlobal || isGlobalLink) {
- // if you're installing it globally, only include bare minimum.
- dependencies = dependencies.concat(globalDependencies);
- } else if (isLocalLink) {
- // otherwise install like normal.
- dependencies = dependencies.concat(localDependencies);
- }
- // if installing from github, you'll have to compile the source.
- if (isRemote) {
- dependencies.push('coffee-script@>=1.3.3');
- }
-}
-
-if (dependencies && dependencies.length) {
- process.stdout.write('npm install ' + uniq(dependencies).join(' '));
-} else {
- // console.log('linked to local');
-}
Oops, something went wrong.

0 comments on commit 6f9ca61

Please sign in to comment.