Skip to content

Commit 203b8b0

Browse files
fix: add missing variables for LICENSE files (#503)
1 parent c088199 commit 203b8b0

36 files changed

Lines changed: 443 additions & 86 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: very_good_dart_package_hooks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/very_good_dart_package_hooks.yaml"
7+
- "very_good_dart_package/hooks/**"
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- ".github/workflows/very_good_dart_package_hooks.yaml"
13+
- "very_good_dart_package/hooks/**"
14+
15+
jobs:
16+
build:
17+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1.19.2
18+
with:
19+
dart_sdk: "3.11.0"
20+
report_on: "pre_gen.dart"
21+
run_bloc_lint: false
22+
working_directory: "very_good_dart_package/hooks"
23+
analyze_directories: "test"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: very_good_docs_site_hooks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/very_good_docs_site_hooks.yaml"
7+
- "very_good_docs_site/hooks/**"
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- ".github/workflows/very_good_docs_site_hooks.yaml"
13+
- "very_good_docs_site/hooks/**"
14+
15+
jobs:
16+
build:
17+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1.19.2
18+
with:
19+
dart_sdk: "3.11.0"
20+
report_on: "pre_gen.dart"
21+
run_bloc_lint: false
22+
working_directory: "very_good_docs_site/hooks"
23+
analyze_directories: "test"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: very_good_flutter_package_hooks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/very_good_flutter_package_hooks.yaml"
7+
- "very_good_flutter_package/hooks/**"
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- ".github/workflows/very_good_flutter_package_hooks.yaml"
13+
- "very_good_flutter_package/hooks/**"
14+
15+
jobs:
16+
build:
17+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1.19.2
18+
with:
19+
dart_sdk: "3.11.0"
20+
report_on: "pre_gen.dart"
21+
run_bloc_lint: false
22+
working_directory: "very_good_flutter_package/hooks"
23+
analyze_directories: "test"

very_good_app_ui/hooks/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ environment:
44
sdk: ^3.11.0
55

66
dependencies:
7-
clock: ^1.1.1
7+
clock: ^1.1.2
88
mason: ^0.1.0
99

1010
dev_dependencies:

very_good_core/hooks/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ environment:
44
sdk: ^3.11.0
55

66
dependencies:
7-
clock: ^1.1.1
7+
clock: ^1.1.2
88
equatable: ^2.0.5
99
mason: ^0.1.0
1010

very_good_dart_cli/brick.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ vars:
2626
description: Whether the generated package is intended to be published.
2727
default: false
2828
prompt: Will the package be published?
29+
org_name:
30+
type: string
31+
description: The organization name
32+
default: Very Good Ventures
33+
prompt: What is the organization name?

very_good_dart_cli/config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"project_name": "very_good_dart_cli_output",
33
"executable_name": "very_good_ventures",
44
"description": "very_good_core test configuration",
5-
"publishable": false
6-
}
5+
"publishable": false,
6+
"org_name": "Very Good Ventures"
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:clock/clock.dart';
2+
import 'package:mason/mason.dart';
3+
4+
void run(HookContext context) {
5+
context.vars = {...context.vars, 'current_year': clock.now().year.toString()};
6+
}

very_good_dart_cli/hooks/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ environment:
44
sdk: ^3.11.0
55

66
dependencies:
7+
clock: ^1.1.2
78
mason: ^0.1.0
89
meta: ^1.12.0
910

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import 'package:clock/clock.dart';
2+
import 'package:mason/mason.dart';
3+
import 'package:mocktail/mocktail.dart';
4+
import 'package:test/test.dart';
5+
6+
import '../pre_gen.dart' as pre_gen;
7+
8+
class _MockHookContext extends Mock implements HookContext {}
9+
10+
void main() {
11+
group('pre_gen', () {
12+
late HookContext context;
13+
14+
setUp(() {
15+
context = _MockHookContext();
16+
});
17+
18+
test('populates variables', () {
19+
withClock(Clock.fixed(DateTime(2020)), () {
20+
final vars = {
21+
'project_name': 'my_cli',
22+
'executable_name': 'my_cli',
23+
'description': 'A Very Good Dart CLI',
24+
'publishable': false,
25+
'org_name': 'Very Good Ventures',
26+
};
27+
when(() => context.vars).thenReturn(vars);
28+
29+
pre_gen.run(context);
30+
31+
final newVars =
32+
verify(() => context.vars = captureAny()).captured.last
33+
as Map<String, dynamic>;
34+
35+
expect(
36+
newVars,
37+
equals({
38+
'project_name': 'my_cli',
39+
'executable_name': 'my_cli',
40+
'description': 'A Very Good Dart CLI',
41+
'publishable': false,
42+
'org_name': 'Very Good Ventures',
43+
'current_year': '2020',
44+
}),
45+
);
46+
});
47+
});
48+
});
49+
}

0 commit comments

Comments
 (0)