Commit 560411da by Adeel

Code: Formats and fixes JSCS warnings.

* Removes unused pacakge `shelljs`.
* Fixes package.json validation issue reported
  by WE2013, based on njs package.json schema:

  > *The value property "repository" must be of
   type "Object", but was "sass/node-sass"*

PR URL: #723.
parent 6a10b922
...@@ -98,11 +98,11 @@ function getEmitter() { ...@@ -98,11 +98,11 @@ function getEmitter() {
} }
}); });
emitter.on('warn', function(data){ emitter.on('warn', function(data) {
console.warn(data); console.warn(data);
}); });
emitter.on('log', function(data){ emitter.on('log', function(data) {
console.log(data); console.log(data);
}); });
......
...@@ -245,7 +245,7 @@ module.exports.renderSync = function(options) { ...@@ -245,7 +245,7 @@ module.exports.renderSync = function(options) {
var status = options.data ? binding.renderSync(options) : binding.renderFileSync(options); var status = options.data ? binding.renderSync(options) : binding.renderFileSync(options);
var result = options.result; var result = options.result;
if(status) { if (status) {
result.stats = endStats(result.stats); result.stats = endStats(result.stats);
return result; return result;
} }
......
...@@ -58,7 +58,7 @@ module.exports = function(options, emitter) { ...@@ -58,7 +58,7 @@ module.exports = function(options, emitter) {
return emitter.emit('error', chalk.red(err)); return emitter.emit('error', chalk.red(err));
} }
fs.writeFile(options.dest, result.css, function (err) { fs.writeFile(options.dest, result.css, function(err) {
if (err) { if (err) {
return emitter.emit('error', chalk.red(err)); return emitter.emit('error', chalk.red(err));
} }
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
"description": "Wrapper around libsass", "description": "Wrapper around libsass",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/sass/node-sass", "homepage": "https://github.com/sass/node-sass",
"repository": "sass/node-sass", "repository": {
"type": "git",
"url": "https://github.com/sass/node-sass"
},
"author": { "author": {
"name": "Andrew Nesbitt", "name": "Andrew Nesbitt",
"email": "andrewnez@gmail.com", "email": "andrewnez@gmail.com",
...@@ -54,8 +57,7 @@ ...@@ -54,8 +57,7 @@
"object-assign": "^2.0.0", "object-assign": "^2.0.0",
"pangyp": "^2.1.0", "pangyp": "^2.1.0",
"request": "^2.53.0", "request": "^2.53.0",
"sass-graph": "^1.0.3", "sass-graph": "^1.0.3"
"shelljs": "^0.3.0"
}, },
"devDependencies": { "devDependencies": {
"coveralls": "^2.11.2", "coveralls": "^2.11.2",
......
...@@ -18,19 +18,19 @@ function afterBuild(options) { ...@@ -18,19 +18,19 @@ function afterBuild(options) {
var target = path.join(__dirname, '..', 'build', folder, 'binding.node'); var target = path.join(__dirname, '..', 'build', folder, 'binding.node');
var install = path.join(__dirname, '..', 'vendor', process.sassBinaryName, 'binding.node'); var install = path.join(__dirname, '..', 'vendor', process.sassBinaryName, 'binding.node');
mkdir(path.join(__dirname, '..', 'vendor', process.sassBinaryName), function (err) { mkdir(path.join(__dirname, '..', 'vendor', process.sassBinaryName), function(err) {
if (err && err.code !== 'EEXIST') { if (err && err.code !== 'EEXIST') {
console.error(err.message); console.error(err.message);
return; return;
} }
fs.stat(target, function (err) { fs.stat(target, function(err) {
if (err) { if (err) {
console.error('Build succeeded but target not found'); console.error('Build succeeded but target not found');
return; return;
} }
fs.rename(target, install, function (err) { fs.rename(target, install, function(err) {
if (err) { if (err) {
console.error(err.message); console.error(err.message);
return; return;
...@@ -110,7 +110,7 @@ function testBinary(options) { ...@@ -110,7 +110,7 @@ function testBinary(options) {
return build(options); return build(options);
} }
fs.stat(path.join(__dirname, '..', 'vendor', process.sassBinaryName, 'binding.node'), function (err) { fs.stat(path.join(__dirname, '..', 'vendor', process.sassBinaryName, 'binding.node'), function(err) {
if (err) { if (err) {
return build(options); return build(options);
} }
......
...@@ -2,7 +2,6 @@ var fs = require('fs'), ...@@ -2,7 +2,6 @@ var fs = require('fs'),
path = require('path'), path = require('path'),
request = require('request'), request = require('request'),
mkdirp = require('mkdirp'), mkdirp = require('mkdirp'),
exec = require('shelljs').exec,
npmconf = require('npmconf'), npmconf = require('npmconf'),
packageInfo = require('../package.json'); packageInfo = require('../package.json');
......
...@@ -430,7 +430,7 @@ describe('api', function() { ...@@ -430,7 +430,7 @@ describe('api', function() {
describe('.renderSync(options)', function() { describe('.renderSync(options)', function() {
it('should compile sass to css with file', function(done) { it('should compile sass to css with file', function(done) {
var expected = read(fixture('simple/expected.css'), 'utf8').trim(); var expected = read(fixture('simple/expected.css'), 'utf8').trim();
var result = sass.renderSync({file: fixture('simple/index.scss')}); var result = sass.renderSync({ file: fixture('simple/index.scss') });
assert.equal(result.css.trim(), expected.replace(/\r\n/g, '\n')); assert.equal(result.css.trim(), expected.replace(/\r\n/g, '\n'));
done(); done();
...@@ -472,7 +472,7 @@ describe('api', function() { ...@@ -472,7 +472,7 @@ describe('api', function() {
it('should compile sass to css with data', function(done) { it('should compile sass to css with data', function(done) {
var src = read(fixture('simple/index.scss'), 'utf8'); var src = read(fixture('simple/index.scss'), 'utf8');
var expected = read(fixture('simple/expected.css'), 'utf8').trim(); var expected = read(fixture('simple/expected.css'), 'utf8').trim();
var result = sass.renderSync({data: src}); var result = sass.renderSync({ data: src });
assert.equal(result.css.trim(), expected.replace(/\r\n/g, '\n')); assert.equal(result.css.trim(), expected.replace(/\r\n/g, '\n'));
done(); done();
...@@ -492,7 +492,7 @@ describe('api', function() { ...@@ -492,7 +492,7 @@ describe('api', function() {
it('should throw error for bad input', function(done) { it('should throw error for bad input', function(done) {
assert.throws(function() { assert.throws(function() {
sass.renderSync({data: '#navbar width 80%;'}); sass.renderSync({ data: '#navbar width 80%;' });
}); });
done(); done();
......
...@@ -118,7 +118,7 @@ describe('cli', function() { ...@@ -118,7 +118,7 @@ describe('cli', function() {
var bin = spawn(cli, [src, '--watch']); var bin = spawn(cli, [src, '--watch']);
var exited; var exited;
bin.on('close', function () { bin.on('close', function() {
exited = true; exited = true;
}); });
...@@ -198,7 +198,7 @@ describe('cli', function() { ...@@ -198,7 +198,7 @@ describe('cli', function() {
var expectedMap = read(fixture('source-map/expected.map'), 'utf8').trim().replace(/\r\n/g, '\n'); var expectedMap = read(fixture('source-map/expected.map'), 'utf8').trim().replace(/\r\n/g, '\n');
var bin = spawn(cli, [src, '--output', path.dirname(destCss), '--source-map', destMap]); var bin = spawn(cli, [src, '--output', path.dirname(destCss), '--source-map', destMap]);
bin.on('close', function () { bin.on('close', function() {
assert.equal(read(destCss, 'utf8').trim(), expectedCss); assert.equal(read(destCss, 'utf8').trim(), expectedCss);
assert.equal(read(destMap, 'utf8').trim(), expectedMap); assert.equal(read(destMap, 'utf8').trim(), expectedMap);
fs.unlinkSync(destMap); fs.unlinkSync(destMap);
...@@ -216,7 +216,7 @@ describe('cli', function() { ...@@ -216,7 +216,7 @@ describe('cli', function() {
'--source-map', map, '--omit-source-map-url' '--source-map', map, '--omit-source-map-url'
]); ]);
bin.on('close', function () { bin.on('close', function() {
assert(read(dest, 'utf8').indexOf('sourceMappingURL') === -1); assert(read(dest, 'utf8').indexOf('sourceMappingURL') === -1);
assert(fs.existsSync(map)); assert(fs.existsSync(map));
fs.unlinkSync(map); fs.unlinkSync(map);
...@@ -257,7 +257,7 @@ describe('cli', function() { ...@@ -257,7 +257,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_file_and_data_cb.js') '--importer', fixture('extras/my_custom_importer_file_and_data_cb.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected); assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest); fs.unlinkSync(dest);
done(); done();
...@@ -270,7 +270,7 @@ describe('cli', function() { ...@@ -270,7 +270,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_file_cb.js') '--importer', fixture('extras/my_custom_importer_file_cb.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
if (fs.existsSync(dest)) { if (fs.existsSync(dest)) {
assert.equal(read(dest, 'utf8').trim(), ''); assert.equal(read(dest, 'utf8').trim(), '');
fs.unlinkSync(dest); fs.unlinkSync(dest);
...@@ -286,7 +286,7 @@ describe('cli', function() { ...@@ -286,7 +286,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_data_cb.js') '--importer', fixture('extras/my_custom_importer_data_cb.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected); assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest); fs.unlinkSync(dest);
done(); done();
...@@ -299,7 +299,7 @@ describe('cli', function() { ...@@ -299,7 +299,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_file_and_data.js') '--importer', fixture('extras/my_custom_importer_file_and_data.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected); assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest); fs.unlinkSync(dest);
done(); done();
...@@ -312,7 +312,7 @@ describe('cli', function() { ...@@ -312,7 +312,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_file.js') '--importer', fixture('extras/my_custom_importer_file.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
if (fs.existsSync(dest)) { if (fs.existsSync(dest)) {
assert.equal(read(dest, 'utf8').trim(), ''); assert.equal(read(dest, 'utf8').trim(), '');
fs.unlinkSync(dest); fs.unlinkSync(dest);
...@@ -328,7 +328,7 @@ describe('cli', function() { ...@@ -328,7 +328,7 @@ describe('cli', function() {
'--importer', fixture('extras/my_custom_importer_data.js') '--importer', fixture('extras/my_custom_importer_data.js')
]); ]);
bin.on('close', function () { bin.on('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected); assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest); fs.unlinkSync(dest);
done(); done();
...@@ -341,7 +341,7 @@ describe('cli', function() { ...@@ -341,7 +341,7 @@ describe('cli', function() {
'--importer', fixture('non/existing/path') '--importer', fixture('non/existing/path')
]); ]);
bin.on('close', function (code) { bin.on('close', function(code) {
assert(code !== 0); assert(code !== 0);
done(); done();
}); });
......
...@@ -6,12 +6,12 @@ var assert = require('assert'), ...@@ -6,12 +6,12 @@ var assert = require('assert'),
sass = require('../lib'), sass = require('../lib'),
util = require('./util'); util = require('./util');
describe('spec', function () { describe('spec', function() {
var suites = util.getSuites(); var suites = util.getSuites();
describe('test/sass-spec directory', function() { describe('test/sass-spec directory', function() {
it('should be a cloned into place', function(done) { it('should be a cloned into place', function(done) {
fs.exists(path.join(__dirname, 'fixtures', 'spec'), function (exists) { fs.exists(path.join(__dirname, 'fixtures', 'spec'), function(exists) {
if (!exists) { if (!exists) {
throw new Error([ throw new Error([
'test/fixtures/spec directory missing. Please clone it into place by', 'test/fixtures/spec directory missing. Please clone it into place by',
...@@ -29,7 +29,7 @@ describe('spec', function () { ...@@ -29,7 +29,7 @@ describe('spec', function () {
Object.keys(suites).forEach(function(suite) { Object.keys(suites).forEach(function(suite) {
var tests = Object.keys(suites[suite]); var tests = Object.keys(suites[suite]);
describe(suite, function () { describe(suite, function() {
tests.forEach(function(test) { tests.forEach(function(test) {
var t = suites[suite][test]; var t = suites[suite][test];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment