Skip to content

Commit 70024de

Browse files
committed
Merge branch 'generators' of https://github.com/balderdashy/sails into generators
Conflicts: bin/sails-generate.js
2 parents 0db77e1 + 66cd187 commit 70024de

13 files changed

+81
-176
lines changed

.npmignore

+7-17
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,15 @@ ssl
44
.DS_STORE
55
*~
66
.idea
7-
87
nbproject
9-
10-
# Ignore config file w/ sensitive information
11-
config/db.js
12-
13-
# Ignore dev minified/compiled assets
14-
public/stylesheets/_*.css
15-
public/js/_*.js
16-
17-
# Ignore production minified/compiled assets
18-
public/_target/*.js
19-
public/_target/*.css
20-
8+
test
9+
CONTRIBUTING.md
10+
.git
11+
.gitignore
12+
.tmp
2113
*.swo
2214
*.swp
2315
*.swn
2416
*.swm
25-
26-
27-
#Ignore JSHint RC file for NPM
28-
.jshintrc
17+
.jshintrc
18+
.editorconfig

bin/_commander.js

-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ function () {
2525
program.emit('version');
2626
};
2727

28-
2928
module.exports = program;

bin/sails-generate.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ module.exports = function ( ) {
2626
// Get CLI configuration
2727
var config = rc('sails');
2828

29+
2930
// Build initial scope
3031
var scope = {
3132
rootPath: process.cwd(),
32-
sailsPackageJSON: package,
33-
options: {
34-
maxDepth: 5
35-
},
3633
modules: {}
34+
sailsPackageJSON: package
3735
};
3836

3937
// Mix-in rc config
4038
_.merge(scope, config.generators);
4139

40+
// TODO: just do a top-level merge and reference
41+
// `scope.generators.modules` as needed (simpler)
42+
_.merge(scope, config);
43+
44+
4245
var cliArguments = Array.prototype.slice.call(arguments);
4346

4447
// Remove commander's extra argument

bin/sails-lift.js

+24-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
* Module dependencies
66
*/
77

8-
var Sails = require('../lib/app')
9-
, path = require('path')
10-
, captains = require('captains-log');
8+
var package = require('../package.json')
9+
, Sails = require('../lib/app')
10+
, rc = require('rc')
11+
, reportback = require('reportback')()
12+
, _ = require('lodash')
13+
, path = require('path');
1114

1215

1316

@@ -16,29 +19,41 @@ var Sails = require('../lib/app')
1619
*
1720
* Expose method which lifts the appropriate instance of Sails.
1821
* (Fire up the Sails app in our working directory.)
19-
*
20-
* @param {Object} options - to pass to sails.lift()
2122
*/
2223

2324
module.exports = function () {
2425

25-
var config = {};
26-
var log = captains(config.log);
26+
// Get CLI configuration
27+
var config = rc('sails');
28+
29+
30+
// Build initial scope
31+
var scope = {
32+
rootPath: process.cwd(),
33+
sailsPackageJSON: package
34+
};
35+
36+
// Mix-in rc config
37+
_.merge(scope, config.generators);
38+
39+
// TODO: just do a top-level merge and reference
40+
// `scope.generators.modules` as needed (simpler)
41+
_.merge(scope, config);
2742

2843
// Use the app's local Sails in `node_modules` if one exists
2944
var appPath = process.cwd();
3045
var localSailsPath = path.resolve(appPath, '/node_modules/sails', '/lib');
3146

3247
// But first make sure it'll work...
3348
if ( Sails.isLocalSailsValid(localSailsPath, appPath) ) {
34-
require(localSailsPath).lift(options);
49+
require(localSailsPath).lift(scope);
3550
return;
3651
}
3752

3853
// Otherwise, if no workable local Sails exists, run the app
3954
// using the currently running version of Sails. This is
4055
// probably always the global install.
4156
var globalSails = new Sails();
42-
globalSails.lift(options);
57+
globalSails.lift(scope);
4358
return;
4459
};

bin/sails.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*/
77
var _ = require('lodash')
88
, program = require('./_commander')
9-
, package = require('../package.json');
9+
, package = require('../package.json')
10+
, NOOP = function(){};
1011

1112

1213

@@ -70,7 +71,9 @@ program
7071

7172

7273
// $ sails generate <module>
73-
program.command('generate')
74+
var generate = program.command('generate');
75+
generate.unknownOption = NOOP;
76+
generate
7477
.description('')
7578
.option('--dry')
7679
.action(require('./sails-generate'));
@@ -131,6 +134,9 @@ program
131134

132135

133136

137+
// Don't balk at unknown options
138+
program.unknownOption = NOOP;
139+
134140

135141

136142
// $ sails

errors/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
> TODO:
55
> 1. move messages into locales
6-
> 2. Ideally we don't call `process.exit()` at all- instead, consistently call sails.lower(). See comment at bottom of `fatal.js`.
6+
> 2. Ideally we don't call `process.exit()` at all- instead, consistently call sails.lower(). See comment at bottom of `fatal.js`.
7+
> 3. This directory can probably be deleted.

lib/app/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var events = require('events'),
1414
Logger = require('captains-log');
1515

1616
// Build logger using command-line config
17-
var log = new Logger(util.getCLIConfig(argv).log);
17+
var log = Logger(util.getCLIConfig(argv).log);
1818

1919

2020

@@ -52,7 +52,9 @@ function Sails () {
5252
* Enable server-side CoffeeScript support
5353
*/
5454

55-
require('coffee-script');
55+
try {
56+
require('coffee-script');
57+
} catch(e){ log.verbose('Please run `npm install coffee-script` to use coffescript (skipping for now)'); }
5658

5759

5860

lib/app/isLocalSailsValid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
var _ = require('lodash'),
55
argv = require('optimist').argv,
6-
fs = require('fs-extra'),
6+
fs = require('fs'),
77
Err = require('../../errors'),
88
Logger = require('captains-log'),
99
util = require('sails-util');

lib/app/isSailsApp.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
var _ = require('lodash'),
55
argv = require('optimist').argv,
6-
fs = require('fs-extra'),
6+
fs = require('fs'),
77
Err = require('../../errors'),
88
Logger = require('captains-log'),
99
util = require('sails-util');

locales/README.md

-4
This file was deleted.

locales/en.js

-18
This file was deleted.

locales/gettext.js

-76
This file was deleted.

package.json

+27-40
Original file line numberDiff line numberDiff line change
@@ -27,48 +27,37 @@
2727
"directories": {
2828
"lib": "lib"
2929
},
30-
"dependencies": {
30+
"configuredDependencies": {
31+
"connect-redis": "~1.4.5",
32+
"connect-mongo": "~0.3.2"
33+
},
34+
"optionalDependencies": {
3135
"waterline": "git://github.com/balderdashy/waterline.git#v0.10",
3236
"sails-disk": "git://github.com/balderdashy/sails-disk.git#associations",
33-
"sails-util": "~0.10.0",
34-
"captains-log": "~0.11.0",
37+
"socket.io": "~0.9.14",
38+
"connect-flash": "~0.1.1",
39+
"pluralize": "~0.0.5",
40+
"node-uuid": "~1.4.0",
41+
"ejs": "~0.8.4",
42+
"ejs-locals": "~1.0.2",
43+
"glob": "~3.1.14",
44+
"i18n": "~0.4.1"
45+
},
46+
"dependencies": {
3547
"express": "3.4.3",
36-
"socket.io": "0.9.14",
37-
"connect-redis": "1.4.5",
38-
"connect-mongo": "0.3.2",
39-
"async": "0.2.9",
40-
"i18n": "0.4.1",
41-
"lodash": "2.4.1",
42-
"underscore.string": "2.3.0",
43-
"include-all": "0.1.2",
44-
"connect-flash": "0.1.1",
45-
"pluralize": "0.0.5",
46-
"json-stringify-safe": "5.0.0",
47-
"node-uuid": "1.4.0",
48-
"ejs": "0.8.4",
49-
"ejs-locals": "1.0.2",
50-
"grunt": "0.4.1",
51-
"optimist": "0.3.4",
52-
"fs-extra": "0.8.1",
53-
"glob": "3.1.14",
54-
"grunt-cli": "0.1.9",
55-
"sails-generate-gruntfile": "0.10.1",
56-
"grunt-contrib-copy": "0.4.1",
57-
"grunt-contrib-clean": "0.4.1",
58-
"grunt-contrib-concat": "0.3.0",
59-
"grunt-sails-linker": "0.9.5",
60-
"grunt-contrib-jst": "0.5.0",
61-
"grunt-contrib-watch": "0.4.4",
62-
"grunt-contrib-uglify": "0.2.2",
63-
"grunt-contrib-cssmin": "0.6.1",
64-
"grunt-contrib-less": "~0.8.3",
65-
"grunt-contrib-coffee": "0.7.0",
66-
"sails-generate": "0.0.8",
6748
"commander": "~2.1.0",
49+
"rc": "~0.3.3",
50+
"sails-stringfile": "~0.0.0",
51+
"async": "~0.2.9",
52+
"lodash": "~2.4.1",
53+
"include-all": "~0.1.2",
54+
"captains-log": "~0.11.0",
6855
"reportback": "~0.1.4",
69-
"rc": "~0.3.3"
56+
"sails-util": "~0.10.0",
57+
"optimist": "~0.3.4",
58+
"sails-generate": "~0.0.12"
7059
},
71-
"devDependencies": {
60+
"testDependencies": {
7261
"root-require": "~0.2.0",
7362
"checksum": "~0.1.1",
7463
"mocha": "*",
@@ -79,10 +68,8 @@
7968
"colors": "~0.6.2",
8069
"expect.js": "~0.2.0",
8170
"should": "~2.1.1",
82-
"supertest": "~0.8.2"
83-
},
84-
"optionalDependencies": {
85-
"coffee-script": "1.6.2"
71+
"supertest": "~0.8.2",
72+
"fs-extra": "~0.8.1"
8673
},
8774
"repository": {
8875
"type": "git",

0 commit comments

Comments
 (0)