1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 09:38:50 +02:00
phorge-arcanist/src/workflow/ArcanistSetConfigWorkflow.php

158 lines
4.1 KiB
PHP
Raw Normal View History

<?php
/**
* Write configuration settings.
*
* @group workflow
*/
final class ArcanistSetConfigWorkflow extends ArcanistBaseWorkflow {
public function getWorkflowName() {
return 'set-config';
}
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
**set-config** [__options__] -- __name__ __value__
EOTEXT
);
}
public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT
Supports: cli
Sets an arc configuration option.
Options are either user (apply to all arc commands you invoke
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
from the current user) or local (apply only to the current working
copy). By default, user configuration is written. Use __--local__
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
to write local configuration.
User values are written to '~/.arcrc' on Linux and Mac OS X, and an
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
undisclosed location on Windows. Local values are written to an arc
directory under either .git, .hg, or .svn as appropriate.
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
With __--show__, a description of supported configuration values
is shown.
EOTEXT
);
}
public function getArguments() {
return array(
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
'show' => array(
'help' => 'Show available configuration values.',
),
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
'local' => array(
'help' => 'Set a local config value instead of a user one',
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
),
'*' => 'argv',
);
}
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
public function requiresRepositoryAPI() {
return $this->getArgument('local');
}
public function run() {
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
if ($this->getArgument('show')) {
return $this->show();
}
$argv = $this->getArgument('argv');
if (count($argv) != 2) {
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
throw new ArcanistUsageException(
"Specify a key and a value, or --show.");
}
$configuration_manager = $this->getConfigurationManager();
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
$is_local = $this->getArgument('local');
if ($is_local) {
$config = $configuration_manager->readLocalArcConfig();
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
$which = 'local';
} else {
$config = $configuration_manager->readUserArcConfig();
$which = 'user';
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
}
$key = $argv[0];
$val = $argv[1];
$settings = new ArcanistSettings();
$old = null;
if (array_key_exists($key, $config)) {
$old = $config[$key];
}
if (!strlen($val)) {
unset($config[$key]);
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
if ($is_local) {
$configuration_manager->writeLocalArcConfig($config);
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
} else {
$configuration_manager->writeUserArcConfig($config);
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
}
$old = $settings->formatConfigValueForDisplay($key, $old);
if ($old === null) {
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
echo "Deleted key '{$key}' from {$which} config.\n";
} else {
echo "Deleted key '{$key}' from {$which} config (was {$old}).\n";
}
} else {
$val = $settings->willWriteValue($key, $val);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
$config[$key] = $val;
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
if ($is_local) {
$configuration_manager->writeLocalArcConfig($config);
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
} else {
$configuration_manager->writeUserArcConfig($config);
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
}
$val = $settings->formatConfigValueForDisplay($key, $val);
$old = $settings->formatConfigValueForDisplay($key, $old);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
if ($old === null) {
echo "Set key '{$key}' = {$val} in {$which} config.\n";
} else {
echo "Set key '{$key}' = {$val} in {$which} config (was {$old}).\n";
}
}
return 0;
}
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
private function show() {
$config = $this->getConfigurationManager()->readUserArcConfig();
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
$settings = new ArcanistSettings();
$keys = $settings->getAllKeys();
sort($keys);
foreach ($keys as $key) {
$type = $settings->getType($key);
$example = $settings->getExample($key);
$help = $settings->getHelp($key);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
$value = idx($config, $key);
$value = $settings->formatConfigValueForDisplay($key, $value);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
echo phutil_console_format("**__%s__** (%s)\n\n", $key, $type);
if ($example !== null) {
echo phutil_console_format(" Example: %s\n", $example);
}
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
if (strlen($value)) {
echo phutil_console_format(" User Setting: %s\n", $value);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
}
echo "\n";
echo phutil_console_wrap($help, 4);
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00
echo "\n\n\n";
}
return 0;
}
}