Permalink
Browse files

Relocated skeleton/lib to skeleton/app/properties

This change has been motivated due to the necessity to make
use of standalone libraries not available as npm modules.

The lib/ directory turns out to be a bit misleading when it
comes to the functionality given initially. It has now been
repurposed to store standalone .js files or libraries.

The 'protos lib' command has been removed to avoid confusion.
  • Loading branch information...
1 parent e74f4df commit 8e569c24738973c100e0dbddd4395a84761885e2 @mendezcode mendezcode committed Dec 6, 2012
View
@@ -513,24 +513,6 @@ module.exports = {\n\
}
},
- lib: {
- args: 99,
- validate: validateApp,
- run: function(data) {
-
- var template = ejs.compile("\
-\n\
-/* <%- relPath %> */\n\
-\n\
-module.exports = {\n\
-\n\
-}");
-
- createJsFilesWithTemplate('lib/', data, template);
-
- }
- },
-
ext: {
args: 99,
validate: validateApp,
View
@@ -120,7 +120,6 @@ function Application(domain, path) {
*/
this.paths = {
api: 'api/',
- lib: 'lib/',
layout: '__layout/',
restricted: '__restricted/',
static: '__static/',
@@ -1856,7 +1855,7 @@ function loadModels() {
// Load properties in lib/
function loadPropertiesInLib() {
- var libPath = this.fullPath(this.paths.lib);
+ var libPath = this.mvcpath + 'properties';
if (fs.existsSync(libPath) && fs.statSync(libPath).isDirectory()) {
var files = protos.util.ls(libPath, this.regex.jsFile);
files.forEach(function(file) {
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,4 @@
+
+# Application Libraries
+
+Standalone libraries, required on demand.
View
@@ -320,43 +320,6 @@ this.properties = {\n\n }\n\n}\n\nmodule.exports = PostsModel;';
}).addBatch({
- 'protos lib': {
-
- topic: function() {
- var promise = new EventEmitter();
-
- protos.command('lib filters.js utilities validation misc');
-
- protos.exec(function(err, results) {
- if (!err) {
- var bufs = {};
- ['lib/utilities.js', 'lib/validation.js', 'lib/misc.js'].forEach(function(file) {
- bufs[file] = fs.readFileSync(file, 'utf8');
- });
- }
- results.push(bufs);
- promise.emit('success', err || results);
- });
-
- return promise;
- },
-
- 'Properly creates files in lib/': function(results) {
- var bufs = results.pop();
-
- // Expect proper output in stdout
- assert.equal(results[0], '» Skipping lib/filters.js: file exists\n» Created myapp1/lib/utilities.js\n» Created myapp1/lib/validation.js\n» Created myapp1/lib/misc.js');
-
- // Verify proper code generation
- assert.equal(bufs['lib/utilities.js'], '\n/* lib/utilities.js */\n\nmodule.exports = {\n\n}');
- assert.equal(bufs['lib/validation.js'], '\n/* lib/validation.js */\n\nmodule.exports = {\n\n}');
- assert.equal(bufs['lib/misc.js'], '\n/* lib/misc.js */\n\nmodule.exports = {\n\n}');
- }
-
- }
-
-}).addBatch({
-
'protos exts': {
topic: function() {
View
@@ -144,19 +144,19 @@ vows.describe('lib/application.js').addBatch({
'Directory Structure Tests': {
- 'Properly Loads API methods from api/': function() {
+ 'Properly Loads API methods from app/properties/': function() {
var sampleMethod = app.require('api/sample-method.js');
var otherMethods = app.require('api/other-methods.js');
// This method (anotherMethod) is not added via the api/ directory, instead
- // it is loaded from the lib/ directory. This demonstrates that the lib/
+ // it is loaded from the app/properties/ directory. This demonstrates that the app/properties/
// directory is sourced before the api/ directory.
//
// This is for testing purposes only, it is recommended to add API methods using
// the api/ directory as per the original design.
- var anotherMethod = app.require('lib/api.js');
+ var anotherMethod = app.require('app/properties/api.js');
assert.deepEqual(Object.keys(anotherMethod).sort(), ['anotherMethod']);
assert.deepEqual(Object.keys(sampleMethod).sort(), ['sampleMethod']);
@@ -188,10 +188,10 @@ vows.describe('lib/application.js').addBatch({
assert.equal(app.testMethodTwo(), "Output for app.testMethodTwo");
},
- 'Properly loads & extends objects from lib/': function() {
+ 'Properly loads & extends objects from app/properties/': function() {
// Test filters
- var libFilters = app.require('lib/filters.js');
+ var libFilters = app.require('app/properties/filters.js');
assert.deepEqual(Object.keys(libFilters).sort(), ['testFilterOne', 'testFilterTwo'])
assert.deepEqual(Object.keys(app.filters).sort(), ['testFilterOne', 'testFilterTwo']);
assert.isFunction(app.filters.testFilterOne);
@@ -202,7 +202,7 @@ vows.describe('lib/application.js').addBatch({
assert.equal(app.filters.testFilterTwo(), "Output from app.filters.testFilterTwo");
// Test globals
- var libGlobals = app.require('lib/globals.js');
+ var libGlobals = app.require('app/properties/globals.js');
assert.deepEqual(Object.keys(libGlobals).sort(), ['globalVarOne', 'globalVarTwo'].sort());
assert.strictEqual(app.globals.globalVarOne, libGlobals.globalVarOne);
assert.strictEqual(app.globals.globalVarTwo, libGlobals.globalVarTwo);

0 comments on commit 8e569c2

Please sign in to comment.