From 4e57e98d6f69666e751b505059ba9ba2ed608cea Mon Sep 17 00:00:00 2001 From: jmleroux Date: Wed, 23 Mar 2016 10:11:12 +0100 Subject: [PATCH] Add usage documentation --- README.md | 51 ++++++++++++++++++++++++++++++++++++------ doc/composer.json.dist | 34 ++++++++++++++++++++++++++++ doc/connector.md | 46 ------------------------------------- doc/extension.md | 1 - 4 files changed, 78 insertions(+), 54 deletions(-) create mode 100644 doc/composer.json.dist delete mode 100644 doc/connector.md delete mode 100644 doc/extension.md diff --git a/README.md b/README.md index b6230eb..a13dff3 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,57 @@ |:----------------:|:----------------------------:| | v0.1.* | v1.5.* | -## Installation +## Using this starter kit -Add the following dependency to your Akeneo PIM project with this shell command: +### Context +Your extension is meant to work as part of an existing PIM installation, +thus we will use PIM Community Standard Edition to host the connector. +### Initialisation +Create a new host project with the Standard Edition + +``` +composer create-project --prefer-dist akeneo/pim-community-standard /path/to/project "1.5.*@stable" +cd /path/to/project +``` + +This will download the standard edition without git informations. + +Then, clone the starter kit + +``` +composer require akeneo-labs/extension-starter 0.1.0 --prefer-dist ``` -composer require "akeneo-labs/extension-starter" "0.1.0"; + +### Customization +You will need to rename your extension according to the chosen name. +Let's say you work for the WorldCompany and the connector name is WorldConnector. + +You will have to move your component inside the vendor directory and rename it according to what vendor name you want to use. +A widely used practice is to use your company name. + +``` +cd vendor +mkdir world-company +mv akeneo-labs/extension-starter world-company/world-connector +cd world-company/world-connector +mv Acme WorldCompany ``` -Register your new bundle in your AppKernel.php, +Change namespaces accordingly: + +``` +find WorldCompany/ -name '*.php' -o -name 'composer.json' -type f -print0 | xargs -0 sed -i 's#Acme#WorldCompany#g' +cd WorldCompany/Bundle/DemoExtensionBundle/ +cp doc/composer.json.dist composer.json +sed -i 's#Acme#WorldCompany#g' composer.json +sed -i 's#acme#world-company#g' composer.json +``` +And finally, clean up all the starter kit initialization files: ``` -$bundles = [ - new Acme\Bundle\AcmeExtensionBundle\AcmeExtensionBundle(), -]; +rm -f doc/* +echo '# Demo extension' > README.md ``` ## Best practices diff --git a/doc/composer.json.dist b/doc/composer.json.dist new file mode 100644 index 0000000..95d0908 --- /dev/null +++ b/doc/composer.json.dist @@ -0,0 +1,34 @@ +{ + "name": "acme/demo-extension", + "type": "symfony-bundle", + "description": "your description", + "license": "OSL-3.0", + "authors": [ + { + "name": "your_name " + } + ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/akeneo/pim-community-dev.git", + "branch": "master" + } + ], + "require": { + "akeneo/pim-community-dev": "1.5.*", + "doctrine/migrations": "1.0.0-alpha3@alpha" + }, + "require-dev": { + "fabpot/php-cs-fixer": "^1.11" + }, + "target-dir": "Acme/Bundle/DemoExtensionBundle", + "config": { + "bin-dir": "bin" + }, + "extra": { + "branch-alias": { + "dev-master": "0.1.x-dev" + } + } +} diff --git a/doc/connector.md b/doc/connector.md deleted file mode 100644 index 754b638..0000000 --- a/doc/connector.md +++ /dev/null @@ -1,46 +0,0 @@ -# Using this starter kit for a connector - -## Context -To write a connector, you will need to integrate your extension in an existing PIM installation. -We will use the PIM Community Standard Edition as the host of our connector. - -## Initialisation -Create a new host project with the Standard Edition - -``` -composer create-project --prefer-dist akeneo/pim-community-standard /home/myhome/pim-project "1.5.*@stable" -cd /home/myhome/pim-project -``` - -This will copy a copy of the standard edition without git informations. - -Then, clone the starter kit - -``` -composer require akeneo-labs/extension-starter 0.1.0 --prefer-source -cd vendor/akeneo-labs/extension-starter/Acme/Bundle/DemoExtensionBundle -``` - -At this point, you will need to reset the git information to become owner of the code. - -Start by resetting git : - -``` -rm .git -rf` -git init -``` - -## Customization -You will need to rename your extension according to the chosen name. -Let's say you work for the WorldCompany and the connector name is WorldConnector. - -You will need to move your component inside the vendor directory : - -``` -cd /home/myhome/pim-project/vendor -mkdir world-company -mv akeneo-labs/extension-starter world-company/world-connector -cd world-company/world-connector -mv Acme WorldCompany -find WorldCompany/ -name '*.php' -type f -print0 | xargs -0 sed 's#Acme#WorldCompany#g' -``` diff --git a/doc/extension.md b/doc/extension.md deleted file mode 100644 index c32913b..0000000 --- a/doc/extension.md +++ /dev/null @@ -1 +0,0 @@ -# Using this starter kit for a generic extension