Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git integration #1954

Merged
merged 81 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
dd00a74
Git integration config.
jesseleite Jun 3, 2020
8fd26b0
Make dynamic vars antlers parsable.
jesseleite Jun 3, 2020
23418c5
Allow for manual control of git commits.
jesseleite Jun 3, 2020
f490ca0
Add plural `{{ paths }}` (to be compiled from stache config).
jesseleite Jun 3, 2020
5d49c86
Add content path/directory tracking.
jesseleite Jun 4, 2020
baeb0b0
Propare large commit.
jesseleite Jun 4, 2020
70c8a80
Add git utility.
jesseleite Jun 9, 2020
734cd43
Add git process.
jesseleite Jun 12, 2020
961dc42
Fix php 7.4 error
jasonvarga May 5, 2020
52f6c2e
Composer output is colored (opt-in)
jasonvarga Jun 8, 2020
03b19d6
Leave ansi codes in tests
jasonvarga Jun 8, 2020
e4ba36c
Update default git config.
jesseleite Jun 16, 2020
3702866
Add git utility GUI.
jesseleite Jun 16, 2020
38c9b1f
Add test fixtures.
jesseleite Jun 16, 2020
aa0a27b
Add static constructor with path param.
jesseleite Jun 16, 2020
54f697b
Just disable button on clean status.
jesseleite Jun 16, 2020
891c0d1
Add please command wrapper.
jesseleite Jun 16, 2020
3c82004
Add git process.
jesseleite Jun 16, 2020
057e429
Add `Git\Content` tracked content manager implementation.
jesseleite Jun 16, 2020
f966a76
Apply fixes from StyleCI (#1940)
jasonvarga Jun 17, 2020
1775827
Allow for string based process commands.
jesseleite Jun 17, 2020
5716c33
Only newer versions of symfony/process require the use of this method…
jesseleite Jun 17, 2020
10568da
Fixing stricter heredoc strings for older versions of PHP.
jesseleite Jun 17, 2020
c730e83
Update and polish default git config.
jesseleite Jun 18, 2020
c98a52a
Simplify data saved/deleted/etc. events.
jesseleite Jun 18, 2020
ae50c45
Not using this contract anymore.
jesseleite Jun 18, 2020
a410e7e
Dispatching, my dear Watson.
jesseleite Jun 18, 2020
0274b43
Pass these tests again.
jesseleite Jun 18, 2020
6d70cae
Rename `Content` to `Git`, and more.
jesseleite Jun 18, 2020
c1406fd
Move `git:commit` command.
jesseleite Jun 18, 2020
f93c615
Add git event subscriber.
jesseleite Jun 18, 2020
880d1df
Clean up `Git` and `git:commit` registration.
jesseleite Jun 18, 2020
e5ed3af
Fix GUI.
jesseleite Jun 18, 2020
a0e6ee8
Remove bad assertion.
jesseleite Jun 18, 2020
8f67410
Rename to `GitTest`.
jesseleite Jun 18, 2020
5548eaa
Apply fixes from StyleCI
jasonvarga Jun 18, 2020
a098e0f
Merge branch 'master' of https://github.com/statamic/cms into feature…
jesseleite Jun 18, 2020
6c48bed
Pass composer test again.
jesseleite Jun 18, 2020
14d36e5
Merge branch 'feature/git-integration' of https://github.com/statamic…
jesseleite Jun 18, 2020
70b8f6f
Apply fixes from StyleCI
jasonvarga Jun 18, 2020
6fef2b7
Merge branch 'master' of https://github.com/statamic/cms into feature…
jesseleite Jun 18, 2020
720c622
Merge branch 'feature/git-integration' of https://github.com/statamic…
jesseleite Jun 18, 2020
99333e2
Fix `AntlersString` process command error.
jesseleite Jun 18, 2020
10a13d3
Simplify assertion.
jesseleite Jun 18, 2020
c80b4c3
Need a git user for github actions to pass.
jesseleite Jun 18, 2020
2e7860c
We are not using `commit` on the process level anywhere.
jesseleite Jun 18, 2020
1e23b30
Clean up paths in default config.
jesseleite Jun 18, 2020
c5fefb1
Prevent errors when paths don't exist (eg. `resources/fieldsets` is o…
jesseleite Jun 18, 2020
dd21520
This component no longer exists.
jesseleite Jun 18, 2020
2243e88
Fix status is clean logic.
jesseleite Jun 19, 2020
375c593
Add missing `AssetSaved`.
jesseleite Jun 19, 2020
552b55f
Filter commitable statuses/paths before running `commands`.
jesseleite Jun 19, 2020
3e72a95
Improve git push coverage.
jesseleite Jun 19, 2020
044a738
Merge branch 'master' of https://github.com/statamic/cms into feature…
jesseleite Jun 24, 2020
4c38ed6
We are not using `add()` on the process level anywhere anymore.
jesseleite Jun 24, 2020
c201ff5
Remove old form submission events (new events implemented in Submissi…
jesseleite Jun 25, 2020
205af0c
Note on deprecated form submission saving event.
jesseleite Jun 25, 2020
9ba9c2e
Dispatch commits tiggered by events to queue for better performance.
jesseleite Jun 25, 2020
070fb1f
Merge branch 'master' of https://github.com/statamic/cms into feature…
jesseleite Jun 25, 2020
f186547
Pass tests again.
jesseleite Jun 25, 2020
5520cb9
Add `dispatch_delay` git config option.
jesseleite Jun 25, 2020
c416c33
Note that delay isn't supported by default `sync` queue driver.
jesseleite Jun 25, 2020
8090128
Publish the git config
jasonvarga Jun 25, 2020
aabf1e5
Proper `isAbsolute` check for windows paths.
jesseleite Jun 25, 2020
aa633c7
Clarify that it'll attempt to use authenticated user when possible.
jesseleite Jun 25, 2020
f71deba
Tidy path before absolute check.
jesseleite Jun 25, 2020
25bb4d5
Slash the argument.
jesseleite Jun 25, 2020
95d809b
Explicitly require and define `toSentence()` on each `Saved` and `Del…
jesseleite Jun 25, 2020
fb520b9
Remove old `PageDeleted` event.
jesseleite Jun 25, 2020
d9fe6ce
Move `PublishBlueprintFound` out of `Data` namespace.
jesseleite Jun 25, 2020
a1e1b45
Update `PublishBlueprintFound` imports.
jesseleite Jun 25, 2020
059e250
If you're ignoring `UserSaved`, you're probably also ignoring `UserDe…
jesseleite Jun 27, 2020
50f7830
Merge branch 'master' into feature/git-integration
jasonvarga Jul 6, 2020
cb37869
Asset tweaks ...
jasonvarga Jul 6, 2020
2549e93
Translation tweaks
jasonvarga Jul 6, 2020
84a175e
No bold/italic
jasonvarga Jul 6, 2020
d272df4
Translations
jasonvarga Jul 6, 2020
dba9a21
Set
jasonvarga Jul 6, 2020
934e48f
git icon
jasonvarga Jul 6, 2020
a379e68
.
jasonvarga Jul 6, 2020
d23c148
Merge branch 'master' into feature/git-integration
jasonvarga Jul 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
133 changes: 133 additions & 0 deletions config/git.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Git Integration
|--------------------------------------------------------------------------
|
| Whether Statamic's git integration should be enabled. This feature
| assumes that git is already installed and accessible by your
| PHP process' server user. For more info, see the docs at:
|
| https://statamic.dev/git-integration
|
*/

'enabled' => env('STATAMIC_GIT_ENABLED', false),

/*
|--------------------------------------------------------------------------
| Automatically Run
|--------------------------------------------------------------------------
|
| By default, commits are automatically queued when `Saved` or `Deleted`
| events are fired. If you prefer users to manually trigger commits
| using the `Git` utility interface, you may set this to `false`.
|
*/

'automatic' => env('STATAMIC_GIT_AUTOMATIC', true),

/*
|--------------------------------------------------------------------------
| Dispatch Delay
|--------------------------------------------------------------------------
|
| When `Saved` and `Deleted` events queue up commits, you may wish to
| set a delay time in minutes for each queued job. This can allow
| for more consolidated commits when you have multiple users
| making simultaneous content changes to your repository.
|
| Note: Not supported by default `sync` queue driver.
|
*/

'dispatch_delay' => env('STATAMIC_GIT_DISPATCH_DELAY', 0),

/*
|--------------------------------------------------------------------------
| Git User
|--------------------------------------------------------------------------
|
| The git user that will be used when committing changes. By default, it
| will attempt to commit with the authenticated user's name and email
| when possible, falling back to the below user when not available.
|
*/

'use_authenticated' => true,

'user' => [
'name' => env('STATAMIC_GIT_USER_NAME', 'Spock'),
'email' => env('STATAMIC_GIT_USER_EMAIL', 'spock@example.com'),
],

/*
|--------------------------------------------------------------------------
| Tracked Paths
|--------------------------------------------------------------------------
|
| Define the tracked paths to be considered when staging changes. Default
| stache and file locations are already set up for you, but feel free
| to modify these paths to suit your storage config. Referencing
| absolute paths to external repos is also completely valid.
|
*/

'paths' => [
base_path('content'),
base_path('users'),
resource_path('blueprints'),
resource_path('fieldsets'),
resource_path('forms'),
resource_path('users'),
],

/*
|--------------------------------------------------------------------------
| Commands
|--------------------------------------------------------------------------
|
| Define a list commands to be run when Statamic is ready to `git add`
| and `git commit` your changes. These commands will be run once
| per repo, attempting to consolidate commits where possible.
|
*/

'commands' => [
'git add {{ paths }}',
'git -c "user.name={{ name }}" -c "user.email={{ email }}" commit -m "{{ message }}"',
],

/*
|--------------------------------------------------------------------------
| Push
|--------------------------------------------------------------------------
|
| Determine whether `git push` should be run after the commands above
| have finished. This is disabled by default, but can be enabled
| globally, or per environment using the provided variable.
|
*/

'push' => env('STATAMIC_GIT_PUSH', false),

/*
|--------------------------------------------------------------------------
| Ignored Events
|--------------------------------------------------------------------------
|
| Statamic will listen on all `Saved` and `Deleted` events, as well
| as any events registered by installed addons. If you wish to
| ignore any specific events, you may reference them here.
|
*/

'ignored_events' => [
// \Statamic\Events\Data\UserSaved::class,
// \Statamic\Events\Data\UserDeleted::class,
],

];
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@popperjs/core": "^2.1.0",
"@shopify/draggable": "^1.0.0-beta.8",
"@simonwep/pickr": "^1.5.1",
"ansi-to-html": "^0.6.14",
"autosize": "~3.0.12",
"axios": "^0.19.2",
"body-scroll-lock": "^2.6.4",
Expand Down
28 changes: 26 additions & 2 deletions resources/js/components/ComposerOutput.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<template>
<div>
<p class="mb-2 font-bold flex items-center justify-between">
<p class="font-bold flex items-center justify-between">
<template v-if="composer.status">{{ composer.status }}</template>
<loading-graphic v-if="polling" text="" class="h-6 w-6"/>
</p>
<pre v-if="output" class="p-1 rounded bg-grey-30 text-grey text-sm clearfix">{{ output }}</pre>
<div class="mt-2 p-2 rounded text-sm font-mono bg-black text-white">
<div
ref="output"
class="whitespace-pre-wrap h-96 overflow-auto" v-html="coloredOutput" />
</div>
</div>
</template>

<script>
const ansi = require('ansi-to-html');

export default {
props: {
package: {
Expand All @@ -27,6 +33,13 @@
watch: {
polling(polling) {
this.$progress.loading('composer-installing', polling);
},

output() {
this.$nextTick(() => {
const div = this.$refs.output;
div.scrollTop = div.scrollHeight - div.clientHeight;
});
}
},

Expand All @@ -37,6 +50,17 @@

params() {
return {package: this.package};
},

coloredOutput() {
return new ansi({
fg: "#c7c7c7",
bg: "#000000",
colors: [
'#000000', '#c91b00', '#00c200', '#c7c400', '#0225c7', '#c930c7', '#00c5c7', '#c7c7c7',
'#676767', '#ff6d67', '#5ff967', '#fefb67', '#6871ff', '#ff76ff', '#5ffdff', '#feffff',
]
}).toHtml(this.output || '');
}
},

Expand Down
40 changes: 40 additions & 0 deletions resources/lang/de-CH.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
"Add Section": "Abschnitt hinzufügen",
"Add Set": "Set hinzufügen",
"Add Time": "Zeit hinzufügen",
"Added": "Hinzugefügt",
"Addon Settings": "Addon-Einstellungen",
"Addons": "Addons",
"Affected files": "Betroffene Dateien",
"After": "Nach",
"All": "Alle",
"All caches cleared.": "Alle Caches wurden gelöscht.",
Expand Down Expand Up @@ -73,8 +75,15 @@
"Are you sure? Unsaved changes will be lost.": "Bist du sicher? Nicht gespeicherte Änderungen gehen verloren.",
"Ascending": "Aufsteigend",
"Asset container created": "Datei-Container erstellt",
"Asset container deleted": "Asset-Container gelöscht",
"Asset container saved": "Asset-Container gespeichert",
"Asset container updated": "Datei-Container aktualisiert",
"Asset Containers": "Datei-Container",
"Asset deleted": "Asset gelöscht",
"Asset folder deleted": "Asset-Ordner gelöscht",
"Asset folder saved": "Asset-Ordner gespeichert",
"Asset saved": "Asset gespeichert",
"Asset uploaded": "Asset hochgeladen",
"Assets": "Dateien",
"Author": "Autor",
"Automatic Line Breaks": "Automatische Zeilenumbrüche",
Expand All @@ -85,6 +94,8 @@
"Blockquote": "Blockzitat",
"Blueprint": "Blueprint",
"Blueprint created": "Blueprint erstellt",
"Blueprint deleted": "Blaupause gelöscht",
"Blueprint saved": "Blaupause gespeichert",
"Blueprints": "Blueprints",
"Bold": "Fett",
"Browse": "Durchsuchen",
Expand Down Expand Up @@ -117,10 +128,13 @@
"Collection": "Sammlung",
"Collection already exists": "Sammlung existiert bereits",
"Collection created": "Sammlung erstellt",
"Collection deleted": "Sammlung gelöscht",
"Collection saved": "Sammlung gespeichert",
"Collections": "Sammlungen",
"Color Modes": "Farbmodi",
"Columns": "Spalten",
"Columns have been reset to their defaults.": "Die Spalten wurden auf ihre Grundeinstellungen zurückgesetzt.",
"Commit": "Verpflichten",
"Conditions": "Bedingungen",
"Configuration": "Konfiguration",
"Configure": "Konfigurieren",
Expand All @@ -137,7 +151,9 @@
"Container": "Container",
"Contains": "enthält",
"Content": "Inhalt",
"Content committed": "Inhalt verpflichtet",
"Content Model": "Inhaltsmodell",
"Content saved": "Inhalt gespeichert",
"Content Stache": "Content Stache",
"Create": "Erstellen",
"Create & Link Item": "Eintrag erstellen & verknüpfen",
Expand Down Expand Up @@ -245,10 +261,12 @@
"Entries successfully reordered": "Einträge erfolgreich umsortiert",
"Entry": "Eintrag",
"Entry created": "Eintrag erstellt",
"Entry deleted": "Eintrag gelöscht",
"Entry has a published version": "Eintrag hat eine veröffentlichte Version",
"Entry has not been published": "Eintrag wurde nicht veröffentlicht",
"Entry has unpublished changes": "Eintrag hat unveröffentlichte Änderungen",
"Entry link": "Link zum Eintrag",
"Entry saved": "Eintrag gespeichert",
"Escape Markup": "Markup auslassen",
"Everything is up to date.": "Alles ist auf dem neusten Stand.",
"Example": "Beispiel",
Expand All @@ -268,6 +286,8 @@
"Fields": "Felder",
"Fieldset": "Fieldset",
"Fieldset created": "Fieldset erstellt",
"Fieldset deleted": "Feldsatz gelöscht",
"Fieldset saved": "Feldsatz gespeichert",
"Fieldsets": "Fieldsets",
"Fieldtypes": "Feldtypen",
"File": "Datei",
Expand All @@ -292,6 +312,8 @@
"Forgot Your Password?": "Passwort vergessen?",
"Form already exists": "Formular existiert bereits",
"Form created": "Formular erstellt",
"Form deleted": "Formular gelöscht",
"Form saved": "Formular gespeichert",
"Form Submission": "Antworten",
"Format": "Format",
"Forms": "Formulare",
Expand All @@ -300,6 +322,8 @@
"Future Date Behavior": "Einträge in der Zukunft",
"Generate": "Generieren",
"Global Set created": "Globales Set erstellt",
"Global Set deleted": "Globaler Satz gelöscht",
"Global Set saved": "Global Set gespeichert",
"Global Sets": "Globale Sets",
"Global Variables": "globale Variablen",
"Globals": "Globale Inhalte",
Expand Down Expand Up @@ -408,13 +432,16 @@
"Miscellaneous": "Verschiedenes",
"Mobile": "Mobile",
"Mode": "Modus",
"Modified": "Geändert",
"Mount": "Mounten",
"Move": "Verschieben",
"Move Asset|Move :count Assets": "Datei verschieben|:count Dateien verschieben",
"Move File": "Datei verschieben",
"Multiple": "Mehrfachauswahl",
"Name": "Name",
"Navigation": "Navigation",
"Navigation deleted": "Navigation gelöscht",
"Navigation saved": "Navigation gespeichert",
"Never": "Nie",
"New :thing": "Neuer :thing",
"New Section": "Neuer Abschnitt",
Expand Down Expand Up @@ -496,6 +523,7 @@
"Reorderable": "Umordnen",
"Replace": "Ersetzen",
"Reply To": "Antwort an (Reply to)",
"Repository path": "Repository-Pfad",
"Reset": "Zurücksetzen",
"Reset Password": "Passwort zurücksetzen",
"Resources scaffolded": "Ressourcen sind bereitgestellt",
Expand All @@ -511,6 +539,8 @@
"Revisions": "Überarbeitungen",
"Role": "Rolle",
"Role created": "Rolle erstellt",
"Role deleted": "Rolle gelöscht",
"Role saved": "Rolle gespeichert",
"Role updated": "Rolle aktualisiert",
"Roles": "Rollen",
"Roles & Groups": "Rollen & Gruppen",
Expand Down Expand Up @@ -582,6 +612,8 @@
"Strategy": "Strategie",
"Strikethrough": "Durchgestrichen",
"Structured": "Strukturiert",
"Submission deleted": "Einreichung gelöscht",
"Submission saved": "Einreichung gespeichert",
"Submission successful.": "Erfolgreich übermittelt.",
"Submissions": "Antworten",
"Submit": "Senden",
Expand All @@ -600,8 +632,12 @@
"Taggable": "Markierbar",
"Taxonomies": "Taxonomien",
"Taxonomy created": "Taxonomie erstellt",
"Taxonomy deleted": "Taxonomie gelöscht",
"Taxonomy saved": "Taxonomie gespeichert",
"Template": "Template",
"Term created": "Begriff erstellt",
"Term deleted": "Begriff gelöscht",
"Term saved": "Begriff gespeichert",
"Terms": "Begriffe",
"Test email sent.": "Test E-Mail gesendet.",
"Text": "Text",
Expand Down Expand Up @@ -659,10 +695,14 @@
"Useful Links": "Nützliche Links",
"User": "Benutzer*in",
"User created": "Benutzer*in erstellt",
"User deleted": "Benutzer gelöscht",
"User group created": "Benutzergruppe erstellt",
"User group deleted": "Benutzergruppe gelöscht",
"User group saved": "Benutzergruppe gespeichert",
"User group updated": "Benutzergruppe aktualisiert",
"User Groups": "Benutzergruppen",
"User Information": "Benutzerinformation",
"User saved": "Benutzer gespeichert",
"Username": "Benutzername",
"Users": "Benutzer",
"Utilities": "Hilfsmittel",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/de-CH/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
'getting_started_widget_intro' => 'Wir empfehlen dir beim Aufbau deiner neuen Statamic 3 Webseite mit diesen Schritten zu beginnen.',
'getting_started_widget_navigation' => 'Erstelle mehrstufige Listen mit Links, die für die Gestaltung von Navbars, Fuszeilen etc. verwendet werden können.',
'getting_started_widget_reminder' => 'Bitte denke daran: <b>Statamic ist eine kommerzielle Software</b> und du musst möglicherweise eine entsprechende Lizenz erwerben, um Statamic nach Ablauf der Beta-Phase weiter nutzen zu können.',
'git_disabled' => 'Die statische Git-Integration ist derzeit deaktiviert.',
'git_nothing_to_commit' => 'Nichts zu begehen, Inhaltspfade sauber!',
'git_utility_description' => 'Verwalten Sie den von Git verfolgten Inhalt.',
'global_search_open_using_slash' => 'Starte die globale Suche mit der Taste <kbd>/</kbd>',
'global_set_config_intro' => 'Globale Sets verwalten Inhalte, die auf der gesamten Webseite verfügbar sind, wie z.B. Firmendetails, Kontaktinformationen oder Frontend-Einstellungen.',
'globals_blueprint_instructions' => 'Das Blueprint steuert die Felder, die beim Bearbeiten der Variablen angezeigt werden sollen.',
Expand Down