diff --git a/lib/generators/web_polymer_data.dart b/lib/generators/web_polymer_data.dart index 5b9ac701a5299ac8c2beb2621f616de54b1aac21..97e656258c8fb516b655d6daded30eda5fbaade5 100644 --- a/lib/generators/web_polymer_data.dart +++ b/lib/generators/web_polymer_data.dart @@ -52,28 +52,28 @@ SVRZIE9GIFNVQ0ggREFNQUdFLgo=""", """Ly8gQ29weXJpZ2h0IChjKSBfX3llYXJfXywgX19hdXRob3JfXy4gQWxsIHJpZ2h0cyByZXNlcnZl ZC4gVXNlIG9mIHRoaXMgc291cmNlIGNvZGUKLy8gaXMgZ292ZXJuZWQgYnkgYSBCU0Qtc3R5bGUg bGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLgpASHRtbEltcG9y -dCgnbWFpbl9hcHAuaHRtbCcpCmxpYnJhcnkgX19wcm9qZWN0TmFtZV9fLmxpYi5tYWluX2FwcDsJ -CQoKaW1wb3J0ICdkYXJ0Omh0bWwnOwoKaW1wb3J0ICdwYWNrYWdlOnBvbHltZXJfZWxlbWVudHMv -cGFwZXJfaW5wdXQuZGFydCc7CmltcG9ydCAncGFja2FnZTpwb2x5bWVyL3BvbHltZXIuZGFydCc7 -CmltcG9ydCAncGFja2FnZTp3ZWJfY29tcG9uZW50cy93ZWJfY29tcG9uZW50cy5kYXJ0JzsKCi8v -LyBVc2VzIFtQYXBlcklucHV0XQpAUG9seW1lclJlZ2lzdGVyKCdtYWluLWFwcCcpCmNsYXNzIE1h -aW5BcHAgZXh0ZW5kcyBQb2x5bWVyRWxlbWVudCB7CiAgQHByb3BlcnR5CiAgU3RyaW5nIHRleHQ7 -CgogIC8vLyBDb25zdHJ1Y3RvciB1c2VkIHRvIGNyZWF0ZSBpbnN0YW5jZSBvZiBNYWluQXBwLgog -IE1haW5BcHAuY3JlYXRlZCgpIDogc3VwZXIuY3JlYXRlZCgpOwoKICBAcmVmbGVjdGFibGUKICBT -dHJpbmcgcmV2ZXJzZVRleHQo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Blci5kZXRhY2hlZCgpOwovLyAgfQoKLy8gIC8vLyBDYWxsZWQgd2hlbiBhbiBhdHRy +aWJ1dGUgKHN1Y2ggYXMgYSBjbGFzcykgb2YgYW4gaW5zdGFuY2Ugb2YKLy8gIC8vLyBtYWluLWFw +cCBpcyBhZGRlZCwgY2hhbmdlZCwgb3IgcmVtb3ZlZC4KLy8gIGF0dHJpYnV0ZUNoYW5nZWQoU3Ry +aW5nIG5hbWUsIFN0cmluZyBvbGRWYWx1ZSwgU3RyaW5nIG5ld1ZhbHVlKSB7Ci8vICAgIHN1cGVy +LmF0dHJpYnV0ZUNoYW5nZWQobmFtZSwgb2xkVmFsdWUsIG5ld1ZhbHVlKTsKLy8gIH0KCi8vICAv +Ly8gQ2FsbGVkIHdoZW4gbWFpbi1hcHAgaGFzIGJlZW4gZnVsbHkgcHJlcGFyZWQgKFNoYWRvdyBE +T00gY3JlYXRlZCwKLy8gIC8vLyBwcm9wZXJ0eSBvYnNlcnZlcnMgc2V0IHVwLCBldmVudCBsaXN0 +ZW5lcnMgYXR0YWNoZWQpLgovLyAgcmVhZHkoKSB7Ci8vICB9Cn0K""", "lib/main_app.html", "text", """PCEtLQogIENvcHlyaWdodCAoYykgX195ZWFyX18sIF9fYXV0aG9yX18uIEFsbCByaWdodHMgcmVz diff --git a/lib/src/common.dart b/lib/src/common.dart index a031784cd4d402d4e7b3cc4beec969160afe95cd..44ec6513dc45047b47844dd7d5e7b71ca7127acf 100644 --- a/lib/src/common.dart +++ b/lib/src/common.dart @@ -6,9 +6,7 @@ * Some utility methods for stagehand. */ -import 'dart:convert' show UTF8; - -import 'package:crypto/crypto.dart'; +import 'dart:convert' show BASE64, UTF8; import '../stagehand.dart'; @@ -17,15 +15,17 @@ const int _RUNE_SPACE = 32; final _substitueRegExp = new RegExp(r'__([a-zA-Z]+)__'); final _nonValidSubstitueRegExp = new RegExp('[^a-zA-Z]'); +final _whiteSpace = new RegExp(r'\s+'); + List<TemplateFile> decodeConcatenatedData(List<String> data) { List<TemplateFile> results = []; for (int i = 0; i < data.length; i += 3) { String path = data[i]; String type = data[i + 1]; - String raw = data[i + 2]; + String raw = data[i + 2].replaceAll(_whiteSpace, ''); - List<int> decoded = CryptoUtils.base64StringToBytes(raw); + List<int> decoded = BASE64.decode(raw); if (type == 'binary') { results.add(new TemplateFile.fromBinary(path, decoded)); diff --git a/pubspec.yaml b/pubspec.yaml index 3ba491ec7014eb0a160828bcb0997c6ff33447e5..9878941263649ae4842923cbdbcb49d8e71c3857 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ name: stagehand # When changing this version, change the lib/src/cli_app.dart version as well. -version: 1.0.9 +version: 1.0.10-dev description: > A scaffolding generator for your Dart projects. Stagehand helps you get set up! @@ -15,7 +15,7 @@ authors: - Kathy Walrath <kathyw@google.com> environment: - sdk: '>=1.9.0 <2.0.0' + sdk: '>=1.13.0 <2.0.0' # Add the bin/stagehand.dart script to the scripts pub installs. executables: @@ -23,14 +23,13 @@ executables: dependencies: args: '>=0.12.0+1 <0.14.0' - crypto: ^0.9.0 http: ^0.11.0 path: ^1.3.0 usage: ^1.0.0 dev_dependencies: browser: ^0.10.0 - ghpages_generator: ^0.2.4 + ghpages_generator: ^0.3.0 grinder: ^0.8.0 test: ^0.12.0 yaml: ^2.1.2 diff --git a/templates/web-polymer/lib/main_app.dart b/templates/web-polymer/lib/main_app.dart index 6a5ec6813d26234c95b51c7918b992845d39cd6c..f2be3a6e4ee646971b7258d47dc78905362b3728 100644 --- a/templates/web-polymer/lib/main_app.dart +++ b/templates/web-polymer/lib/main_app.dart @@ -1,7 +1,7 @@ // Copyright (c) __year__, __author__. All rights reserved. Use of this source code // is governed by a BSD-style license that can be found in the LICENSE file. @HtmlImport('main_app.html') -library __projectName__.lib.main_app; +library __projectName__.lib.main_app; import 'dart:html'; diff --git a/tool/grind.dart b/tool/grind.dart index 200473c4e49bd41ad622e10dfa9aa4954e5d5e5d..5d116c9bbd46fe54908b7d599d3e0ba6347f00c3 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -3,8 +3,9 @@ // license that can be found in the LICENSE file. import 'dart:io'; +import 'dart:convert'; +import 'dart:math' as math; -import 'package:crypto/crypto.dart'; import 'package:ghpages_generator/ghpages_generator.dart' as ghpages; import 'package:grinder/grinder.dart'; import 'package:path/path.dart' as path; @@ -95,8 +96,24 @@ Iterable<String> _traverse(Directory dir, String root) sync* { } else { yield '${root}${name}'; yield _isBinaryFile(name) ? 'binary' : 'text'; - yield BASE64.encode((entity as File).readAsBytesSync(), - addLineSeparator: true); + + var encoded = BASE64.encode((entity as File).readAsBytesSync()); + + // + // Logic to cut lines into 76-character chunks + // – makes for prettier source code + // + var lines = <String>[]; + var index = 0; + + while (index < encoded.length) { + var line = + encoded.substring(index, math.min(index + 76, encoded.length)); + lines.add(line); + index += line.length; + } + + yield lines.join('\r\n'); } } }