Skip to content

Commit

Permalink
Merge pull request #105 from havenchyk/master
Browse files Browse the repository at this point in the history
Updated linting rules
  • Loading branch information
stefanjudis committed Dec 22, 2015
2 parents 1e8db59 + c7a242b commit 4c43c35
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"key-spacing": [ 2, { "align": "colon", "beforeColon": true, "afterColon": true } ],
"object-curly-spacing": [ 2, "always" ],
"array-bracket-spacing": [ 2, "always" ],
"space-in-parens": [ 2, "always" ]
"space-in-parens": [ 2, "always" ],
"no-mixed-spaces-and-tabs": 1,
"max-len": [1, 80, 2], // 2 spaces per tab, max 80 chars per line
"no-inner-declarations": [1, "both"]
},
"env": {
"es6": true,
Expand Down
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ var Builder = {
* @param {Function} callback callback
*/
build : function( options, callback ) {
var configPath;

options = options || {};
options.log = options.log || console.log;
options.out = options.out ? path.resolve( process.cwd(), options.out ) : process.cwd();
options.out = options.out
? path.resolve( process.cwd(), options.out )
: process.cwd();

options.log(
'- Running electron-builder ' + require( './package' ).version
Expand All @@ -53,7 +56,7 @@ var Builder = {
}

if ( typeof options.config === 'string' ) {
var configPath = path.resolve( process.cwd(), options.config );
configPath = path.resolve( process.cwd(), options.config );

options.basePath = path.dirname( configPath );

Expand Down
5 changes: 4 additions & 1 deletion lib/helper/writeConfigFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ module.exports = function( templatePath, options ) {
}
)( options );

var outputPath = path.join( os.tmpDir(), ( Math.random() * 1e32 ).toString( 36 ) + path.basename( '.tpl' ) );
var outputPath = path.join(
os.tmpDir(),
( Math.random() * 1e32 ).toString( 36 ) + path.basename( '.tpl' )
);

fs.writeFileSync(
outputPath,
Expand Down
10 changes: 6 additions & 4 deletions lib/osx.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var OSXBuilder = {
*/
build : function( options, callback ) {

var osx = options.config.osx;

if ( process.platform !== 'darwin' ) {
return callback( new Error( 'Invalid platform.' ) );
}
Expand All @@ -32,9 +34,9 @@ var OSXBuilder = {

options.log( 'Writing temporary ´appdmg.json´' );

options.config.osx.background = path.resolve( options.basePath, options.config.osx.background );
options.config.osx.icon = path.resolve( options.basePath, options.config.osx.icon );
options.config.osx.contents[ 1 ].path = options.appPath;
osx.background = path.resolve( options.basePath, osx.background );
osx.icon = path.resolve( options.basePath, osx.icon );
osx.contents[ 1 ].path = options.appPath;

var configFilePath = path.join( os.tmpDir(), 'appdmg.json' );

Expand All @@ -52,7 +54,7 @@ var OSXBuilder = {
var appdmg = require( 'appdmg' );
var ee = appdmg( {
source : configFilePath,
target : path.join( options.out, options.config.osx.title + '.dmg' )
target : path.join( options.out, osx.title + '.dmg' )
} );

ee.on( 'progress', function ( info ) {
Expand Down
16 changes: 11 additions & 5 deletions lib/win.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@ var WinBuilder = {
build : function( options, callback ) {
options.log( '- Starting creation of installer for ´' + options.platform );

var nsiTemplate = options.config.win.nsiTemplate || path.join( __dirname, '..', 'templates/installer.nsi.tpl' );
var win = options.config.win;

var nsiTemplate = win.nsiTemplate || path.join(
__dirname,
'..',
'templates/installer.nsi.tpl'
);

var configFilePath = writeConfigFile( nsiTemplate, {
appPath : _windowsify( options.appPath ),
name : options.config.win.title,
version : options.config.win.version,
fileAssociation : options.config.win.fileAssociation,
name : win.title,
version : win.version,
fileAssociation : win.fileAssociation,
out : _windowsify( options.out )
} );

_copyAssetsToTmpFolder( options );

var verbosity = ( options.config.win.verbosity ) ? options.config.win.verbosity : 3 ;
var verbosity = ( win.verbosity ) ? win.verbosity : 3 ;

var makensis = childProcess.spawn(
'makensis',
Expand Down

0 comments on commit 4c43c35

Please sign in to comment.