|
|
|
@ -13,7 +13,7 @@ part '_project_manage.dart';
|
|
|
|
|
|
|
|
|
|
main(args) => grind(args);
|
|
|
|
|
|
|
|
|
|
@Task('add version number')
|
|
|
|
|
@Task('add minor version number')
|
|
|
|
|
void addVersion() async {
|
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
@ -28,6 +28,21 @@ void addVersion() async {
|
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Task('add path version number')
|
|
|
|
|
void addVersionPatch() async {
|
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
|
|
dynamic content = loadYaml(yamlContent);
|
|
|
|
|
String version = content['version'];
|
|
|
|
|
//rename version
|
|
|
|
|
|
|
|
|
|
Version resultVersion = VersionTool.fromText(version).nextPatchTag('dev');
|
|
|
|
|
|
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Task()
|
|
|
|
|
Future<String> getVersion() async {
|
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
|