Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preinstall script #4

Merged
merged 19 commits into from Jul 21, 2017
Merged

Add preinstall script #4

merged 19 commits into from Jul 21, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jul 19, 2017

I haven't tested this because uninstalling wget uninstalls google-chrome for some reason.

@ghost
Copy link
Author

ghost commented Jul 19, 2017

@gabru-md Could you test this.

@ghost ghost mentioned this pull request Jul 20, 2017
2 tasks
@gabru-md
Copy link
Member

preinstall.js ? is it missing ?

@ghost
Copy link
Author

ghost commented Jul 20, 2017

I've added the file. See 6ff481b. I don't know how it never got commited. I usually run git status all of the time, so I should have seen it.

@gabru-md gabru-md self-requested a review July 20, 2017 11:16
preinstall.js Outdated
var spawn = require('child_process').spawn;
var readline = require('readline');
var terminal = require('terminal-utilities')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chalk is missing from the modules.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. See c74eae2

preinstall.js Outdated
});

exec('which wget', function(err,stdout,stderr){
if(err){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a problem with the use of if/else here all throughout the code.
if an error is encountered it means that wget is not present, and hence must be installed. But the code seems to do something else.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. See 6edb0c1

preinstall.js Outdated
if(stdout){
console.log('wget is required to install this module');
exec('which apt-get', function(err,stdout,stderr){
if(stdout){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes for here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. See 6edb0c1

preinstall.js Outdated
terminal.write(data);
});
installation.on('close', function(code){
console.log('wget installed successfully');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.exit(0) is missing.
the process stops thereafter and has to be manually terminated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. See 6e6447b

Copy link
Member

@gabru-md gabru-md left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do the following changes before merge can be done!

preinstall.js Outdated
}
});
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some brackets are missing. fix them as well.
:D

@ghost
Copy link
Author

ghost commented Jul 20, 2017

@gabru-md I've made the changes that you have requested.

@gabru-md
Copy link
Member

there were still some issues to be resolved.
I did it myself. changing the preinstall to postinstall and removing process.exit(0) at the end.

due to asynchronous nature of Node.JS, the exec command was not executed but the process ended faster. So had to remove it XD

Thanks for the contribution though.
Cheers!

@gabru-md gabru-md merged commit b8731f8 into yogdaan:master Jul 21, 2017
@ghost
Copy link
Author

ghost commented Jul 21, 2017

@gabru-md The reason I set it to be preinstall was because I had assumed that if the installation of wget failed (e.g. no internet connection) the installation of LinuxSpells would still continue and break when it runs accio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant