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

Side by Side Diff: packages/barback/example/simple_transformer/lib/transformer.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:barback/barback.dart';
6
7 import 'dart:async';
8
9 class InsertCopyright extends Transformer {
10 String copyright = "Copyright (c) 2014, the Example project authors.\n";
11
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
14 // class to be publicly available as a loadable transformer plugin.
15 InsertCopyright.asPlugin();
16
17 Future<bool> isPrimary(AssetId id) async => id.extension == '.txt';
18
19 Future apply(Transform transform) async {
20 var content = await transform.primaryInput.readAsString();
21 var id = transform.primaryInput.id;
22 var newContent = copyright + content;
23 transform.addOutput(new Asset.fromString(id, newContent));
24 }
25 }
OLDNEW
« no previous file with comments | « packages/barback/example/simple_transformer/lib/test.txt ('k') | packages/barback/example/simple_transformer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698