Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
sstok committed Apr 17, 2024
1 parent 9efc1b3 commit c82177d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
69 changes: 35 additions & 34 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The `schema_version` defines configuration schema version.

Since HuPKit v1.2 `schema_version` 2 should be used with the correct structure.

While `schema_version` 1 is still supported until HuPKit 2.0, it will
While `schema_version` 1 is still supported until HuPKit 2.0, it will
produce a warning message everytime HuPKit is used.

The new configuration schema provides for some powerful features including
The new configuration schema provides for some powerful features including
a local configuration file and per branch configuration.

Authentication
Expand Down Expand Up @@ -64,16 +64,16 @@ in the main `config.php` file which also contains your credentials.

Since HuPKit v1.2 it's possible to use a local configuration housed in the repository itself.

The configuration (and hook-scripts) are kept in a 'orphaned' branch "_hubkit"
(please notice the hu**b** not hu**p**!).
The configuration (and hook-scripts) are kept in a 'orphaned' branch "_hubkit"
(please notice the hu**b** not hu**p**!).

_An orphan branch has no relation to any other branch, it's fully separate,
_An orphan branch has no relation to any other branch, it's fully separate,
and thus no common parent. This same technique is also used by GitHub for
pages stored separate from the main branch._

**No authentication credentials must be stored in local configuration!**

This file contains the configuration _only_ for the current repository and supersedes
This file contains the configuration _only_ for the current repository and supersedes
the repository configuration entry in the main `config.php` for _this_ repository.

```php
Expand All @@ -82,19 +82,20 @@ the repository configuration entry in the main `config.php` for _this_ repositor

return [
'schema_version' => 2,

// Adapter configuration (optional, when cannot be resolved automatically)
'adapter' => 'github', //Defaults to github, currently no other adapters supported
'host' => 'github.com',
'repository' => 'organization/repository-name',

// Since v1.3 - which branch is considered the main branch. Either: 'main', 'master', '2.0', or 'trunk'
// This configuration is used (among) for upmerging as know the last branch in the list.
//
// If not set this is automatically guessed at application boot, in v2.0 this will default to 'main'.
// If not set this is automatically guessed at application boot, in v2.0 this will default to 'main'.
// Note: This configuration can only be used in local configuration
//'main_branch' => null,
// See branches section below for supported configuration

// See branches section below for supported configuration
'branches' => [],

// Branches-alias for 'unstable' branches
Expand All @@ -115,33 +116,33 @@ To create the special branch that HuPKit uses to store the config.php file and s
additional scripts for special operations, run the `init-config` command.

The command will automatically import any existing configuration for the repository
from the main `config.php`, and all files stored in the ".hubkit" directory
from the main `config.php`, and all files stored in the ".hubkit" directory
(of the current branch).

**Note:** The .gitignore is automatically copied from your current branch to ensure
no unrelated files are accidentally added when working on this branch.
**Note:** The .gitignore is automatically copied from your current branch to ensure
no unrelated files are accidentally added when working on this branch.

The _hubkit branch sits separate from your normal Git workflow and shares
The _hubkit branch sits separate from your normal Git workflow and shares
no parenting to any existing branch.

Once you are done run the `sync-config` command to push your changes.

Use the `self-diagnose` command to check your configuration and see if any
Use the `self-diagnose` command to check your configuration and see if any
updated is needed.

#### Editing

To change the contents of the _hubkit branch run the `edit-config` command.

**Note:** If this fails due to a configuration error run HuPKit with the
**Note:** If this fails due to a configuration error run HuPKit with the
env `HUBKIT_NO_LOCAL=true` like `HUBKIT_NO_LOCAL=true hupkit self-diagnose`.

### Synchronize Configuration

To update the configuration by either pushing your changes or pulling-in
To update the configuration by either pushing your changes or pulling-in
the latest version from "upstream" simply run the `sync-config` command.

Only if your branches have diverged to much you need to resolve any
Only if your branches have diverged to much you need to resolve any
conflicts manually. Once done run the command again.

### Configuration in the main config.php
Expand Down Expand Up @@ -171,7 +172,7 @@ return [
'repositories' => [
'github.com' => [
'organization/repository-name' => [
'branches' => [] // See branches section below for supported configuration
'branches' => [] // See branches section below for supported configuration
],
],
],
Expand All @@ -183,31 +184,31 @@ return [
Each repository has a 'branches' configuration to either set the configuration
for all branches using `:default`, or per specific branch `2.0`.

A branch name can be either `:default` (see below), `main` _or_ `master`,
a minor-version pattern `2.x`/`v2.*`, or a regexp (without anchors or options)
A branch name can be either `:default` (see below), `main` _or_ `master`,
a minor-version pattern `2.x`/`v2.*`, or a regexp (without anchors or options)
like `/[1-2]\.\d+/`.

**Note:** When an actual branch is named like a pattern (`1.x`) use `#1.x` instead.

The `:default` branch defines the default configuration for all branches, and
The `:default` branch defines the default configuration for all branches, and
is later merged with the configuration of a specific branch. Use `'ignore-default' => true`
for a specific branch configuration to ignore inherited defaults.

When no specific branch is found like 'main' or '2.1' the correct configuration
is resolved by traversing all (in order of listing) the patterns and regexp
When no specific branch is found like 'main' or '2.1' the correct configuration
is resolved by traversing all (in order of listing) the patterns and regexp
until a matching version is found.

If no configuration was found the `:default` configuration (if set) is used.

Use `false` to mark a branch as unmaintained and skip upmerging to *and*
from this branch, this will give a warning whenever this branch is used
for either merging, releasing, taking an issue, etc.
Use `false` to mark a branch as unmaintained and skip upmerging to *and*
from this branch, this will give a warning whenever this branch is used
for either merging, releasing, taking an issue, etc.

**Tip:** Use regex ranges like `/[12].\d+/` to mark multiple versions at once.

Each branch has the following options:

| Name | Type | Default | Description |
| Name | Type | Default | Description |
|------------------|---------|-----------|------------------------------------------------------------------------------------------------------------------|
| `sync-tags` | Boolean | `true` | _Only when 'split' targets are configured_,<br/>whether new tags should be synchronized when creating a release. |
| `ignore-default` | Boolean | `false` | Whether the ':default' configuration should be ignored. |
Expand Down Expand Up @@ -258,15 +259,15 @@ Each branch has the following options:
#### Repository splitting (`split` config)
<a name="splitting"></a>

A list of paths (relative to repository root, *no patterns*) and the value,
either a 'push url' or an array with following options
A list of paths (relative to repository root, *no patterns*) and the value,
either a 'push url' or an array with following options
`['url' => 'push url', 'sync-tags' => false]`.

**Note:** Splits are expected to exist, see also [Managing Split Repositories](split-repositories.md).

```php
// ... At config path `repositories.[github.com].[organization/repository-name].[branch-name]`

'split' => [
'src/Module/CoreModule' => 'git@github.com:hubkit-sandbox/core-module.git',
'src/Module/WebhostingModule' => 'git@github.com:hubkit-sandbox/webhosting-module.git',
Expand Down Expand Up @@ -302,8 +303,8 @@ The config "main" is the main repository which all team-members pull and push fr
A line can contain either a comment _or_ a variable, no overwrites, no different names
and not comments at the end of a declaration.

**Caution:** This file should be ignored by Git as it only applies to your own local
`.git/config` file.
**Caution:** This file should be ignored by Git as it only applies to your own local
`.git/config` file.

Use the `-v` flag with any command to see which value is used.

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private function addBranchesAliasNode(): ArrayNodeDefinition
throw new \InvalidArgumentException(sprintf('Invalid branch-alias for %s, should should be a string to prevent casting mismatches.', $name));
}

if (! preg_match('/^([1-9]\d*\.\d+)$/', (string) $label)) {
if (! preg_match('/^([1-9]\d*\.\d+)$/', $label)) {
throw new \InvalidArgumentException(sprintf('Invalid branch-alias for %s, should consists of major and minor version without any prefix or suffix. like: 1.2. Got: %s', $name, $label));
}

Expand Down

0 comments on commit c82177d

Please sign in to comment.