OLD | NEW |
1 import '../../../pkg/unittest/lib/unittest.dart'; | 1 import '../../../pkg/unittest/lib/unittest.dart'; |
2 import '../lib/html_to_json.dart' as html_to_json; | 2 import '../lib/html_to_json.dart' as html_to_json; |
3 import '../lib/json_to_html.dart' as json_to_html; | 3 import '../lib/json_to_html.dart' as json_to_html; |
4 import 'dart:json'; | 4 import 'dart:json'; |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 void main() { | 7 void main() { |
8 var scriptPath = new Path(new Options().script).directoryPath.toString(); | 8 var scriptPath = new Path(new Options().script).directoryPath.toString(); |
9 | 9 |
10 test('HTML Doc to JSON', () { | 10 test('HTML Doc to JSON', () { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 }; | 74 }; |
75 } | 75 } |
76 | 76 |
77 Future _copyFiles(Path fromDir, Path toDir) { | 77 Future _copyFiles(Path fromDir, Path toDir) { |
78 // First copy the files into a new place to keep the old files. | 78 // First copy the files into a new place to keep the old files. |
79 final completer = new Completer(); | 79 final completer = new Completer(); |
80 final htmlDir = new Directory.fromPath(fromDir); | 80 final htmlDir = new Directory.fromPath(fromDir); |
81 final lister = htmlDir.list(recursive: false); | 81 final lister = htmlDir.list(recursive: false); |
82 | 82 |
83 lister.onFile = (String path) { | 83 lister.onFile = (String path) { |
84 final name = new Path.fromNative(path).filename; | 84 final name = new Path(path).filename; |
85 | 85 |
86 // Ignore private classes. | 86 // Ignore private classes. |
87 if (name.startsWith('_')) return; | 87 if (name.startsWith('_')) return; |
88 | 88 |
89 // Ignore non-dart files. | 89 // Ignore non-dart files. |
90 if (!name.endsWith('.dart')) return; | 90 if (!name.endsWith('.dart')) return; |
91 | 91 |
92 File file = new File(path); | 92 File file = new File(path); |
93 File newFile = new File.fromPath(toDir.append(name)); | 93 File newFile = new File.fromPath(toDir.append(name)); |
94 | 94 |
95 var outputStream = newFile.openOutputStream(); | 95 var outputStream = newFile.openOutputStream(); |
96 outputStream.writeString(file.readAsStringSync()); | 96 outputStream.writeString(file.readAsStringSync()); |
97 }; | 97 }; |
98 | 98 |
99 lister.onDone = (_) { | 99 lister.onDone = (_) { |
100 completer.complete(null); | 100 completer.complete(null); |
101 }; | 101 }; |
102 return completer.future; | 102 return completer.future; |
103 } | 103 } |
OLD | NEW |