Indra allows you to define continuous integration and automation scripts as Dart code. Scripts can be ran from an IDE and debugged. Indra runs as a command line tool or as a daemon with a JSON API. Indra has a user interface that interacts with the daemon.
First, install Dart.
Then, clone Indra from GitHub:
git clone https://github.com/stijnvanbael/indra.git ~/.indra/runtime
Finally, install Indra:
Linux / MacOS:
cd ~/.indra/runtime/bin
./install.sh
Windows:
- Create an environment variable INDRA_HOME = <path\to\indra>\bin
- Add INDRA_HOME to your PATH environment variable
Now you can run any Indra script as
indra <script.dart> [param1=value [param2=value [...]]]
Or in case the file is named build.dart, simply
indra <[param1=value [param2=value [...]]]
Example script: reflective.dart
import 'dart:isolate';
import 'package:indra/src/cli.dart';
import 'package:indra/src/tasks/git.dart';
import 'package:indra/src/tasks/pub.dart';
main(List<String> args, SendPort outputPort) async {
var params = setup(outputPort, args, defaultParams: {'branch': 'dev'});
var git = new GitRepo('[email protected]:stijnvanbael/reflection.git', branch: params['branch']);
await git.cloneOrPull();
await Pub.get();
await Pub.run('test/reflective.dart');
}
To run the script
indra reflective.dart
Indra can also be ran as a daemon:
indra-daemon <working/dir>
Any Dart file under the working directory can be scheduled to run from the daemon by calling:
POST https://localhost:8080/jobs/<name of the file excluding .dart>/schedule
You can request which jobs are running by calling:
GET https://localhost:8080/jobs
You can request the output of a job by calling:
GET https://localhost:8080/jobs/<script name>/<sequence number>/output