Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions lib/commands/version_command.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import 'dart:io';

import 'package:ignite_cli/utils.dart';
import 'package:ignite_cli/version.g.dart';
import 'package:process_run/process_run.dart';
import 'package:yaml/yaml.dart';

Future<void> versionCommand() async {
print(r'$ ignite --version:');
print(await getVersionFromPubspec());
print(igniteVersion);
print('');
await runExecutableArguments('dart', ['--version'], verbose: true);
print('');
await runExecutableArguments('flutter', ['--version'], verbose: true);
}

Future<String> getVersionFromPubspec() async {
final f = File(getBundledFile('pubspec.yaml'));
final yaml = loadYaml(await f.readAsString()) as Map;
return yaml['version'] as String;
}
}
3 changes: 3 additions & 0 deletions lib/version.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file is generated. Do not manually edit.
String igniteVersion = '0.6.0';

2 changes: 2 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -xe

./scripts/generate-version.sh

# TODO(luan): use a wildcard once supported
function bundle {
dart run mason_cli:mason bundle $1 -t dart -o lib/templates/bricks/
Expand Down
5 changes: 5 additions & 0 deletions scripts/generate-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -xe

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

./scripts/build.sh
./scripts/analyze.sh
(cd test ; ./run.sh)