diff --git a/CHANGELOG.md b/CHANGELOG.md index dd89d6d..2b8dc21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.1] - 2023-06-11 +### Fixed +- "Error: No value found at /cider" when run with no configuration in pubspec.yaml + ## [0.2.0] - 2023-06-10 ### Added - The `list` command to list all versions from the changelog. @@ -91,6 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial version +[0.2.1]: https://github.com/f3ath/cider/compare/0.2.0...0.2.1 [0.2.0]: https://github.com/f3ath/cider/compare/0.1.6...0.2.0 [0.1.6]: https://github.com/f3ath/cider/compare/0.1.5...0.1.6 [0.1.5]: https://github.com/f3ath/cider/compare/0.1.4...0.1.5 diff --git a/lib/src/cli/command/cider_command.dart b/lib/src/cli/command/cider_command.dart index 329aeee..158ed37 100644 --- a/lib/src/cli/command/cider_command.dart +++ b/lib/src/cli/command/cider_command.dart @@ -27,7 +27,7 @@ abstract class CiderCommand extends Command { Future _readConfigFromPubspec(String projectRoot) async { final pubspec = loadYaml(await pubspecFile(projectRoot).readAsString()) as Map; - final config = pubspec.read('/cider'); + final config = pubspec.read('/cider', orElse: () => {}); final diffTemplate = config.read('/link_template/diff', orElse: () => ''); final tagTemplate = diff --git a/pubspec.yaml b/pubspec.yaml index b91ef96..498cce6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: cider -version: 0.2.0 +version: 0.2.1 description: Tools for Dart package maintainers. Automates changelog and pubspec updates. homepage: https://github.com/f3ath/cider repository: https://github.com/f3ath/cider diff --git a/test/functional_test.dart b/test/functional_test.dart index ce2540a..fed4579 100644 --- a/test/functional_test.dart +++ b/test/functional_test.dart @@ -43,6 +43,14 @@ void main() { }); }); + test('Can run without config', () async { + final code = + await cli.run(['--project-root=test/template_no_config', 'version']); + + expect(code, equals(0)); + expect(out.buffer.toString(), equals('1.2.3-alpha+42\n')); + }); + test('Usage exception', () async { final code = await run(['foo']); expect(code, equals(64)); diff --git a/test/template_no_config/pubspec.yaml b/test/template_no_config/pubspec.yaml new file mode 100644 index 0000000..bb99a19 --- /dev/null +++ b/test/template_no_config/pubspec.yaml @@ -0,0 +1,3 @@ +name: test +version: 1.2.3-alpha+42 +description: Test project