@@ -6,7 +6,7 @@ var Github = require('github-api');
66var fs = require ( 'fs' ) ;
77var chalk = require ( 'chalk' ) ;
88var Promise = Promise || require ( 'es6-promise' ) . Promise ;
9- var isOnline = require ( 'is-online ' ) ;
9+ var connectivity = require ( 'connectivity ' ) ;
1010var ObjectAssign = require ( 'object-assign' ) ;
1111
1212var defaults = {
@@ -749,12 +749,12 @@ function generateOptions(options) {
749749 */
750750function hasNetwork ( ) {
751751 return new Promise ( function ( resolve , reject ) {
752- isOnline ( function ( err , online ) {
753- if ( err ) {
754- reject ( chalk . red ( err ) ) ;
752+ connectivity ( function ( isOnline ) {
753+ if ( ! isOnline ) {
754+ reject ( chalk . red ( 'You need to have network connectivity' ) ) ;
755755 }
756756
757- resolve ( online ) ;
757+ resolve ( isOnline ) ;
758758 } ) ;
759759 } ) ;
760760}
@@ -790,12 +790,8 @@ GithubReleaseNotes.prototype.init = function() {
790790 var gren = this ;
791791
792792 return hasNetwork ( )
793- . then ( function ( success ) {
794- if ( success ) {
795- return generateOptions ( gren . options ) ;
796- } else {
797- throw chalk . red ( 'You need to have network connectivity' ) ;
798- }
793+ . then ( function ( ) {
794+ return generateOptions ( gren . options ) ;
799795 } )
800796 . then ( function ( optionData ) {
801797 gren . options = ObjectAssign ( ...optionData , gren . options ) ;
@@ -810,8 +806,6 @@ GithubReleaseNotes.prototype.init = function() {
810806
811807 gren . repo = githubApi . getRepo ( gren . options . username , gren . options . repo ) ;
812808 gren . issues = githubApi . getIssues ( gren . options . username , gren . options . repo ) ;
813-
814- return true ;
815809 } )
816810 . catch ( function ( error ) {
817811 console . log ( error ) ;
0 commit comments