| OLD | NEW |
| 1 import 'dart:async'; | 1 import 'dart:async'; |
| 2 import 'dart:io'; | 2 import 'dart:io'; |
| 3 import 'package:html5lib/dom.dart'; | 3 import 'package:html5lib/dom.dart'; |
| 4 import 'package:html5lib/parser.dart'; | 4 import 'package:html5lib/parser.dart'; |
| 5 import 'package:html5lib/dom_parsing.dart'; | 5 import 'package:html5lib/dom_parsing.dart'; |
| 6 import 'package:web_ui/component_build.dart' as build_utils; | 6 import 'package:web_ui/component_build.dart' as build_utils; |
| 7 import 'package:bot/bot.dart'; | 7 import 'package:bot/bot.dart'; |
| 8 | 8 |
| 9 final _whitespaceRegex = new RegExp(r'\s+'); | 9 final _whitespaceRegex = new RegExp(r'\s+'); |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 Future<bool> _updateIfChanged(String filePath, String newContent) { | 97 Future<bool> _updateIfChanged(String filePath, String newContent) { |
| 98 final file = new File(filePath); | 98 final file = new File(filePath); |
| 99 return file.exists() | 99 return file.exists() |
| 100 .then((bool exists) { | 100 .then((bool exists) { |
| 101 if(exists) { | 101 if(exists) { |
| 102 return file.readAsString() | 102 return file.readAsString() |
| 103 .then((String content) => content != newContent); | 103 .then((String content) => content != newContent); |
| 104 } else { | 104 } else { |
| 105 return new Future.immediate(true); | 105 return new Future.value(true); |
| 106 } | 106 } |
| 107 }).then((bool shouldUpdate) { | 107 }).then((bool shouldUpdate) { |
| 108 if(shouldUpdate) { | 108 if(shouldUpdate) { |
| 109 return file.writeAsString(newContent) | 109 return file.writeAsString(newContent) |
| 110 .then((_) => true); | 110 .then((_) => true); |
| 111 } else { | 111 } else { |
| 112 return new Future.immediate(false); | 112 return new Future.value(false); |
| 113 } | 113 } |
| 114 }); | 114 }); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // TODO: crazy hack. Really need select recursive | 117 // TODO: crazy hack. Really need select recursive |
| 118 // or propery query support...whichever | 118 // or propery query support...whichever |
| 119 List<Element> _findElements(Element element, Func1<Element, bool> predicate, [Li
st<Element> target]) { | 119 List<Element> _findElements(Element element, Func1<Element, bool> predicate, [Li
st<Element> target]) { |
| 120 if(target == null) { | 120 if(target == null) { |
| 121 target = new List<Element>(); | 121 target = new List<Element>(); |
| 122 } | 122 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 }); | 228 }); |
| 229 | 229 |
| 230 for(var i = 0; i < lines.length; i++) { | 230 for(var i = 0; i < lines.length; i++) { |
| 231 lines[i] = lines[i].substring(minPrefix); | 231 lines[i] = lines[i].substring(minPrefix); |
| 232 } | 232 } |
| 233 | 233 |
| 234 input = lines.join('\n'); | 234 input = lines.join('\n'); |
| 235 | 235 |
| 236 return input; | 236 return input; |
| 237 } | 237 } |
| OLD | NEW |