mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Add jshintrc and fix all CS issues related to it.
This commit is contained in:
@@ -18,10 +18,10 @@ var cache = process.platform === 'win32'
|
||||
|
||||
// Bower Config
|
||||
var config = require('rc') ('bower', {
|
||||
cache : cache,
|
||||
json : 'component.json',
|
||||
endpoint : 'https://bower.herokuapp.com',
|
||||
directory : 'components'
|
||||
cache : cache,
|
||||
json : 'component.json',
|
||||
endpoint : 'https://bower.herokuapp.com',
|
||||
directory : 'components'
|
||||
});
|
||||
|
||||
// If there is a local .bowerrc file, merge it
|
||||
|
||||
@@ -22,7 +22,6 @@ var async = require('async');
|
||||
var path = require('path');
|
||||
var glob = require('glob');
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
|
||||
var fileExists = require('../util/file-exists');
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// ==========================================
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
var _ = require('lodash');
|
||||
var fstream = require('fstream');
|
||||
var mkdirp = require('mkdirp');
|
||||
var events = require('events');
|
||||
@@ -185,12 +184,10 @@ Package.prototype.install = function () {
|
||||
fstream.Reader(this.path)
|
||||
.on('error', this.emit.bind(this, 'error'))
|
||||
.on('end', rimraf.bind(this, this.path, this.cleanUpLocal.bind(this)))
|
||||
.pipe(
|
||||
fstream.Writer({
|
||||
type: 'Directory',
|
||||
path: this.localPath
|
||||
})
|
||||
);
|
||||
.pipe(fstream.Writer({
|
||||
type: 'Directory',
|
||||
path: this.localPath
|
||||
}));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
@@ -221,7 +218,7 @@ Package.prototype.cleanUpLocal = function () {
|
||||
Package.prototype.generateAssetJSON = function () {
|
||||
return {
|
||||
name: this.name,
|
||||
main: this.assetType != '.zip' && this.assetType != '.tar' ? 'index' + this.assetType : '',
|
||||
main: this.assetType !== '.zip' && this.assetType !== '.tar' ? 'index' + this.assetType : '',
|
||||
version: '0.0.0',
|
||||
repository: { type: 'asset', url: this.assetUrl }
|
||||
};
|
||||
@@ -349,7 +346,7 @@ Package.prototype.extract = function () {
|
||||
fs.readdir(this.path, function (err, files) {
|
||||
if (err) return this.emit('error', err);
|
||||
|
||||
if (files.length != 1) return this.emit('extract');
|
||||
if (files.length !== 1) return this.emit('extract');
|
||||
|
||||
var dir = path.join(this.path, files[0]);
|
||||
fs.stat(dir, function (err, stat) {
|
||||
@@ -484,7 +481,7 @@ Package.prototype.cache = function () {
|
||||
}
|
||||
|
||||
mkdirp(this.path, function (err) {
|
||||
if (err) return this.emit('error', ee);
|
||||
if (err) return this.emit('error', err);
|
||||
|
||||
var cp = spawn('git', ['clone', url, this.path]);
|
||||
cp.on('close', function (code) {
|
||||
@@ -553,7 +550,7 @@ Package.prototype.describeTag = function () {
|
||||
});
|
||||
|
||||
cp.on('close', function (code) {
|
||||
if (code == 128) tag = 'unspecified'.grey; // Not a git repo
|
||||
if (code === 128) tag = 'unspecified'.grey; // Not a git repo
|
||||
else if (code) return this.emit('error', new Error('Git status: ' + code));
|
||||
this.emit('describeTag', tag.replace(/\n$/, ''));
|
||||
}.bind(this));
|
||||
@@ -570,7 +567,7 @@ Package.prototype.versions = function () {
|
||||
versions += data;
|
||||
});
|
||||
|
||||
cp.on('close', function (code) {
|
||||
cp.on('close', function () {
|
||||
versions = versions.split('\n');
|
||||
versions = versions.filter(function (ver) {
|
||||
return semver.valid(ver);
|
||||
@@ -653,10 +650,10 @@ Package.prototype.readEndpoint = function (replace) {
|
||||
};
|
||||
|
||||
Package.prototype.waitUnlock = function (name) {
|
||||
if (this.name === name) {
|
||||
this.unitWork.removeListener('unlock', this.waitUnlock);
|
||||
this.resolve();
|
||||
}
|
||||
if (this.name === name) {
|
||||
this.unitWork.removeListener('unlock', this.waitUnlock);
|
||||
this.resolve();
|
||||
}
|
||||
};
|
||||
|
||||
Package.prototype.serialize = function () {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// ==========================================
|
||||
|
||||
var request = require('request');
|
||||
var _ = require('lodash');
|
||||
var config = require('./config');
|
||||
|
||||
var endpoint = config.endpoint + '/packages';
|
||||
@@ -26,7 +25,7 @@ exports.lookup = function (name, callback) {
|
||||
exports.register = function (name, url, callback) {
|
||||
var body = {name: name, url: url};
|
||||
|
||||
request.post({url: endpoint, form: body}, function (err, response, body) {
|
||||
request.post({url: endpoint, form: body}, function (err, response) {
|
||||
if (err) return callback(err);
|
||||
|
||||
if (response.statusCode === 406) {
|
||||
|
||||
Reference in New Issue
Block a user