|
|
@ -17,6 +17,8 @@ main(args) => grind(args);
|
|
|
|
|
|
|
|
|
|
|
|
@Task('add minor version number')
|
|
|
|
@Task('add minor version number')
|
|
|
|
void addVersion() async {
|
|
|
|
void addVersion() async {
|
|
|
|
|
|
|
|
TaskArgs args = context.invocation.arguments;
|
|
|
|
|
|
|
|
bool force = args.getFlag('f');
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
@ -28,10 +30,14 @@ void addVersion() async {
|
|
|
|
|
|
|
|
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
|
|
|
|
stdout.write('version has been add 👍\n');
|
|
|
|
|
|
|
|
await uploadVersion(force);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Task('add path version number')
|
|
|
|
@Task('add path version number')
|
|
|
|
void addVersionPatch() async {
|
|
|
|
void addVersionPatch() async {
|
|
|
|
|
|
|
|
TaskArgs args = context.invocation.arguments;
|
|
|
|
|
|
|
|
bool force = args.getFlag('f');
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
@ -43,10 +49,14 @@ void addVersionPatch() async {
|
|
|
|
|
|
|
|
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
|
|
|
|
stdout.write('version has been add 👍');
|
|
|
|
|
|
|
|
await uploadVersion(force);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Task('add major version number')
|
|
|
|
@Task('add major version number')
|
|
|
|
void addVersionMajor() async {
|
|
|
|
void addVersionMajor() async {
|
|
|
|
|
|
|
|
TaskArgs args = context.invocation.arguments;
|
|
|
|
|
|
|
|
bool force = args.getFlag('f');
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
@ -58,10 +68,14 @@ void addVersionMajor() async {
|
|
|
|
|
|
|
|
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
String result = yamlContent.replaceFirst(version, resultVersion.toString());
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
await File(yamlPath).writeAsString(result);
|
|
|
|
|
|
|
|
stdout.write('version has been add 👍');
|
|
|
|
|
|
|
|
await uploadVersion(force);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Task()
|
|
|
|
@Task()
|
|
|
|
Future<String> getVersion() async {
|
|
|
|
Future<String> getVersion() async {
|
|
|
|
|
|
|
|
TaskArgs args = context.invocation.arguments;
|
|
|
|
|
|
|
|
bool force = args.getFlag('f');
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String projectPath = Directory('.').absolute.path;
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlPath = join(projectPath, 'pubspec.yaml');
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
|
String yamlContent = await File(yamlPath).readAsString();
|
|
|
@ -71,9 +85,7 @@ Future<String> getVersion() async {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Task()
|
|
|
|
@Task()
|
|
|
|
Future uploadVersion() async {
|
|
|
|
Future uploadVersion(bool force) async {
|
|
|
|
TaskArgs args = context.invocation.arguments;
|
|
|
|
|
|
|
|
bool force = args.getFlag('f');
|
|
|
|
|
|
|
|
var version = await getVersion();
|
|
|
|
var version = await getVersion();
|
|
|
|
List<String> spVersion = version.split('+');
|
|
|
|
List<String> spVersion = version.split('+');
|
|
|
|
stdout.write('版本号:' + spVersion[0] + '\n');
|
|
|
|
stdout.write('版本号:' + spVersion[0] + '\n');
|
|
|
|