Skip to content

Instantly share code, notes, and snippets.

@mnocon
Last active August 24, 2021 09:04
Show Gist options
  • Save mnocon/4ffc3fcb57ac45408dd1dedd9d22b2d5 to your computer and use it in GitHub Desktop.
Save mnocon/4ffc3fcb57ac45408dd1dedd9d22b2d5 to your computer and use it in GitHub Desktop.

Przykłady na podstawie https://github.com/ibexa/calendar/pull/2

  1. Zaczynamy od dodania nowej paczki:
composer config repositories.branding vcs https://github.com/ibexa/namespace-compatibility.git
composer require ibexa/namespace-compatibility
  1. Generujemy aktualne classmapy:
cd vendor/ibexa/namespace-compatibility
composer install
php bin/console rebranding:generate:class-map
cd -
  1. Klonujemy naszą testowaną paczkę:
git clone https://github.com/ibexa/<nazwa_repo>.git -b <nazwa_brancha>

Dla https://github.com/ibexa/calendar/pull/2 to będzie:

git clone https://github.com/ibexa/calendar.git -b rebranding2

Powstanie nam katalog <nazwa_repo>

Dodajemy do composer.json dwa wpisy:

a) Do sekcji repositories dodajemy:

        "<nazwa_repo>": {
            "type": "path",
            "url": "./<nazwa_repo>",
            "options": {
                "symlink": false
            }
        },

W tym przykładzie to będzie:

"branding": {
    "type": "vcs",
    "url": "https://github.com/ibexa/namespace-compatibility.git"
},
"calendar": {
    "type": "path",
    "url": "./calendar",
    "options": {
        "symlink": false
    }
},

b) Znajdujemy nową nazwę paczki: <nazwa_paczki> to cat <nazwa_repo>/composer.json | grep name

c) Do sekcji require dodajemy (gdzieś na środku listy):

"<nazwa_paczki>": "dev-<nazwa_brancha> as 4.0.x-dev",

Dla naszego PRa:

"ibexa/calendar": "dev-rebranding2 as 4.0.x-dev",

I robimy composer update

  1. Dostaniemy błąd w stylu:
!!    Trying to register two bundles with the same name "IbexaCalendarBundle".

I teraz musimy tak: a) otworzyć plik config/bundles.php b) Zlokalizować wpis dla paczki którą testujemy: ibexa/calendar zastępuje ezsystems/ezplatform-calendar, więc znajdujemy wpis dla Calendara: EzSystems\EzPlatformCalendarBundle\EzPlatformCalendarBundle::class => ['all' => true], i zastępujemy go tym co mamy na samym dole (nowym wpisem dla calendara): Ibexa\Bundle\Calendar\IbexaCalendarBundle::class => ['all' => true],

U mnie wygląda to tak po podmiance:

EzSystems\EzPlatformWorkflowBundle\EzPlatformWorkflowBundle::class => ['all' => true],
Ibexa\Bundle\Calendar\IbexaCalendarBundle::class => ['all' => true],
EzSystems\EzPlatformVersionComparisonBundle\EzPlatformVersionComparisonBundle::class => ['all' => true],

Dodatkowo: Znajdujemy wystąpienia ostatniego członu w tekście który zastępowaliśmy (EzPlatformCalendarBundle) w projekcie (wewnątrz katalogu config) i zastępujemy je ostatnim członem nowego tekstu (IbexaCalendarBundle).

Dla EzPlatformCalendarBundle są to dwa wystąpienia w pliku config/routes/ezplatform_calendar.yaml.

  1. Teraz robimy rm -rf var/cache i composer update i już powinno być ok
@alongosz
Copy link

@mnocon

composer config repositories.branding vcs https://github.com/ibexa/namespace-compatibility.git

nie jest wymagane, paczka jest w Satis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment