Pony dependency manager. Manages corral.json (deps/packages/info) and lock.json (locked revisions) files.
make # build + test (unit + integration)
make unit-tests # unit tests only
make test-one t=TestName # run a single test by name
make integration # integration tests only (requires built binary)
make test # both unit and integration
make clean # remove build artifacts
make config=debug # debug build
Tests run via ponyc directly (no corral dependencies needed — it bootstraps itself). The Makefile generates version.pony from version.pony.in using the VERSION file.
Integration tests use the CORRAL_BIN env var (set by Makefile) to locate the built binary. Unit tests run in-process.
corral/
main.pony, cli.pony -- Entry point and CLI spec (subcommands defined here)
version.pony.in -- Template, generates version.pony
cmd/ -- Command implementations
cmd_type.pony -- CmdType trait (requires_bundle, requires_no_bundle, apply)
cmd_update.pony -- CmdUpdate + _Updater actor (the most complex command)
executor.pony -- Resolves dirs, creates Context/Project, dispatches command
context.pony -- Context val: env, log, uout, nothing flag, repo_cache
result_receiver.pony -- CmdResultReceiver interface + NoOpResultReceiver
repo.pony -- RepoForDep: constructs Repo from dep + project
bundle/ -- Core data model
bundle.pony -- Bundle class: loads/saves corral.json + lock.json
dep.pony -- Dep class: wraps DepData + LockData + Locator
data.pony -- Data classes: BundleData, DepData, LockData, etc.
locator.pony -- Locator val: parses "repo_path[.vcs_suffix][/bundle_path]"
project.pony -- Project val + BundleDir + Files primitives
json.pony -- Bundle-specific JSON helpers
vcs/ -- VCS backends (git, hg, bzr, svn, none)
vcs.pony -- VCS interface, Repo class, RepoOperation interface
vcs_builder.pony -- VCSBuilder interface + CorralVCSBuilder
git.pony -- GitVCS (the only fully-featured one)
semver/ -- Semantic versioning (parsing, ranges, constraint solving)
json/ -- Custom JSON handling (not stdlib)
util/ -- Action (Program/Action/ActionResult/Runner), Copy, Log
logger/ -- Logger with levels (Error, Warn, Info, Fine)
test/ -- Test entry point + test utilities
integration/ -- Integration tests (run built binary as subprocess)
testdata/ -- Test fixture bundles (corral.json files, etc.)
- CLI dispatch:
Mainparses CLI ->Executorresolves dirs + createsContext/Project-> callscommand(ctx, project, vcs_builder, result_receiver) - Commands: Each implements
CmdTypetrait. Most load aBundlefrom the project, operate on it, then save. - _Updater: The core actor for
update/fetch. Walks deps transitively, chains VCS operations (sync -> tag_query -> checkout) per dep, collects tags, resolves versions, saves locks. Async via actor behaviors. - VCS operations: Chained as
RepoOperationlambdas:sync_op -> tag_query_op -> checkout_op. Each VCS step spawns the next on completion. - VCSBuilder abstraction: Commands receive a
VCSBuilderinterface, enabling test doubles. Unit tests use_RecordedVCSto count operations without real VCS calls. - Bundle search: Without
--bundle_dir, searches up directory tree forcorral.json. With it, looks only in the specified dir. - Repo cache:
_repos/dir alongside the bundle stores cloned repos._corral/dir stores checked-out workspaces.
- Unit tests (
cmd/_test_cmd_update.pony): Use fake VCS (_RecordedVCS) to verify operation counts (syncs, tag queries, checkouts) without network. Test data fromtest/testdata/. - Integration tests (
test/integration/): Run the actual corral binary viaExecutehelper (usesProcessMonitor).DataClonecopies test fixtures to temp dirs. Tests useh.long_test()with 30s timeouts. - Test registration:
test/_test.ponyis the test Main. Unit tests listed directly; cmd tests delegated viacmd.Main.make().tests(test). - Naming: Integration tests named
"integration/...", unit tests named"cmd/update/..."etc.\nodoc\annotation on test classes.
- Private fields prefixed with
_. Private types prefixed with_. \nodoc\annotation on test actors/classes.- Constructors often use
param'(prime) naming for constructor params that shadow field names. - Logging pattern:
ctx.log(Level) and ctx.log.log("message")— theandshort-circuits so string isn't built if level is filtered. - Error returns as union types:
(SuccessType | ErrorType)rather than exceptions, except?for simple lookup failures. isobundles passed between actors viaconsume.- Capabilities:
Bundlecreated asiso, consumed intorefby actors.Context,Project,Locator,VCS,Repo,Action,Programare allval.