diff --git a/CHANGELOG.md b/CHANGELOG.md index f7731f0af4..e32e77d68d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.0+1 +* [bug] fixed an issue running dartdoc as a pub global activated snapshot + ## 0.5.0 * [health] remove calls to deprecated methods * [health] remove workaround when sorting empty iterable diff --git a/lib/dartdoc.dart b/lib/dartdoc.dart index cb213015cb..d4e29957e0 100644 --- a/lib/dartdoc.dart +++ b/lib/dartdoc.dart @@ -36,7 +36,7 @@ export 'src/package_meta.dart'; const String name = 'dartdoc'; // Update when pubspec version changes. -const String version = '0.5.0'; +const String version = '0.5.0+1'; final String defaultOutDir = 'doc${Platform.pathSeparator}api'; diff --git a/lib/resource_loader.dart b/lib/resource_loader.dart index 345c03a51d..38175765a3 100644 --- a/lib/resource_loader.dart +++ b/lib/resource_loader.dart @@ -26,11 +26,15 @@ Future loadAsString(String path) { if (!path.startsWith('package:')) { throw new ArgumentError('path must begin with package:'); } - return new Resource(path).readAsString().catchError((_) async { - // TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed. - var bytes = await _doLoad(path); - return new String.fromCharCodes(bytes); - }); + + try { + return new Resource(path).readAsString().catchError((_) { + // TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed. + return _doLoad(path).then((bytes) => new String.fromCharCodes(bytes)); + }); + } catch (_) { + return _doLoad(path).then((bytes) => new String.fromCharCodes(bytes)); + } } /// Loads a `package:` resource as an [List]. @@ -39,10 +43,12 @@ Future> loadAsBytes(String path) { throw new ArgumentError('path must begin with package:'); } - return new Resource(path).readAsBytes().catchError((_) { + try { // TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed. + return new Resource(path).readAsBytes().catchError((_) => _doLoad(path)); + } catch (_) { return _doLoad(path); - }); + } } /// Determine how to do the load. HTTP? Snapshotted? From source? diff --git a/pubspec.yaml b/pubspec.yaml index 4fbcb081c9..929756d5ac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: dartdoc # Also update the `version` field in lib/dartdoc.dart. -version: 0.5.0 +version: 0.5.0+1 author: Dart Team description: A documentation generator for Dart. homepage: https://github.com/dart-lang/dartdoc