-
Notifications
You must be signed in to change notification settings - Fork 105
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
Changes from 1 commit
daec614
a9ab148
f0a6b48
19f2dfc
fd0e71b
a0c66d3
749fcc4
85eff44
6cc16ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
when 'keymap.cson' | ||
fs.writeFileSync atom.keymaps.getUserKeymapPath(), file.content if atom.config.get('sync-settings.syncKeymap') | ||
|
@@ -300,6 +301,21 @@ SyncSettings = | |
console.debug "config.set #{keyPath[1...]}=#{value}" | ||
atom.config.set keyPath[1...], value | ||
|
||
uninstallRedundantPackages: (packages, cb) -> | ||
available_packages = @getPackages() | ||
redundant_packages = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
for pkg in available_packages | ||
available_package = (p for p in packages when p.name is pkg.name) | ||
if available_package.length is 0 | ||
redundant_packages.push(pkg) | ||
if redundant_packages.length is 0 | ||
atom.notifications.addInfo "Sync-settings: no packages to remove" | ||
return cb?() | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the else case the |
||
for pkg in redundant_packages | ||
packageManager = new PackageManager() | ||
packageManager.uninstall pkg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This call of |
||
|
||
installMissingPackages: (packages, cb) -> | ||
available_packages = @getPackages() | ||
missing_packages = [] | ||
|
There was a problem hiding this comment.
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.