Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 21, 2025
2 parents 156a788 + 1aa7a76 commit 815c142
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 15 deletions.
12 changes: 11 additions & 1 deletion RockMigrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
else if (name == "field_label") name = "label";
else if (name == "asmSelect0") return;

// add comment?
let comment = "";

// special cases
if (name == "sortfield_reverse") {
comment = "Use this syntax instead:'sortfield' => '-[property]'";
$(el).attr("title", comment);
$(el).attr("rockmigrations-code", comment);
UIkit.tooltip(el);
return;
}

// add comment?
if (el.type == "radio") comment = $(el).parent().text();
else if (el.type == "select-one")
comment = $(el).find("option:selected").text();
Expand Down
2 changes: 1 addition & 1 deletion RockMigrations.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -4195,7 +4195,7 @@ private function runConfigFile(string $file, $firstRun = false): void
// skip dotfiles
$shortName = $this->getConfigFileName($file, true);
if (str_starts_with($shortName, '.')) {
$this->log("Skipping dotfile $shortName");
$this->log(" Skipping dotfile $shortName");
return;
}

Expand Down
21 changes: 21 additions & 0 deletions docs/config-migrations-hooks/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,24 @@ Created /var/www/html/site/RockMigrationsConstants.php
/site/RockMigrations/templates/bar.php
--- config migration hook: afterData (0 files) ---
```

## Dependencies

Another example where hooks are necessary are module dependencies. For example, in RockInvoice we need to install the Fieldtype and Inputfield modules before we can create fields of that type:

`label: beforeAssets.php`
```php
<?php

namespace ProcessWire;

$rm = rockmigrations();

// install fieldtype + inputfield modules
$rm->configMigrations(false);
wire()->modules->install('FieldtypeRockInvoiceitems');
wire()->modules->install('InputfieldRockInvoiceitems');
$rm->configMigrations(true);
```

Please note that it is important to disable config migrations temporarily before installing the modules. This is to prevent an endless loop when installing a module that depends on the modules you're installing.
12 changes: 11 additions & 1 deletion docs/deploy/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ We need two different SSH keys for our setup:
- Used by you for all your projects
- Stays on your computer
- Never shared with others
- Example: `~/.ssh/id_bernhard`
- In a Team? Create one for each member!
- Example: `~/.ssh/id_bernhard` or `~/.ssh/id_susan`

2. A project key for deployments
- Specific to this project
Expand All @@ -57,6 +58,15 @@ We need two different SSH keys for our setup:
- Shared with team members
- Example: `~/.ssh/id_github`

### SSH Quickstart

SSH uses key pairs for secure authentication:

- **Private Key**: Your secret key - never share it. In the real world this would be the key that you use to open a door.
- **Public Key**: Can be shared and installed on servers. In the real world this would be the lock in the door that only grants access to certain people (keys).

That means we define on the server who can access by adding public keys to it and we create a private key for everybody who needs to access the server. In our case this is every team member and also the Github Actions runner.

> Pro-Tip: I'm using a generic name `id_github` for the project-key on every project. I simply overwrite it for each project, because then I do not bloat the `.ssh` folder with too many keys that are never used (because they are moved to the Github repo and only used by the Github runner).
### Create Personal SSH Key
Expand Down
24 changes: 12 additions & 12 deletions snippets/RockMigrations/rmf-page.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ return [
'label' => '$1',
'derefAsPage' => ${2:FieldtypePage::derefAsPageOrFalse},
// inputfield options:
// - InputfieldSelect // Select
// - InputfieldRadios // Radio Buttons
// - InputfieldPageListSelect // Page List Select
// - InputfieldPageAutocomplete // Page Auto Complete (single)
// - InputfieldTextTags // Text Tags (single)
// - InputfieldSelectMultiple // Select Multiple
// - InputfieldCheckboxes // Checkboxes
// - InputfieldAsmSelect // AsmSelect
// - InputfieldPageAutocomplete // Page Auto Complete
// - InputfieldTextTags // Text Tags
// - InputfieldPageListSelectMultiple // Page List Select Multiple
'inputfield' => ${3:'InputfieldPageListSelect'},
// 'inputfield' => 'InputfieldSelect', // Select
// 'inputfield' => 'InputfieldRadios', // Radio Buttons
// 'inputfield' => 'InputfieldPageListSelect', // Page List Select
// 'inputfield' => 'InputfieldPageAutocomplete', // Page Auto Complete (single)
// 'inputfield' => 'InputfieldTextTags', // Text Tags (single)
// 'inputfield' => 'InputfieldSelectMultiple', // Select Multiple
// 'inputfield' => 'InputfieldCheckboxes', // Checkboxes
// 'inputfield' => 'InputfieldAsmSelect', // AsmSelect
// 'inputfield' => 'InputfieldPageAutocomplete', // Page Auto Complete
// 'inputfield' => 'InputfieldTextTags', // Text Tags
// 'inputfield' => 'InputfieldPageListSelectMultiple', // Page List Select Multiple
'inputfield' => 'InputfieldPageListSelect',
'findPagesSelector' => '${4:id>0,template!=admin}',
'labelFieldName' => '${5:title}',
'icon' => '${6:link}',
Expand Down

0 comments on commit 815c142

Please sign in to comment.