Dart workflows, automated.
Grinder consists of a library to define project tasks (e.g. test, build, doc), and a command-line tool to run them.
To start using grinder
, add it to your dev_dependencies.
Tasks are defined entirely by Dart code allowing you to take advantage of
the whole Dart ecosystem to write and debug them. Task definitions reside
in a tool/grind.dart
script. To create a simple grinder script, run:
pub run grinder:init
In general, grinder scripts look something like this:
import 'package:grinder/grinder.dart';
main(args) => grind(args);
@Task('Test stuff.')
test() {
new PubApp.local('test').run([]);
}
@DefaultTask('Build the project.')
@Depends(test)
build() {
log("Building...");
}
@Task('Generate docs.')
@Depends(test)
doc() {
log("Generating docs...");
}
Any task dependencies (see @Depends
above), are run before the dependent task.
Grinder contains a variety of convenience APIs for common task definitions, such as
PubApp
referenced above. See the API Documentation for full details.
First install the grind
executable:
pub global activate grinder
then use it to run desired tasks:
grind test
grind build doc
or to run a default task (see @DefaultTask
above):
grind
or to display a list of available tasks and their dependencies:
grind -h
or to tab-complete your tasks (thanks to unscripted):
grind --completion install
. ~/.bashrc
grind [TAB][TAB]
build test doc
grind b[TAB]
grind build
You can also bypass installing grind
, and instead use
pub run grinder:grinder
, or in Dart SDK 1.10, simply pub run grinder
.
This is not an official Google product.
Dart.runAsync
static method.files
param to TestRunner.test
.grind --completion install
command to install tab-completion for task names
and options in grind
.grind -h
(help) output.Dart.run
now takes an optional vmArgs
, a list of arguments passed to the Dart VM.downgrade
method do Pub
.RunOptions
to support all Process.run
/Process.start
parameters. The workingDirectory
parameter is now deprecated in all methods,
use RunOptions.workingDirectory
instead.PubApp.runAsync
.Dart.run
, deprecate the vmNewGenHeapMB and vmOldGenHeapMB options.DartFmt.format()
.Analyzer.analyzeFiles
is deprecated in favor of Analyzer.analyze
.Pub.global.list()
method to list the installed applications.TestRunner
class - a wrapper around the new test
package.GrinderContext
arg is no longer expected in task functions. Instead, the
context
variable (and the log
and fail
functions) are available as global
variables. They're injected into the zone running the current task.pub [global] run grinder:grind
no longer work, use
pub [global] run grinder
instead. Add :grinder
if using pub run
in Dart SDK < 1.10.copyFile
and copyDirectory
and deprecated in favor of a new copy
methoddeleteEntity
is deprecated in favor of a new delete
methodrunProcess
/runProcessAsync
/runDartScript
to run
/runAsync
/Dart.run
.
Process result info (stdout, stderr, exitCode) is now exposed by these
methods and some others which call them.pub global activate/run
/pub run
applications - PubApp
pub run grinder:init
defaultInit()
and defaultClean()
methods, for common tasksworkingDirectory
argument to more methods--version
command line flagtools/grind.dart
getSdkDir
methodquiver
args
The convenience API is now more terse:
defineTask()
method has been renamed to task()
task()
function now uses optional
positional parametersAdded two new entrypoint files in bin/
: grind.dart
and grinder.dart
. These
let you run grinder via:
pub run grinder test
They look for a corresponding grinder script in the tool
directory
(bin/grind.dart
looks for tool/grind.dart
and bin/grinder.dart
looks for
tool/grinder.dart
). If they find a corresponding script they run it in a new
Dart VM process. This means that projects will no longer have to have a
grind.sh
script in the root of each project.
PubTool's build methods now take an optional workingDirectory
argument.
Removed runSdkBinary
and runSdkBinaryAsync
, and they are no longer needed.
Use runProcess
and runProcessAsync
instead.
The methods on PubTools
and Dart2jsTools
are now static - you no longer need
to create an instance to use them. Also, PubTools
was renamed to Pub
and
Dart2jsTools
was renamed to Dart2js
. And a new utility class for
dartanalyzer - Analyzer
- was created.
runProcessAsync()
and related async methods (such as
PubTools.buildAsync(...)
)Add this to your package's pubspec.yaml file:
dependencies:
grinder: "^0.7.1+3"
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:grinder/grinder.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.8.1 | Dec 19, 2017 |
|
|
0.8.0+3 | Oct 16, 2016 |
|
|
0.8.0+2 | Jan 27, 2016 |
|
|
0.8.0+1 | Nov 13, 2015 |
|
|
0.8.0 | Oct 29, 2015 |
|
|
0.7.2 | Jul 9, 2015 |
|
|
0.7.1+3 | May 24, 2015 |
|
|
0.7.1+2 | May 24, 2015 |
|
|
0.7.1+1 | May 20, 2015 |
|
|
0.7.1 | May 19, 2015 |
|
|
This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.