| OLD | NEW |
| 1 /// | 1 /// |
| 2 /// Script to create boilerplate for a Polymer element. | 2 /// Script to create boilerplate for a Polymer element. |
| 3 /// Produces new .html entry point for a polymer app and updates the | 3 /// Produces new .html entry point for a polymer app and updates the |
| 4 /// pubspec.yaml to reflect it. | 4 /// pubspec.yaml to reflect it. |
| 5 /// | 5 /// |
| 6 /// Run this script with pub run: | 6 /// Run this script with pub run: |
| 7 /// | 7 /// |
| 8 /// pub run polymer:new_entry <html_file> | 8 /// pub run polymer:new_entry <html_file> |
| 9 /// | 9 /// |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Returns true if the pubspec file was modified. It might not be modified if | 88 // Returns true if the pubspec file was modified. It might not be modified if |
| 89 // there was a monolithic polymer transformer in the pubspec, or if the entry | 89 // there was a monolithic polymer transformer in the pubspec, or if the entry |
| 90 // point for some reason already existed in the pubspec. | 90 // point for some reason already existed in the pubspec. |
| 91 bool _createBoilerPlate(String entryPoint, String pubspecDir) { | 91 bool _createBoilerPlate(String entryPoint, String pubspecDir) { |
| 92 | 92 |
| 93 String html = ''' | 93 String html = ''' |
| 94 <!doctype html> | 94 <!doctype html> |
| 95 <html> | 95 <html> |
| 96 <head> | 96 <head> |
| 97 <script src="packages/web_components/platform.js"></script> | |
| 98 <script src="packages/web_components/dart_support.js"></script> | 97 <script src="packages/web_components/dart_support.js"></script> |
| 99 | 98 |
| 100 <!-- link rel="import" href="path_to_html_import.html" --> | 99 <!-- link rel="import" href="path_to_html_import.html" --> |
| 101 </head> | 100 </head> |
| 102 <body> | 101 <body> |
| 103 <!-- HTML for body here --> | 102 <!-- HTML for body here --> |
| 104 <script type="application/dart">export 'package:polymer/init.dart';</script> | 103 <script type="application/dart">export 'package:polymer/init.dart';</script> |
| 105 </body> | 104 </body> |
| 106 </html> | 105 </html> |
| 107 '''; | 106 '''; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 '${textToInsert}\n${pubspecText.substring(insertionPoint)}'; | 179 '${textToInsert}\n${pubspecText.substring(insertionPoint)}'; |
| 181 } | 180 } |
| 182 | 181 |
| 183 _writePubspec(pubspecPath, pubspecText); | 182 _writePubspec(pubspecPath, pubspecText); |
| 184 return true; | 183 return true; |
| 185 } | 184 } |
| 186 | 185 |
| 187 _writePubspec(String pubspecPath, String text) { | 186 _writePubspec(String pubspecPath, String text) { |
| 188 new File(pubspecPath).writeAsStringSync(text); | 187 new File(pubspecPath).writeAsStringSync(text); |
| 189 } | 188 } |
| OLD | NEW |