Skip to content

Commit

Permalink
Merge pull request #235 from bwu-dart-contributing/dartformat
Browse files Browse the repository at this point in the history
apply dartformat
  • Loading branch information
devoncarew committed May 16, 2015
2 parents 408d47f + bb3cac6 commit a2bd96f
Show file tree
Hide file tree
Showing 20 changed files with 366 additions and 368 deletions.
15 changes: 8 additions & 7 deletions bin/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import 'package:grinder/grinder.dart';
*/
void main(List<String> args) {
if (args.length != 1) {
print(
'usage: pub global run grinder:test <filepath>');
print(
' where <filepath> is either a .dart file (for CLI tests), '
print('usage: pub global run grinder:test <filepath>');
print(' where <filepath> is either a .dart file (for CLI tests), '
'or an .html file (for web tests).');
exit(1);
}
Expand All @@ -25,7 +23,8 @@ void main(List<String> args) {

if (path.endsWith('.dart')) {
if (path.contains(Platform.pathSeparator)) {
String directory = path.substring(0, path.indexOf(Platform.pathSeparator));
String directory =
path.substring(0, path.indexOf(Platform.pathSeparator));
path = path.substring(path.indexOf(Platform.pathSeparator) + 1);
Tests.runCliTests(directory: directory, testFile: path);
} else {
Expand All @@ -40,11 +39,13 @@ void main(List<String> args) {
}
String directory = path.substring(0, index);
path = path.substring(index + 1);
Tests.runWebTests(directory: directory, htmlFile: path)
Tests
.runWebTests(directory: directory, htmlFile: path)
.then((_) => exit(0))
.catchError((e) => exit(1));
} else {
Tests.runWebTests(htmlFile: path)
Tests
.runWebTests(htmlFile: path)
.then((_) => exit(0))
.catchError((e) => exit(1));
}
Expand Down
24 changes: 16 additions & 8 deletions lib/grinder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ set defaultTask(GrinderTask v) {
* in via [depends].
*/
@Deprecated('Use the task annotations instead.')
void task(String name, [Function taskFunction, List<String> depends = const []]) {
void task(String name,
[Function taskFunction, List<String> depends = const []]) {
grinder.addTask(
new GrinderTask(name, taskFunction: taskFunction, depends: depends));
}
Expand Down Expand Up @@ -168,7 +169,7 @@ class GrinderTask {
* execute when this task is started, and a [depends] list are optional.
*/
GrinderTask(this.name,
{this.taskFunction, this.depends : const [], this.description}) {
{this.taskFunction, this.depends: const [], this.description}) {
if (taskFunction == null && depends.isEmpty) {
throw new GrinderException('GrinderTasks must have a task function or '
'dependencies.');
Expand Down Expand Up @@ -224,9 +225,16 @@ class Depends {
const Depends(this.dep1, [this.dep2, this.dep3, this.dep4, this.dep5,
this.dep6, this.dep7, this.dep8]);

List get depends => [dep1, dep2, dep3, dep4, dep5, dep6, dep7, dep8]
.takeWhile((dep) => dep != null)
.toList();
List get depends => [
dep1,
dep2,
dep3,
dep4,
dep5,
dep6,
dep7,
dep8
].takeWhile((dep) => dep != null).toList();
}

/**
Expand All @@ -236,8 +244,7 @@ class Depends {
* Use this instead of [Task] when defining the default task.
*/
class DefaultTask extends Task {
const DefaultTask([String description])
: super(description);
const DefaultTask([String description]) : super(description);
}

/**
Expand Down Expand Up @@ -414,7 +421,8 @@ class Grinder {
}
}

Set<GrinderTask> _calcDependencies(GrinderTask task, Set<GrinderTask> foundTasks) {
Set<GrinderTask> _calcDependencies(
GrinderTask task, Set<GrinderTask> foundTasks) {
for (GrinderTask childTask in getImmediateDependencies(task)) {
bool contains = foundTasks.contains(childTask);
foundTasks.add(childTask);
Expand Down
17 changes: 11 additions & 6 deletions lib/grinder_files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ class FileSet {

// TODO: have a refresh method?

static void _collect(List<File> files, Directory dir, Glob glob, bool recurse) {
for (FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) {
static void _collect(
List<File> files, Directory dir, Glob glob, bool recurse) {
for (FileSystemEntity entity
in dir.listSync(recursive: false, followLinks: false)) {
String name = fileName(entity);

if (entity is File) {
Expand Down Expand Up @@ -237,7 +239,7 @@ class FilePath {

/// Join the given path elements to this path, and return a new [FilePath] object.
FilePath join([arg0, String arg1, String arg2, String arg3, String arg4,
String arg5, String arg6, String arg7, String arg8, String arg9]) {
String arg5, String arg6, String arg7, String arg8, String arg9]) {
List paths = [path];

if (arg0 is List) {
Expand Down Expand Up @@ -346,12 +348,14 @@ Directory getDir(String path) {
}
}

void copy(FileSystemEntity entity, Directory destDir, [GrinderContext context]) {
void copy(FileSystemEntity entity, Directory destDir,
[GrinderContext context]) {
log('copying ${entity.path} to ${destDir.path}');
return _copyImpl(entity, destDir, context);
}

void _copyImpl(FileSystemEntity entity, Directory destDir, [GrinderContext context]) {
void _copyImpl(FileSystemEntity entity, Directory destDir,
[GrinderContext context]) {
if (entity is Directory) {
for (FileSystemEntity entity in entity.listSync()) {
String name = fileName(entity);
Expand Down Expand Up @@ -391,7 +395,8 @@ void copyFile(File srcFile, Directory destDir, [GrinderContext context]) {
}

@Deprecated('deprecated in favor of copy()')
void copyDirectory(Directory srcDir, Directory destDir, [GrinderContext context]) {
void copyDirectory(Directory srcDir, Directory destDir,
[GrinderContext context]) {
copy(srcDir, destDir, context);
}

Expand Down
Loading

0 comments on commit a2bd96f

Please sign in to comment.