Permalink
Browse files

Initial Commit

  • Loading branch information...
jalleyne committed Nov 19, 2013
0 parents commit 45777bf6dab153ada1f7732de795cbabaac8cae6
Showing with 1,087 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. 0 Gruntfile.js
  3. +20 −0 LICENSE
  4. +7 −0 Makefile
  5. +25 −0 README.md
  6. +13 −0 STAMP
  7. +35 −0 index.js
  8. +53 −0 lib/common.js
  9. +33 −0 lib/config.js
  10. +50 −0 lib/i18n.js
  11. +66 −0 lib/libqueue.js
  12. +159 −0 lib/module.js
  13. +78 −0 lib/pebble.js
  14. +165 −0 lib/roq.js
  15. +80 −0 lib/router.js
  16. +197 −0 lib/template.js
  17. +56 −0 package.json
  18. +16 −0 test/i18n.js
  19. +2 −0 test/mocha.opts
  20. +29 −0 test/regression.js
@@ -0,0 +1,3 @@
.DS_Store
node_modules/
test_app/
No changes.
20 LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Big Mountain Ideas + Innovations
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
REPORTER = dot
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
.PHONY: test
@@ -0,0 +1,25 @@
roq
===
[![Build Status](https://secure.travis-ci.org/bigmountainideas/roq.png)](http://travis-ci.org/bigmountainideas/roq)
Web application development platform and CMS.
TODO:
===
* Client library dependencies
* Client library optimizations
* Combine localization object with local variables
* LESS compilation
* Client library processing
* Module and template controllers
* Hooks
* Chisel CMS
* Caching
* Async file reads of templates, modules, controllers and models
* Async compiling and execution of templates
* Compiled template caching
13 STAMP
@@ -0,0 +1,13 @@
_ ___
| | _ / __)
____ ___ ____ ____ | | ____ | |_ | |__ ___ ____ ____
/ ___)/ _ \ / _ | | _ \ | | / _ || _) | __)/ _ \ / ___)| \
| | | |_| || | | | | | | || |( ( | || |__ | | | |_| || | | | | |
|_| \___/ \_|| | | ||_/ |_| \_||_| \___)|_| \___/ |_| |_|_|_|
|_| |_|
v %s
----------------------------------------------------------------------------
Welcome, Please wait while your application starts.
----------------------------------------------------------------------------
@@ -0,0 +1,35 @@
/**
_ ___
| | _ / __)
____ ___ ____ ____ | | ____ | |_ | |__ ___ ____ ____
/ ___)/ _ \ / _ | | _ \ | | / _ || _) | __)/ _ \ / ___)| \
| | | |_| || | | | | | | || |( ( | || |__ | | | |_| || | | | | |
|_| \___/ \_|| | | ||_/ |_| \_||_| \___)|_| \___/ |_| |_|_|_|
|_| |_|
**/
/**
* ======== Module dependencies ============ */
var c = require('./lib/common')
, pkg = require('./package.json')
, util = require('util')
, fs = require('fs');
/**
* ======== Log startup messages ============ */
console.log();
console.log( util.format( fs.readFileSync('STAMP', 'utf8'), pkg.version));
/**
* ======== Start main module ============ */
module.exports = require('./lib/roq');
@@ -0,0 +1,53 @@
/** @module common */
/**
* ======== Module dependencies ============ */
var util = require('util');
/**
* ======== Console overrides ============ */
console.error = function(){
console.log('\x1B[31m[ ERROR ]\x1B[39m %s', util.format.apply( this, arguments));
};
console.warn = function(){
console.log('\x1B[33m[ WARN ]\x1B[39m %s', util.format.apply( this, arguments));
};
console.info = function(){
console.log('\x1B[32m[ INFO ]\x1B[39m %s', util.format.apply( this, arguments));
};
console.line = function(){
console.log('');
};
console.section = function(){
console.log('\x1B[22m[ INFO ]\x1B[39m ', '------------------------------------------------------------------------');
};
/**
* ======== Common functions ============ */
var fns = {};
/**
* ======== Export functions ============ */
module.exports = fns;
@@ -0,0 +1,33 @@
var _ = require('underscore');
var baseConfig = {
cache : true,
port : 8709
};
module.exports = {
development : _.extend(baseConfig,{
cache : false
}),
qa : _.extend(baseConfig,{
}),
uat : _.extend(baseConfig,{
}),
'pre-production' : _.extend(baseConfig,{
}),
production : _.extend(baseConfig,{
}),
};
@@ -0,0 +1,50 @@
/** @module i18n translation */
/**
* ======== Module dependencies ============ */
var fs = require('fs')
, path = require('path')
, Polyglot = require('node-polyglot')
;
function loadLocale( dir){
var files = fs.readdirSync(dir)
, phrases = {}
;
for( var i in files){
phrases[
path.basename( files[ i], '.json')
] = JSON.parse(
fs.readFileSync( dir + '/' + files[ i], {
encoding : 'utf-8'
})
);
}
return phrases;
}
var localeDir = global.roq.options.appRoot + '/app/i18n'
, locales = fs.readdirSync( localeDir)
, locale
;
for( var i in locales){
locale = locales[ i];
locales[ locale] = new Polyglot({
phrases : loadLocale( localeDir + '/' + locales[ i]),
locale : locale
});
}
module.exports = locales;
@@ -0,0 +1,66 @@
/** @module router */
/**
* ======== Module dependencies ============ */
var path = require('path')
, util = require('util')
;
var queue = Object.create(null)
, extname = path.extname
, format = util.format
;
queue.types = {
css : function(url){
return format( '<link rel="stylesheet" type="text/css" media="all" href="%s" />', url);
},
js : function(url){
return format( '<script src="%s"></script>', url);
}
};
queue.add = function(queue_name, files){
var queueObj = this.queue || queue;
if( queueObj[ queue_name]){
queueObj[ queue_name].push( files);
}else {
queueObj[ queue_name] = [files];
}
}
queue.process = function(queue_name){
var queueObj = this.queue || queue
, q = queueObj[queue_name]
, output = []
, type;
for( var i in q){
type = extname( q[ i]).substr(1);
if( queue.types[ type]){
output.push( queue.types[ type]( q[ i]))
}
}
return output.join( '\r\n');
};
/**
* ======== Functions ============ */
/**
* ======== Module methods ============ */
queue.create = function(){
var _queue = Object.create(queue);
this.queue = _queue;
return _queue;
};
module.exports = queue;
Oops, something went wrong.

0 comments on commit 45777bf

Please sign in to comment.