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
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ BEGIN
VALUE "FileDescription", "{{project_name.snakeCase()}}" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "{{project_name.snakeCase()}}" "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 {{windows_application_id}}. All rights reserved." "\0"
VALUE "LegalCopyright", "Copyright (C) {{current_year}} {{windows_application_id}}. All rights reserved." "\0"
VALUE "OriginalFilename", "{{project_name.snakeCase()}}.exe" "\0"
VALUE "ProductName", "{{project_name.titleCase()}}" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
Expand Down
2 changes: 2 additions & 0 deletions very_good_flame_game/hooks/pre_gen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:clock/clock.dart';
import 'package:mason/mason.dart';
import 'package:very_good_flame_game_hooks/very_good_core_hooks.dart';

Expand Down Expand Up @@ -42,5 +43,6 @@ void run(HookContext context) {
'ios_application_id': configuration.iOsApplicationId,
'macos_application_id': configuration.macOsApplicationId,
'windows_application_id': configuration.windowsApplicationId,
'current_year': clock.now().year.toString(),
};
}
1 change: 1 addition & 0 deletions very_good_flame_game/hooks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ environment:
sdk: ^3.5.0

dependencies:
clock: ^1.1.1
equatable: ^2.0.5
mason: ^0.1.0-dev.52
very_good_core_hooks:
Expand Down
60 changes: 32 additions & 28 deletions very_good_flame_game/hooks/test/pre_gen_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:clock/clock.dart';
import 'package:mason/mason.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
Expand All @@ -15,34 +16,37 @@ void main() {
});

test('populates variables', () {
final vars = {
'project_name': 'my_game',
'org_name': 'com.example',
'application_id': 'app.id',
'description': 'A new Flame project.',
};
when(() => context.vars).thenReturn(vars);

pre_gen.run(context);

final newVars = verify(() => context.vars = captureAny()).captured.last
as Map<String, dynamic>;

expect(
newVars,
equals(
{
'project_name': 'my_game',
'org_name': 'com.example',
'description': 'A new Flame project.',
'android_namespace': 'app.id',
'android_application_id': 'app.id',
'ios_application_id': 'app.id',
'macos_application_id': 'app.id',
'windows_application_id': 'app.id',
},
),
);
withClock(Clock.fixed(DateTime(2020)), () {
final vars = {
'project_name': 'my_game',
'org_name': 'com.example',
'application_id': 'app.id',
'description': 'A new Flame project.',
};
when(() => context.vars).thenReturn(vars);

pre_gen.run(context);

final newVars = verify(() => context.vars = captureAny()).captured.last
as Map<String, dynamic>;

expect(
newVars,
equals(
{
'project_name': 'my_game',
'org_name': 'com.example',
'description': 'A new Flame project.',
'android_namespace': 'app.id',
'android_application_id': 'app.id',
'ios_application_id': 'app.id',
'macos_application_id': 'app.id',
'windows_application_id': 'app.id',
'current_year': '2020',
},
),
);
});
});
});
}