Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: utils/pub/pub.dart

Issue 10207018: First pass at "pub update" implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor cleanup. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/pub/pub.dart
diff --git a/utils/pub/pub.dart b/utils/pub/pub.dart
index 6ed5b269d50a13a135131cb64e7cf0f7c04cc8df..dae4dea554618f2191dd0b5c114c246676306ea3 100644
--- a/utils/pub/pub.dart
+++ b/utils/pub/pub.dart
@@ -16,6 +16,7 @@
#source('package.dart');
Map<String, PubCommand> commands;
+PackageCache cache;
main() {
final args = new Options().arguments;
@@ -25,6 +26,7 @@ main() {
// be consistent with other Unix apps.
commands = {
'list': new PubCommand('print the contents of repositories', commandList),
+ 'update': new PubCommand("update a package's dependencies", commandUpdate),
'version': new PubCommand('print Pub version', commandVersion)
};
@@ -45,6 +47,9 @@ main() {
}
}
+ // TODO(rnystrom): Do we want this to be global?
+ cache = new PackageCache(cacheDir);
+
var options = new PubOptions(cacheDir);
// Select the command.
@@ -96,6 +101,17 @@ void commandVersion(PubOptions options, List<String> args) {
print('Pub 0.0.0');
}
+/**
+ * Gets the package that contains the current working directory. In other words,
+ * finds the package that the user is currently "in".
+ */
+Future<Package> getWorkingPackage() {
+ // TODO(rnystrom): Will eventually need better logic to walk up
+ // subdirectories until we hit one that looks package-like. For now, just
+ // assume the cwd is it.
+ return Package.load(workingDir);
+}
+
typedef void CommandFunction(PubOptions options, List<String> args);
class PubCommand {
« utils/pub/package.dart ('K') | « utils/pub/package.dart ('k') | utils/tests/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698