Skip to content

Commit d43b542

Browse files
committed
fix: Hardcode version instead of trying to find the pubpsec.yaml
1 parent 1eb81b8 commit d43b542

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

lib/commands/version_command.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
import 'dart:io';
2-
3-
import 'package:ignite_cli/utils.dart';
1+
import 'package:ignite_cli/version.g.dart';
42
import 'package:process_run/process_run.dart';
5-
import 'package:yaml/yaml.dart';
63

74
Future<void> versionCommand() async {
85
print(r'$ ignite --version:');
9-
print(await getVersionFromPubspec());
6+
print(igniteVersion);
107
print('');
118
await runExecutableArguments('dart', ['--version'], verbose: true);
129
print('');
1310
await runExecutableArguments('flutter', ['--version'], verbose: true);
14-
}
15-
16-
Future<String> getVersionFromPubspec() async {
17-
final f = File(getBundledFile('pubspec.yaml'));
18-
final yaml = loadYaml(await f.readAsString()) as Map;
19-
return yaml['version'] as String;
20-
}
11+
}

lib/version.g.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is generated. Do not manually edit.
2+
String igniteVersion = '0.6.0';
3+

scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash -xe
22

3+
./scripts/generate-version.sh
4+
35
# TODO(luan): use a wildcard once supported
46
function bundle {
57
dart run mason_cli:mason bundle $1 -t dart -o lib/templates/bricks/

scripts/generate-version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -xe
2+
3+
version=`cat pubspec.yaml | grep version | cut -d ' ' -f 2`
4+
contents="// This file is generated. Do not manually edit.\nString igniteVersion = '$version';\n"
5+
echo "$contents" | sed 's/\\n/\n/g' > lib/version.g.dart

scripts/test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -xe
2+
3+
./scripts/build.sh
4+
./scripts/analyze.sh
5+
(cd test ; ./run.sh)

0 commit comments

Comments
 (0)