diff --git a/lib/src/commands/init.dart b/lib/src/commands/init.dart index c7da329e..4ce56e9d 100644 --- a/lib/src/commands/init.dart +++ b/lib/src/commands/init.dart @@ -4,7 +4,7 @@ import "package:args/command_runner.dart"; import 'package:io/ansi.dart'; import 'package:path/path.dart' as p; import 'package:prompts/prompts.dart' as prompts; -import 'package:random_string/random_string.dart' as rs; +import '../random_string.dart' as rs; import '../util.dart'; import 'key.dart'; import 'pub.dart'; diff --git a/lib/src/commands/key.dart b/lib/src/commands/key.dart index f2a66f7a..296be621 100644 --- a/lib/src/commands/key.dart +++ b/lib/src/commands/key.dart @@ -1,6 +1,6 @@ import 'dart:io'; import 'package:args/command_runner.dart'; -import 'package:random_string/random_string.dart' as rs; +import '../random_string.dart' as rs; class KeyCommand extends Command { @override diff --git a/lib/src/random_string.dart b/lib/src/random_string.dart new file mode 100644 index 00000000..c089e870 --- /dev/null +++ b/lib/src/random_string.dart @@ -0,0 +1,15 @@ +import 'dart:math'; + +const String _valid = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; +final Random _rnd = new Random.secure(); + +String randomAlphaNumeric(int length) { + var b = new StringBuffer(); + + for (int i = 0; i < length; i++) { + b.writeCharCode(_valid.codeUnitAt(_rnd.nextInt(_valid.length))); + } + + return b.toString(); +} diff --git a/pubspec.yaml b/pubspec.yaml index 06546a9f..15cde314 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/angel-dart/angel_cli name: angel_cli version: 1.3.0 dependencies: - # analyzer: ^0.29.0 + analyzer: ">=0.32.0" args: ^1.0.0 code_builder: ^3.0.0 dart_style: ^1.0.0 @@ -18,7 +18,7 @@ dependencies: path: ^1.0.0 prompts: ^1.0.0 pubspec_parse: ^0.1.2 - random_string: ^0.0.1 + quiver: ">=0.29.0" recase: ^1.0.0 watcher: ^0.9.7 yaml: ^2.0.0