From dc8b25da23a9c21da96e924ab79a77999aa43ea9 Mon Sep 17 00:00:00 2001 From: Kevin Moore <kevmoo@google.com> Date: Fri, 15 Jul 2016 15:07:08 -0700 Subject: [PATCH] update dependencies --- lib/src/common.dart | 10 +++++----- pubspec.yaml | 7 +++---- tool/grind.dart | 23 ++++++++++++++++++++--- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/src/common.dart b/lib/src/common.dart index a031784..44ec651 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 3ba491e..9878941 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/tool/grind.dart b/tool/grind.dart index 200473c..5d116c9 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'); } } } -- GitLab