Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Various fixens #26

Merged
merged 3 commits into from May 6, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/shapeshift.dart
Expand Up @@ -14,6 +14,10 @@ class Shapeshift {

void go(List<String> arguments) {
parseArgs(arguments);
if (args.rest.isEmpty) {
print('Usage: shapeshift.dart [options] <leftDir> <rightDir>');
exit(0);
}
String left = args.rest[0];
String right = args.rest[1];
String leftPath = path.join(args['base'], left);
Expand All @@ -25,7 +29,7 @@ class Shapeshift {

WriterProvider writer = (args['out'] == null)
? new SingleSinkWriterProvider(stdout)
: new DirectoryWriterProvider(args['out']);
: new DirectoryDiffWriterProvider(args['out']);

new DirectoryPackageReporter(leftPath, rightPath, writer)
..calculateAllDiffs()
Expand Down
1 change: 1 addition & 0 deletions lib/shapeshift_cli.dart
Expand Up @@ -7,3 +7,4 @@ export 'package:doc_coverage/doc_coverage_cli.dart';
export 'package:doc_coverage/doc_coverage_common.dart';

export 'src/cli/directory_package_reporter.dart';
export 'src/cli/directory_diff_writer_provider.dart';
19 changes: 19 additions & 0 deletions lib/src/cli/directory_diff_writer_provider.dart
@@ -0,0 +1,19 @@
// Copyright 2015 Google Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0, found in the LICENSE file.

library shapeshift_cli.directory_diff_writer_provider;

import 'package:doc_coverage/doc_coverage_cli.dart';
import 'package:doc_coverage/doc_coverage_common.dart';
import '../../shapeshift_common.dart';

/// A [WriterProvider] that provides a [MarkdownDiffWriter] that writes to a new
/// Markdown file for each library.
class DirectoryDiffWriterProvider extends DirectoryWriterProvider {
/// Constructs a [DirectoryDiffWriterProvider] that will use [path] when creating
/// new writers.
DirectoryDiffWriterProvider(path): super(path);

MarkdownWriter writerCtor(fileTargetBuilder, {bool shouldClose: true}) =>
new MarkdownDiffWriter(fileTargetBuilder, shouldClose: shouldClose);
}
18 changes: 14 additions & 4 deletions lib/src/common/reporters/method_attributes_reporter.dart
Expand Up @@ -147,13 +147,23 @@ class MethodAttributesReporter {
String propertyLink =
mdLinkToDartlang('$methodQualifiedName,$propertyName', propertyName);
String firstPart =
'The $methodLink $category\'s $propertyLink ${singularize(attributeName)}\'s';
'The $methodLink $category\'s $propertyLink ${singularize(attributeName)}';
property.forEachChanged((key, oldNew) {
if (key == 'type') {
io.writeln('$firstPart $key changed from `${changedType(oldNew)}`');
io.writeln('$firstPart\'s $key ${changedType(oldNew)}');
} else if (key == 'default') {
String change = (oldNew[0])
? 'no longer has a default value (was ${property.changed['value'][0]}).'
: 'now has a default value (${property.changed['value'][1]}).';
io.writeln('$firstPart $change');
} else {
if (key == 'value' && property.changed.containsKey('default')) {
// We will report the changed 'value' when reporting the changed
// 'default'.
return;
}
io.writeln(
'$firstPart changed from `$key: ${oldNew[0]}` to `$key: ${oldNew[1]}`');
'$firstPart\'s $key changed from `$key: ${oldNew[0]}` to `$key: ${oldNew[1]}`');
}
io.writeHr();
});
Expand All @@ -179,7 +189,7 @@ class MethodAttributesReporter {
// The foo method's callback parameter's return type has changed from
// Object to String.
io.writeln('The [$method](#) $category\'s [$propertyName](#) '
'${singularize(attributeName)}\'s return type has ${changedType(oldNew)}');
'${singularize(attributeName)}\'s return type ${changedType(oldNew)}');
io.writeHr();
erase(declaration.changed, 'return');
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/common/reporters/methods_reporter.dart
Expand Up @@ -6,11 +6,12 @@ library shapeshift_common.method_reporter;
import 'package:doc_coverage/doc_coverage_common.dart';
import 'package:json_diff/json_diff.dart' show DiffNode;

import '../markdown_diff_writer.dart';
import 'method_attributes_reporter.dart';

class MethodsReporter {
final DiffNode diff;
final MarkdownWriter io;
final MarkdownDiffWriter io;
final Function erase;

String category;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Expand Up @@ -5,7 +5,7 @@ environment:
dependencies:
args: any
diff_match_patch: ^0.2.1
doc_coverage: ^0.1.4
doc_coverage: ^0.1.5
json_diff: ^0.1.2
markdown: ^0.7.1+2
path: ^1.3.3
Expand Down