Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use json2yaml #13

Merged
merged 2 commits into from
Sep 4, 2024
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
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linter:
rules:
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_returning_null
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
Expand Down
4 changes: 3 additions & 1 deletion bin/apply.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ void main() async {
}

Future<void> _applyHooks() async {
final Iterable<String> keys = yamlMap.keys.cast<String>();
for (String key in keys) {
final String cmd = "${key.substring(0, 3)}_${key.substring(3 + 1)}";
final String cmd = "${key.substring(0, 3)}_${key.substring(4)}";

await _updateGitHook(cmd, key);
}
logger.info("Hooks have been updated");
Expand Down
Empty file modified example/README.md
100755 → 100644
Empty file.
4 changes: 1 addition & 3 deletions lib/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import "classes.dart";
import "package:yaml/yaml.dart";

const String configFile = "dart_hooks.yaml";
final Iterable<String> keys =
(loadYaml(File(configFile).readAsStringSync()).keys as Iterable)
.map((dynamic key) => key.toString());
final Map yamlMap = loadYaml(File(configFile).readAsStringSync()) as Map;

File config = File(configFile);
Logger logger = Logger();
Expand Down
30 changes: 23 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.19.0"
json2yaml:
dependency: "direct main"
description:
name: json2yaml
sha256: da94630fbc56079426fdd167ae58373286f603371075b69bf46d848d63ba3e51
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: "direct dev"
description:
Expand All @@ -17,14 +25,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.15.0"
path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
source_span:
dependency: transitive
description:
Expand All @@ -37,10 +53,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
term_glyph:
dependency: transitive
description:
Expand All @@ -58,4 +74,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.0.4 <4.0.0"
dart: ">=3.4.0 <4.0.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ executables:
destroy:

dependencies:
json2yaml: ^3.0.1
yaml: ^3.1.2

dev_dependencies:
Expand Down
Loading