Skip to content

Instantly share code, notes, and snippets.

@vdubyna
Last active December 28, 2015 13:09
Show Gist options
  • Select an option

  • Save vdubyna/7505588 to your computer and use it in GitHub Desktop.

Select an option

Save vdubyna/7505588 to your computer and use it in GitHub Desktop.
Create magento package based on simple json object
{
"file_name": "Speroteck_Tabmenu",
"name": "Speroteck_Tabmenu",
"channel": "community",
"version_ids": ["2"],
"summary": "sdfsdfds",
"description": "dsfsdfdsfdsf",
"license": "OSC v3.0",
"license_uri": "",
"version": "0.1.1",
"stability": "devel",
"notes": "sdfdsfsdf",
"authors": {
"name": ["Volodymyr Dubyna"],
"user": ["vdubyna"],
"email": ["vovikha@gmail.com"]
},
"depends_php_min": "5.3.2",
"depends_php_max": "5.4.0",
"depends": {
"package": {
"name": [""],
"channel": [""],
"min": [""],
"max": [""],
"files": [" "]
},
"extension": {
"name": ["Core"],
"min": [""],
"max": [""]
}
},
"contents": {
"target": [
"magelocal",
"magelocal",
"mageetc"
],
"path": [
"",
"Speroteck\/Crawler",
"modules\/Speroteck_Crawler.xml"
],
"type": [
"file",
"dir",
"file"
],
"include": ["", "", ""],
"ignore": ["", "", ""]
}
}
<?php
require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
Mage::app('admin')->setUseSessionInUrl(false);
Mage::register('isSecureArea', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
umask(0);
try {
$p = Zend_Json::decode(file_get_contents('package.json'));
$ext = Mage::getModel('connect/extension');
/** @var $ext Mage_Connect_Model_Extension */
$ext->setData($p);
$ext->createPackage();
echo "Package was successfully generated";
} catch (Exception $e) {
Mage::printException($e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment