Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: third_party/pkg/barback-0.13.0/examples/simple_transformer/lib/transformer.dart

Issue 291843011: Run pub tests against older versions of barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:barback/barback.dart'; 5 import 'package:barback/barback.dart';
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 class InsertCopyright extends Transformer { 9 class InsertCopyright extends Transformer {
10 String copyright = "Copyright (c) 2014, the Example project authors.\n"; 10 String copyright = "Copyright (c) 2014, the Example project authors.\n";
11 11
12 // A constructor named "asPlugin" is required. It can be empty, but 12 // A constructor named "asPlugin" is required. It can be empty, but
13 // it must be present. It is how pub determines that you want this 13 // it must be present. It is how pub determines that you want this
14 // class to be publicly available as a loadable transformer plugin. 14 // class to be publicly available as a loadable transformer plugin.
15 InsertCopyright.asPlugin(); 15 InsertCopyright.asPlugin();
16 16
17 Future<bool> isPrimary(Asset input) { 17 Future<bool> isPrimary(Asset input) {
18 return new Future.value(input.id.extension == '.txt'); 18 return new Future.value(input.id.extension == '.txt');
19 } 19 }
20 20
21 Future apply(Transform transform) { 21 Future apply(Transform transform) {
22 return transform.primaryInput.readAsString().then((content) { 22 return transform.primaryInput.readAsString().then((content) {
23 var id = transform.primaryInput.id; 23 var id = transform.primaryInput.id;
24 String newContent = copyright + content; 24 String newContent = copyright + content;
25 transform.addOutput(new Asset.fromString(id, newContent)); 25 transform.addOutput(new Asset.fromString(id, newContent));
26 }); 26 });
27 } 27 }
28 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698