| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:path/path.dart' as p; | |
| 6 import 'package:pub/src/io.dart'; | 5 import 'package:pub/src/io.dart'; |
| 7 | 6 |
| 8 import '../../descriptor.dart' as d; | 7 import '../../descriptor.dart' as d; |
| 9 import '../../test_pub.dart'; | 8 import '../../test_pub.dart'; |
| 10 | 9 |
| 11 main() { | 10 main() { |
| 12 integration('activating a hosted package deactivates the Git one', () { | 11 integration('activating a hosted package deactivates the Git one', () { |
| 13 servePackages((builder) { | 12 servePackages((builder) { |
| 14 builder.serve("foo", "2.0.0", contents: [ | 13 builder.serve("foo", "2.0.0", contents: [ |
| 15 d.dir("bin", [ | 14 d.dir("bin", [ |
| 16 d.file("foo.dart", "main(args) => print('hosted');") | 15 d.file("foo.dart", "main(args) => print('hosted');") |
| 17 ]) | 16 ]) |
| 18 ]); | 17 ]); |
| 19 }); | 18 }); |
| 20 | 19 |
| 21 d.git('foo.git', [ | 20 d.git('foo.git', [ |
| 22 d.libPubspec("foo", "1.0.0"), | 21 d.libPubspec("foo", "1.0.0"), |
| 23 d.dir("bin", [ | 22 d.dir("bin", [ |
| 24 d.file("foo.dart", "main() => print('git');") | 23 d.file("foo.dart", "main() => print('git');") |
| 25 ]) | 24 ]) |
| 26 ]).create(); | 25 ]).create(); |
| 27 | 26 |
| 28 schedulePub(args: ["global", "activate", "-sgit", "../foo.git"]); | 27 schedulePub(args: ["global", "activate", "-sgit", "../foo.git"]); |
| 29 | 28 |
| 30 var path = canonicalize(p.join(sandboxDir, "foo")); | |
| 31 schedulePub(args: ["global", "activate", "foo"], output: """ | 29 schedulePub(args: ["global", "activate", "foo"], output: """ |
| 32 Package foo is currently active from Git repository "../foo.git". | 30 Package foo is currently active from Git repository "../foo.git". |
| 33 Resolving dependencies... | 31 Resolving dependencies... |
| 34 + foo 2.0.0 | 32 + foo 2.0.0 |
| 35 Downloading foo 2.0.0... | 33 Downloading foo 2.0.0... |
| 36 Precompiling executables... | 34 Precompiling executables... |
| 37 Loading source assets... | 35 Loading source assets... |
| 38 Precompiled foo:foo. | 36 Precompiled foo:foo. |
| 39 Activated foo 2.0.0."""); | 37 Activated foo 2.0.0."""); |
| 40 | 38 |
| 41 // Should now run the hosted one. | 39 // Should now run the hosted one. |
| 42 var pub = pubRun(global: true, args: ["foo"]); | 40 var pub = pubRun(global: true, args: ["foo"]); |
| 43 pub.stdout.expect("hosted"); | 41 pub.stdout.expect("hosted"); |
| 44 pub.shouldExit(); | 42 pub.shouldExit(); |
| 45 }); | 43 }); |
| 46 } | 44 } |
| OLD | NEW |