Move update_packages.dart to flutter update-packages

Now that we don't require the Dart SDK to be in your path, it's hard to run
./dev/update_packages.dart. Instead, you can now run `flutter update-packages`.

Fixes #1906
This commit is contained in:
Adam Barth
2016-02-25 15:29:58 -08:00
parent 0c05666ee1
commit 357fbf8a42
5 changed files with 60 additions and 49 deletions

View File

@@ -12,7 +12,9 @@ import '../globals.dart';
Future<int> pubGet({
String directory,
bool skipIfAbsent: false
bool skipIfAbsent: false,
bool upgrade: false,
bool checkLastModified: true
}) async {
if (directory == null)
directory = Directory.current.path;
@@ -28,10 +30,11 @@ Future<int> pubGet({
return 1;
}
if (!pubSpecLock.existsSync() || pubSpecYaml.lastModifiedSync().isAfter(pubSpecLock.lastModifiedSync())) {
if (!checkLastModified || !pubSpecLock.existsSync() || pubSpecYaml.lastModifiedSync().isAfter(pubSpecLock.lastModifiedSync())) {
printStatus("Running 'pub get' in $directory${Platform.pathSeparator}...");
String command = upgrade ? 'upgrade' : 'get';
int code = await runCommandAndStreamOutput(
<String>[sdkBinaryName('pub'), '--verbosity=warning', 'get'],
<String>[sdkBinaryName('pub'), '--verbosity=warning', command],
workingDirectory: directory
);
if (code != 0)