first start

This commit is contained in:
CodeDoctorDE
2022-01-03 11:37:31 +01:00
parent 77a0bb4a25
commit 62566b1336
4 changed files with 143 additions and 0 deletions

51
tools/.gitignore vendored Normal file
View File

@@ -0,0 +1,51 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
# Linux related
AppDir
appimage-builder-cache
*.AppImage

54
tools/pubspec.lock Normal file
View File

@@ -0,0 +1,54 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
yaml:
dependency: "direct main"
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.13.0 <3.0.0"

5
tools/pubspec.yaml Normal file
View File

@@ -0,0 +1,5 @@
name: butterfly_tools
environment:
sdk: ">=2.13.0 <3.0.0"
dependencies:
yaml: ^3.1.0

33
tools/set_version.dart Normal file
View File

@@ -0,0 +1,33 @@
import 'dart:io';
Future<void> main(List<String> args) async {
// Get the version from args
if (args.length != 1) {
print("Please provide the version number as the first argument");
exit(1);
}
var version = args[0];
// Update the version in the pubspec.yaml
File pubspec = new File('app/pubspec.yaml');
String content = await pubspec.readAsString();
// Get last version from pubspec.yaml
RegExp exp = new RegExp(r'^version:\s(.+)\+(.+)', multiLine: true);
Iterable<Match> matches = exp.allMatches(content);
if (matches.length != 1) {
print("Could not find the version in the pubspec.yaml");
exit(1);
}
var lastVersion = matches.first.group(0) ?? '';
print(lastVersion);
// Get build number from lastVersion
var lastBuildNumber = lastVersion.split('+')[1];
var newBuildNumber = (int.parse(lastBuildNumber) + 1).toString();
var newVersion = '$version+$newBuildNumber';
// Update the version in the pubspec.yaml
content = content.replaceAll(lastVersion, 'version: $newVersion');
await pubspec.writeAsString(content);
print(
"Updating the version in the pubspec.yaml from $lastVersion to $newVersion");
}