|
| 1 | +# Private Packagist API Demos |
| 2 | + |
| 3 | +## Magento Demo |
| 4 | + |
| 5 | +### Setup |
| 6 | + |
| 7 | +Start by creating a mage id on Magento Marketplace and downloading the packages.json to the project root. |
| 8 | +Generate all the data we need for later examples with the following code, listing any purchased extensions so they can |
| 9 | +be treated as such: |
| 10 | + |
| 11 | +``` |
| 12 | +/bin/packagist magento-generate-data foo/bar [more extension-names here] |
| 13 | +``` |
| 14 | + |
| 15 | +Create API credentials for your Private Packagist organization and set the two environment variables |
| 16 | +`PACKAGIST_API_KEY` and `PACKAGIST_API_SECRET` accordingly. |
| 17 | + |
| 18 | +Set environment variables `MAGENTO_PUBLIC_KEY` and `MAGENTO_PRIVATE_KEY` to allow for package download from |
| 19 | +current repo.magento.com. |
| 20 | + |
| 21 | +### Importing all default Magento packages |
| 22 | +This loads all data for all packages into your organization, it skips the Magento project/product packages, so we can |
| 23 | +use them later to simulate releases. |
| 24 | + |
| 25 | +``` |
| 26 | +./bin/packagist magento-import |
| 27 | +``` |
| 28 | + |
| 29 | +### Creating a customer |
| 30 | +This will create a customer entry for my username and mage id with a corresponding access key pair. It will also grant |
| 31 | +access to all default Magento packages stored in packages.json. |
| 32 | + |
| 33 | +``` |
| 34 | +./bin/packagist magento-customer-add nils_adermann MAG005458681 [public-key here] [private-key here] |
| 35 | +``` |
| 36 | + |
| 37 | +### Releasing an extension |
| 38 | +This requires the version JSON data to be present in `examples/magento-extensions/[package-name]-[version].json`. Each |
| 39 | +JSON file for a version should contain the JSON for all previous versions as well. You can generate these files from the |
| 40 | +downloaded packages.json using `examples/magento-export.php`. |
| 41 | + |
| 42 | +``` |
| 43 | +./bin/packagist magento-extension-release foo/bar 1.0.0 |
| 44 | +``` |
| 45 | + |
| 46 | +### Granting a customer access to an extension |
| 47 | +This requires the version JSON data to be present in `examples/magento-extensions/[package-name]-[version].json`. Each |
| 48 | +JSON file for a version should contain the JSON for all previous versions as well. You can generate these files from the |
| 49 | +downloaded packages.json using `examples/magento-export.php`. |
| 50 | + |
| 51 | +``` |
| 52 | +./bin/packagist magento-extension-grant MAG005458681 foo/bar |
| 53 | +``` |
| 54 | + |
| 55 | +### Revoking customer access to an extension |
| 56 | +``` |
| 57 | +./bin/packagist magento-extension-revoke MAG005458681 foo/bar |
| 58 | +``` |
| 59 | + |
| 60 | +### Deleting an extension |
| 61 | +``` |
| 62 | +./bin/packagist magento-extension-remove foo/bar |
| 63 | +``` |
| 64 | + |
| 65 | +### Granting a customer Enterprise access |
| 66 | +``` |
| 67 | +./bin/packagist magento-enterprise-grant MAG005458681 |
| 68 | +``` |
| 69 | + |
| 70 | +### Revoking Enterprise access from a customer |
| 71 | +``` |
| 72 | +./bin/packagist magento-enterprise-revoke MAG005458681 |
| 73 | +``` |
| 74 | + |
| 75 | +### Complete Script |
| 76 | +``` |
| 77 | +./bin/packagist magento-generate-data foo/bar |
| 78 | +./bin/packagist magento-import |
| 79 | +./bin/packagist magento-customer-add nils_adermann MAG005458681 [public-key here] [private-key here] |
| 80 | +
|
| 81 | +./bin/packagist magento-release 2.0.0 |
| 82 | +./bin/packagist magento-release 2.1.0 |
| 83 | +
|
| 84 | +./bin/packagist magento-extension-release foo/bar 1.0.0 |
| 85 | +./bin/packagist magento-extension-grant MAG005458681 foo/bar |
| 86 | +./bin/packagist magento-extension-release foo/bar 1.2.0 |
| 87 | +./bin/packagist magento-extension-revoke MAG005458681 foo/bar |
| 88 | +./bin/packagist magento-extension-release foo/bar 1.3.0 |
| 89 | +./bin/packagist magento-extension-grant MAG005458681 foo/bar |
| 90 | +./bin/packagist magento-extension-remove foo/bar |
| 91 | +
|
| 92 | +./bin/packagist magento-enterprise-grant MAG005458681 |
| 93 | +./bin/packagist magento-release 2.3.0 |
| 94 | +./bin/packagist magento-enterprise-revoke MAG005458681 |
| 95 | +gtgt``` |
0 commit comments