Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Escalante
committed
Sep 18, 2012
0 parents
commit 5b3b935
Showing
9 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.DS_Store |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log 'hello world' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var colors = require('colors'); | ||
var watch = require('watch'); | ||
var coffeescript = require('../lib/compilers/coffee'); | ||
|
||
var current_directory = path.normalize(process.cwd()); | ||
var dir_contents = fs.readdirSync(current_directory); | ||
var get_files = function(dir){ return fs.readdirSync(path.join(current_directory, dir)); } | ||
|
||
// make sure this is a roots project | ||
|
||
if (dir_contents.indexOf('app.coffee') > 0) { | ||
// console.log('we have a legit app'.green); | ||
} else { | ||
// console.log('looks like youre missing the app.js file, try running roots new `name` to create a new project'.red); | ||
} | ||
|
||
// compile all the things! | ||
coffeescript.compile(get_files('assets/js')); | ||
|
||
// serve to public and open the browser | ||
|
||
// create a watch task that does this on file change | ||
|
||
// create a websockets server to interact with livereload and push changes live |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var coffee = require('coffee-script'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var helpers = require('../helpers'); | ||
var current_directory = path.normalize(process.cwd()); | ||
|
||
exports.compile = function(files){ | ||
files.forEach(function(file, index){ | ||
|
||
// get all the info we need for the paths | ||
var dir = path.normalize(path.dirname(file)); | ||
var basename = path.normalize(path.basename(file, '.coffee')); | ||
var file_contents = fs.readFileSync(path.join(current_directory, '/assets/js', file), 'utf8'); | ||
var compiled_path = path.join(current_directory, 'public/js', dir, (basename + '.js')); | ||
var compiled_js = coffee.compile(file_contents); | ||
|
||
// create directories if needed | ||
helpers.mkdirp(path.join(current_directory, 'public/js', dir), '0777', function(){ | ||
fs.writeFileSync(compiled_path, compiled_js); // then write the file | ||
}); | ||
|
||
}); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// mkdir -p | ||
// http://lmws.net/making-directory-along-with-missing-parents-in-node-js | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
exports.mkdirp = function(dirPath, mode, callback) { | ||
var self = this; | ||
fs.mkdir(dirPath, mode, function(error) { | ||
if (error && error.errno === 34) { | ||
self.mkdirp(path.dirname(dirPath), mode, callback); | ||
self.mkdirp(dirPath, mode, callback); | ||
} else { | ||
callback(); | ||
} | ||
}); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// config | ||
var port = 3000; | ||
|
||
var connect = require('connect'); | ||
var colors = require('colors'); | ||
var open = require('open'); | ||
// might want to add supervisor for view reloads | ||
|
||
var app = connect() | ||
.use(connect.logger('dev')) | ||
.use(connect.static('/Users/jeffescalante/Desktop/public')); | ||
|
||
console.log(('\nserver started on port ' + port + '\n').green); | ||
app.listen(port); | ||
open('http://localhost:' + port); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "roots", | ||
"version": "1.0.0", | ||
"description": "Roots is where it all begins", | ||
"keywords": [ | ||
"front-end", | ||
"development", | ||
"css", | ||
"build", | ||
"library", | ||
"tool" | ||
], | ||
"homepage": "http://roots.carrotbeta.com", | ||
"bugs": "https://github.com/roots/roots-static/issues", | ||
"author": "Jeff Escalante", | ||
"main": "./roots", | ||
"bin": { | ||
"roots": "./bin/roots" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/carrot/roots-static.git" | ||
}, | ||
"scripts": { | ||
"uninstall": "rm -rf ~/.roots" | ||
}, | ||
"dependencies": { | ||
"connect": "latest", | ||
"colors": "latest", | ||
"open": "latest", | ||
"coffee-script": "~1.3.3", | ||
"watch": "~0.5.1" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.0" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function() { | ||
|
||
console.log('hello world'); | ||
|
||
}).call(this); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Roots CLI | ||
|
||
This is the beginnings of a really fantastic command line build tool. Super super alpha, don't even think about attempting to install this. | ||
|
||
The assets folder is temporary, just used for example files and convenience during development. |