1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 03:11:01 +01:00

Update Arcanist documentation.

This commit is contained in:
epriestley 2011-06-26 11:52:10 -07:00
parent f2fcdd39b9
commit 4c2ff4fdee
3 changed files with 57 additions and 33 deletions

View file

@ -1,6 +1,6 @@
{ {
"name" : "Phabricator", "name" : "Phabricator",
"src_base" : "https://github.com/facebook/phabricator/blob/master", "src_base" : "https://secure.phabricator.com/diffusion/P/browse/origin:master",
"groups" : { "groups" : {
"intro" : "Introduction", "intro" : "Introduction",
"config" : "Configuration", "config" : "Configuration",

View file

@ -3,28 +3,27 @@
Explains how to build new classes to control how Arcanist behaves. Explains how to build new classes to control how Arcanist behaves.
NOTE: TODO: This document is pretty trash, follow at your own risk.
= Overview = = Overview =
Arcanist has some basic configuration options available in the ##.arcconfig## Arcanist has some basic configuration options available in the ##.arcconfig##
file (see @{article:Setting Up .arcconfig}), but it can't handle everything. If file (see @{article:Arcanist User Guide: Configuring a New Project}), but it
you want to customize Arcanist at a deeper level, you need to build new classes. can't handle everything. If you want to customize Arcanist at a deeper level,
For instance: you need to build new classes. For instance:
- if you want to configure linters, or add new linters, you need to create a - if you want to configure linters, or add new linters, you need to create a
new class which extends @{class:ArcanistLintEngine}. new class which extends @{class@arcanist:ArcanistLintEngine}.
- if you want to integrate with a unit testing framework, you need to create a - if you want to integrate with a unit testing framework, you need to create a
new class which extends @{class:ArcanistBaseUnitTestEngine}. new class which extends @{class@arcanist:ArcanistBaseUnitTestEngine}.
- if you you want to change how workflows behave, or add new workflows, you - if you you want to change how workflows behave, or add new workflows, you
need to create a new class which extends @{class:ArcanistConfiguration}. need to create a new class which extends
@{class@arcanist:ArcanistConfiguration}.
Arcanist works through a sort of dependency-injection approach. For example, Arcanist works through a sort of dependency-injection approach. For example,
Arcanist does not run lint rules by default, but you can set **lint_engine** Arcanist does not run lint rules by default, but you can set **lint_engine**
in your ##.arcconfig## to the name of a class which extends in your ##.arcconfig## to the name of a class which extends
@{class:ArcanistLintEngine}. When running from inside your project, Arcanist @{class@arcanist:ArcanistLintEngine}. When running from inside your project,
will load this class and call methods on it in order to run lint. To make this Arcanist will load this class and call methods on it in order to run lint. To
work, you need to do three things: make this work, you need to do three things:
- actually write the class; - actually write the class;
- add the library where the class exists to your ##.arcconfig##; - add the library where the class exists to your ##.arcconfig##;
@ -33,7 +32,31 @@ work, you need to do three things:
= Write the Class = = Write the Class =
(TODO) Start by creating a new phutil library -- this is a directory which will contain
class files for Arcanist to load. You can either put it inside your project, or
outside (if you want to share lint rules between several projects, for
instance). To create a new library, run ##arc liberate##:
$ arc liberate path/to/new/library
This will prompt you to name your library and create a new directory on disk.
Create a new ##lint/## directory in this library (or ##unit/##, or whatever you
want). This creates a module. Put ##CustomArcanistLintEngine.php## inside the
##lint/## directory:
lang=php
<?php
class CustomArcanistLintEngine extends ArcanistLintEngine {
}
Now run ##arc liberate## on the library again. Whenever you add, remove, or
rename modules or classes you should run ##arc liberate## to update the
classmap.
You can either write the class body now (refer to the documentation for the
class you are extending) or continue with integrating it into your project.
= Load the Class = = Load the Class =
@ -44,15 +67,16 @@ To make the class loadable, you need to put the path to it in your
// ... // ...
"phutil_libraries" : { "phutil_libraries" : {
// ... // ...
"my-library" : "/path/to/my/library", "library-a" : "/path/to/my/library", // Absolute path
"library-b" : "support/arcanist", // Relative path in this project
// ... // ...
} }
// ... // ...
} }
You can either specify an absolute path, or a path relative to the project root. You can either specify an absolute path, or a path relative to the project root.
When you run ##arc --trace##, you should see a message to the effect that it has When you run ##arc list --trace##, you should see a message to the effect that
loaded your library. it has loaded your library.
For debugging or testing, you can also run Arcanist with the For debugging or testing, you can also run Arcanist with the
##--load-phutil-library## flag: ##--load-phutil-library## flag:
@ -70,7 +94,7 @@ the appropriate configuration value.
{ {
// ... // ...
"lint_engine" : "MyCustomArcanistLintEngine", "lint_engine" : "CustomArcanistLintEngine",
// ... // ...
} }

View file

@ -18,17 +18,14 @@ A simple, valid file looks something like this:
{ {
"project_id" : "some_project_name", "project_id" : "some_project_name",
"conduit_uri" : "https://phabricator.example.com/api/" "conduit_uri" : "https://phabricator.example.com/"
} }
Here's what these options mean: Here's what these options mean:
- **project_id**: a human-readable string identifying the project - **project_id**: a human-readable string identifying the project
- **conduit_uri**: the Conduit API URI for the Phabricator installation that - **conduit_uri**: the URI for the Phabricator installation that Arcanist
Arcanist should send diffs to for review. Generally, if you access should send diffs to for review. Be mindful about "http" vs "https".
Phabricator at ##https://phabricator.example.com/##, the **conduit_uri** is
##https://phabricator.example.com/api/##. Be mindful about "http" vs
"https".
For an exhaustive list of available options, see below. For an exhaustive list of available options, see below.
@ -36,17 +33,20 @@ For an exhaustive list of available options, see below.
Other options include: Other options include:
- **lint_engine**: the name of a subclass of @{class:ArcanistLintEngine}, - **lint_engine**: the name of a subclass of
which should be used to apply lint rules to this project. See (TODO). @{class@arcanist:ArcanistLintEngine}, which should be used to apply lint
rules to this project. See @{article:Arcanist User Guide: Customizing Lint,
Unit Tests and Workflows}.
- **unit_engine**: the name of a subclass of - **unit_engine**: the name of a subclass of
@{class:ArcanistBaseUnitTestEngine}, which should be used to apply unit @{class@arcanist:ArcanistBaseUnitTestEngine}, which should be used to apply
test rules to this project. See (TODO). unit test rules to this project. See
@{article:Arcanist User Guide: Customizing Lint, Unit Tests and Workflows}.
- **arcanist_configuration**: the name of a subclass of - **arcanist_configuration**: the name of a subclass of
@{class:ArcanistConfiguration} which can add new command flags for this @{class@arcanist:ArcanistConfiguration} which can add new command flags for
project or provide entirely new commands. this project or provide entirely new commands.
- **remote_hooks_installed**: tells Arcanist that you've set up remote hooks - **remote_hooks_installed**: tells Arcanist that you've set up remote hooks
in the master repository (see @{article:Installing Arcanist SVN Hooks} for in the master repository (see @{article:Arcanist User Guide: Repository
SVN, or (TODO) for git). Hooks}).
- **copyright_holder**: used by @{class:ArcanistLicenseLinter} to apply - **copyright_holder**: used by @{class@arcanist:ArcanistLicenseLinter} to
license notices to source files. apply license notices to source files.
- **phutil_libraries**: map of additional Phutil libraries to load at startup. - **phutil_libraries**: map of additional Phutil libraries to load at startup.