@@ -6,7 +6,7 @@ var Immutable = require("immutable");
66var utils = require ( "./utils" ) ;
77var pluginUtils = require ( "./plugins" ) ;
88var connectUtils = require ( "./connect-utils" ) ;
9- var chalk = require ( "chalk" ) ;
9+ var chalk = require ( "chalk" ) ;
1010
1111module . exports = {
1212 /**
@@ -63,24 +63,19 @@ module.exports = {
6363 socketPort = bs . options . getIn ( [ "socket" , "port" ] ) ;
6464 }
6565
66- utils . getPort (
67- bs . options . get ( "listen" , "localhost" ) ,
68- socketPort ,
69- null ,
70- function ( err , port ) {
71- if ( err ) {
72- return utils . fail ( true , err , bs . cb ) ;
73- }
74- done ( null , {
75- optionsIn : [
76- {
77- path : [ "socket" , "port" ] ,
78- value : port
79- }
80- ]
81- } ) ;
66+ utils . getPort ( bs . options . get ( "listen" , "localhost" ) , socketPort , null , function ( err , port ) {
67+ if ( err ) {
68+ return utils . fail ( true , err , bs . cb ) ;
8269 }
83- ) ;
70+ done ( null , {
71+ optionsIn : [
72+ {
73+ path : [ "socket" , "port" ] ,
74+ value : port
75+ }
76+ ]
77+ } ) ;
78+ } ) ;
8479 } ,
8580 /**
8681 * Some features require an internet connection.
@@ -91,22 +86,13 @@ module.exports = {
9186 * @param {Function } done
9287 */
9388 getOnlineStatus : function ( bs , done ) {
94- if (
95- _ . isUndefined ( bs . options . get ( "online" ) ) &&
96- _ . isUndefined ( process . env . TESTING )
97- ) {
89+ if ( _ . isUndefined ( bs . options . get ( "online" ) ) && _ . isUndefined ( process . env . TESTING ) ) {
9890 require ( "dns" ) . resolve ( "www.google.com" , function ( err ) {
9991 var online = false ;
10092 if ( err ) {
101- bs . debug (
102- "Could not resolve www.google.com, setting %s" ,
103- chalk . magenta ( "online: false" )
104- ) ;
93+ bs . debug ( "Could not resolve www.google.com, setting %s" , chalk . magenta ( "online: false" ) ) ;
10594 } else {
106- bs . debug (
107- "Resolved www.google.com, setting %s" ,
108- chalk . magenta ( "online: true" )
109- ) ;
95+ bs . debug ( "Resolved www.google.com, setting %s" , chalk . magenta ( "online: true" ) ) ;
11096 online = true ;
11197 }
11298 done ( null , {
@@ -155,17 +141,9 @@ module.exports = {
155141 done ( null , {
156142 options : {
157143 urls : utils . getUrlOptions ( bs . options ) ,
158- snippet : connectUtils . enabled ( bs . options )
159- ? connectUtils . scriptTags ( bs . options )
160- : false ,
161- scriptPaths : Immutable . fromJS (
162- connectUtils . clientScript ( bs . options , true )
163- ) ,
164- files : bs . pluginManager . hook (
165- "files:watch" ,
166- bs . options . get ( "files" ) ,
167- bs . pluginManager . pluginOptions
168- )
144+ snippet : connectUtils . enabled ( bs . options ) ? connectUtils . scriptTags ( bs . options ) : false ,
145+ scriptPaths : Immutable . fromJS ( connectUtils . clientScript ( bs . options , true ) ) ,
146+ files : bs . pluginManager . hook ( "files:watch" , bs . options . get ( "files" ) , bs . pluginManager . pluginOptions )
169147 }
170148 } ) ;
171149 } ,
@@ -195,10 +173,7 @@ module.exports = {
195173 mergeMiddlewares : function ( bs , done ) {
196174 done ( null , {
197175 options : {
198- middleware : bs . pluginManager . hook (
199- "server:middleware" ,
200- bs . options . get ( "middleware" )
201- )
176+ middleware : bs . pluginManager . hook ( "server:middleware" , bs . options . get ( "middleware" ) )
202177 }
203178 } ) ;
204179 } ,
@@ -249,10 +224,7 @@ module.exports = {
249224 * @param {Function } done
250225 */
251226 startSockets : function ( bs , done ) {
252- var clientEvents = bs . pluginManager . hook (
253- "client:events" ,
254- bs . options . get ( "clientEvents" ) . toJS ( )
255- ) ;
227+ var clientEvents = bs . pluginManager . hook ( "client:events" , bs . options . get ( "clientEvents" ) . toJS ( ) ) ;
256228
257229 // Start the socket, needs an existing server.
258230 var io = bs . pluginManager . get ( "socket" ) ( bs . server , clientEvents , bs ) ;
@@ -287,13 +259,7 @@ module.exports = {
287259 return item . name === PLUGIN_NAME ;
288260 } )
289261 ) {
290- uiOpts = bs . options
291- . get ( "ui" )
292- . mergeDeep (
293- Immutable . fromJS (
294- bs . pluginManager . pluginOptions [ PLUGIN_NAME ]
295- )
296- ) ;
262+ uiOpts = bs . options . get ( "ui" ) . mergeDeep ( Immutable . fromJS ( bs . pluginManager . pluginOptions [ PLUGIN_NAME ] ) ) ;
297263 }
298264
299265 /**
0 commit comments