Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
pub get preference (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew authored Jul 30, 2017
1 parent cef31b0 commit db32387
Show file tree
Hide file tree
Showing 5 changed files with 1,102 additions and 1,090 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- fixed pub calls
- fixed linter / issues squiggles
- improvements to dartdoc tooltips
- added a preference for checking to see if 'pub get' needs to be run

## 0.6.47
- remove a dep on a missing plugin (synced-sidebar)
Expand Down
13 changes: 6 additions & 7 deletions lib/impl/pub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ class PubManager implements Disposable, ContextMenuContributor {

void _handleProjectAdded(DartProject project) => _validatePubspecCurrent(project);

// TODO: Remove pubspec.lock checking when the SDK revs.
void _validatePubspecCurrent(DartProject project) {
final String pubPref = '${pluginId}.showPubCheck';
final bool enabled = atom.config.getValue(pubPref);
if (!enabled) {
return;
}

File pubspecYamlFile = project.directory.getFile(pubspecFileName);
File pubspecLockFile = project.directory.getFile(pubspecLockFileName);
File dotPackagesFile = project.directory.getFile(dotPackagesFileName);

if (!pubspecYamlFile.existsSync()) return;
Expand All @@ -162,11 +166,6 @@ class PubManager implements Disposable, ContextMenuContributor {
var packagesTime = fs.statSync(dotPackagesFile.path).mtime;
bool dirty = pubspecTime.compareTo(packagesTime) > 0;
if (dirty) _showRunPubDialog(project);
} else if (pubspecLockFile.existsSync()) {
var pubspecTime = fs.statSync(pubspecYamlFile.path).mtime;
var lockTime = fs.statSync(pubspecLockFile.path).mtime;
bool dirty = pubspecTime.compareTo(lockTime) > 0;
if (dirty) _showRunPubDialog(project);
} else {
_showRunPubDialog(project, neverRun: true);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ class AtomDartPackage extends AtomPackage {
'order': 4
},

'showPubCheck': {
'title': 'Show a \'pub get\' notification',
'description': 'Check to see if pub needs to run for the current project.',
'type': 'boolean',
'default': true,
'order': 4
},

// show infos and todos
'configureErrorsView': {
'title': "Errors view configuration",
Expand Down
Loading

0 comments on commit db32387

Please sign in to comment.