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

Remove obsolete packages. #338

Merged
merged 9 commits into from
May 31, 2017
Merged

Remove obsolete packages. #338

merged 9 commits into from
May 31, 2017

Conversation

James-Yu
Copy link
Contributor

Fixes #91 #305

Copy link
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

Thank you for making this PR. I added a few comments inline which need to be addressed before this can be merged.

if redundant_packages.length is 0
atom.notifications.addInfo "Sync-settings: no packages to remove"
return cb?()
else
Copy link
Contributor

Choose a reason for hiding this comment

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

In the else case the cb doesn't seem to get called anywhere?

@@ -232,6 +232,7 @@ SyncSettings =
if atom.config.get('sync-settings.syncPackages')
callbackAsync = true
@installMissingPackages JSON.parse(file.content), cb
@uninstallRedundantPackages JSON.parse(file.content), cb
Copy link
Contributor

Choose a reason for hiding this comment

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

While this is a great feature I think it is not necessarily what all users want. Therefore I think this should be an option in the settings which defaults to false to maintain the current behavior.

else
for pkg in redundant_packages
packageManager = new PackageManager()
packageManager.uninstall pkg
Copy link
Contributor

Choose a reason for hiding this comment

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

This call of uninstall should also pass a callback to inform the user about progress / success / failure of the command.

@James-Yu
Copy link
Contributor Author

James-Yu commented Feb 1, 2017

All comments addressed. Used some existing code so not very clean but at least works well.

@James-Yu
Copy link
Contributor Author

James-Yu commented Feb 3, 2017

Seems travis-ci finally works. This is just a ping.

Copy link

@philoserf philoserf left a comment

Choose a reason for hiding this comment

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

There are many sync-settings users that will welcome this addition.

description: 'Packages installed but not in the backup will be removed when restoring backups'
type: 'boolean'
default: false
order: 11

Choose a reason for hiding this comment

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

Is there a reason removePackage needs to be inserted here, thus pushing the order: attribute of everything that follows?

Could it have been appended to the end of the list instead?

@James-Yu
Copy link
Contributor Author

James-Yu commented Feb 5, 2017

It's an arbitrary position that I found may form a "block" of settings with similar functions. Will make another commit to have the change soon.

@philoserf
Copy link

@dirk-thomas I believe the needs update has been handled.

@schummar
Copy link

@dirk-thomas Any news on this? I am also eagerly awaiting this feature. ;-)

@Cphoenix
Copy link

Looking forward to this. Many thanks.

@JosephTLyons
Copy link

Any word on this?

Copy link
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

I don't think the term "redundant" fits well in this case. I would suggest using the term "obsolete" instead.

@@ -67,4 +67,10 @@ module.exports = {
default: false
description: "Mute 'Latest backup is already applied' message"
order: 14
removePackage:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please rename this to removeObsoletePackages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add the trailing s to make it plural. Since the title is "the same" afterwards you can remove it (it is automatically generated by separating the capitalized words of the key).

@@ -67,4 +67,10 @@ module.exports = {
default: false
description: "Mute 'Latest backup is already applied' message"
order: 14
removePackage:
title: 'Remove unused packages'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please update this to Remove obsolete packages. (The following description is good as it is I think.)

@@ -300,6 +302,64 @@ SyncSettings =
console.debug "config.set #{keyPath[1...]}=#{value}"
atom.config.set keyPath[1...], value

removeRedundantPackages: (packages, cb) ->
available_packages = @getPackages()
redundant_packages = []
Copy link
Contributor

@dirk-thomas dirk-thomas Mar 20, 2017

Choose a reason for hiding this comment

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

This should be obsolete_packages.

@@ -300,6 +302,64 @@ SyncSettings =
console.debug "config.set #{keyPath[1...]}=#{value}"
atom.config.set keyPath[1...], value

removeRedundantPackages: (packages, cb) ->
Copy link
Contributor

@dirk-thomas dirk-thomas Mar 20, 2017

Choose a reason for hiding this comment

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

Can you please rename the function to removeObsoletePackages.

The argument packages is kind of ambiguous - if it refers to the redundant / obsolete packages. Therefore I would suggest renaming the argument to used_packages (or does anyone have a better proposal?) to clarify which package names it contains.

@philoserf
Copy link

@James-Yu heads up. @dirk-thomas has asked for a change to a name.

@JosephTLyons
Copy link

Extraneous?

@James-Yu
Copy link
Contributor Author

Here they are.

@James-Yu James-Yu changed the title Remove redundant packages. Remove obsolete packages. Mar 21, 2017
@philoserf
Copy link

@dirk-thomas back in your court

@philoserf
Copy link

Ping

@renarsvilnis
Copy link

What's the status of this?
Is there anything I/we can help with to get it finished/merged/live?

@James-Yu James-Yu closed this May 25, 2017
@dirk-thomas
Copy link
Contributor

@James-Yu Why did you close the pull request?

@dirk-thomas dirk-thomas reopened this May 31, 2017
…ckages to remaining_packages, rename available_package to keep_installed_package
@dirk-thomas dirk-thomas merged commit 9c58b0b into atom-community:master May 31, 2017
@dirk-thomas
Copy link
Contributor

@James-Yu FYI #379.

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

Successfully merging this pull request may close these issues.

7 participants