-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
) * split paths.dart into artifacts.dart, improve logging * handle file system exception * add version flag * add `maestro config` command * don't overwrite maestro.toml * improve bootstrap_command.dart * add basic readme * use Exceptions instead of Errors * fix readme * move adb.dart and flutter_driver.dart to external directory * replace all "maestro.toml" with a const * test_driver/integration_test.dart: replace with consts * stop suffixing $FILE to "done something with $FILE" * remove TestDriverDirectory - just use const * prepare for adding integration_test/app_test.dart file * maestro bootstrap: add adding integration_test/app_test.dart * make downloading artifacts simultaneous
- Loading branch information
1 parent
dc710c4
commit b0133ee
Showing
15 changed files
with
399 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,52 @@ | ||
# maestro_cli | ||
|
||
## Installation | ||
|
||
### From pub.dev | ||
|
||
> Not available yet! | ||
``` | ||
$ dart pub global activate maestro_cli | ||
``` | ||
|
||
### From git | ||
|
||
1. Make sure that you have Dart >= 2.17 installed (it comes with Flutter 3). | ||
2. Clone the repo. | ||
3. Go to `packages/maestro_cli`. | ||
4. Run `dart pub global activate --source path .` | ||
|
||
Now you can should be able to run `maestro` in your terminal. If you can't and | ||
the error is something along the lines of "command not found", make sure that | ||
you've added appropriate directories to PATH: | ||
|
||
- on Unix-like systems, add `$HOME/.pub-cache/bin` | ||
- on Windows, add `%USERPROFILE%\AppData\Local\Pub\Cache\bin` | ||
|
||
## Usage | ||
|
||
### First run | ||
|
||
On first run, `maestro` will download artifacts it needs to the _artifact path_. | ||
By default it is `$HOME/.maestro`, but you can change it by setting | ||
`MAESTRO_ARTIFACT_PATH` environment variable. | ||
|
||
To learn about commands, run: | ||
|
||
``` | ||
$ maestro --help | ||
``` | ||
|
||
### Bootstrap | ||
|
||
To use Maestro in your Flutter project, you need 4 things: | ||
|
||
1. have `maestro.toml` file in the root of the project (i.e next to | ||
`pubspec.yaml`) | ||
2. have `maestro` added as a `dev_dependency` in `pubspec.yaml` | ||
3. have `test_driver/integration_test.dart` | ||
4. have `integration_test/app_test.dart` | ||
|
||
Run `maestro bootstrap` to automatically do 1, 2, 3, and most of 4. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:args/command_runner.dart'; | ||
import 'package:maestro_cli/src/common/paths.dart'; | ||
import 'package:maestro_cli/src/common/common.dart'; | ||
|
||
class CleanCommand extends Command<int> { | ||
@override | ||
String get name => 'clean'; | ||
|
||
@override | ||
String get description => 'Remove all downloaded artifacts'; | ||
String get description => 'Delete all downloaded artifacts.'; | ||
|
||
@override | ||
Future<int> run() async { | ||
Directory(artifactsPath).deleteSync(recursive: true); | ||
final progress = log.progress('Deleting $artifactPath'); | ||
|
||
try { | ||
final dir = Directory(artifactPath); | ||
if (!dir.existsSync()) { | ||
progress.complete("Nothing to clean, $artifactPath doesn't exist"); | ||
return 1; | ||
} | ||
|
||
await dir.delete(recursive: true); | ||
} catch (err) { | ||
progress.fail('Failed to delete $artifactPath'); | ||
rethrow; | ||
} | ||
|
||
progress.complete('Deleted $artifactPath'); | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:args/command_runner.dart'; | ||
|
||
import '../common/common.dart'; | ||
|
||
class ConfigCommand extends Command<int> { | ||
@override | ||
String get name => 'config'; | ||
|
||
@override | ||
String get description => 'Show configuration.'; | ||
|
||
@override | ||
Future<int> run() async { | ||
final extra = artifactPathSetFromEnv | ||
? '(set from $maestroArtifactPathEnv)' | ||
: '(default)'; | ||
|
||
log.info('artifact path: $artifactPath $extra'); | ||
return 0; | ||
} | ||
} |
Oops, something went wrong.