Modern tools for magento development
-
Upload
umberellaa -
Category
Technology
-
view
345 -
download
0
description
Transcript of Modern tools for magento development
![Page 1: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/1.jpg)
MagentoWA meetup - 23 JulyErfan Imani - @erfanimani
Modern tools for Magento development
![Page 2: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/2.jpg)
N98 Magerun
● PHP script that you execute through CLI
![Page 3: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/3.jpg)
N98 Magerun
● PHP script that you execute through CLI
● Tons of useful commands○ sys:check○ dev:console ○ admin:user:create
![Page 4: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/4.jpg)
N98 Magerun
● sys:setup:compare-versions● sys:maintenance● sys:setup:run● cache:clean● sys:mainenance
![Page 5: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/5.jpg)
Modman (Module Manager)
Allows you to clone a repository with Magento module files and have them be mapped to the Magento filesystem
![Page 6: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/6.jpg)
Modman (Module Manager)
● Files are symlinked○ (as per `modman` file that’s in the projects
repo)
● Example: github repo link
![Page 7: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/7.jpg)
Modman (Module Manager)
● Files are symlinked○ (as per `modman` file that’s in the projects
repo)
● Example: github repo link● Not really a package or dependency
management tool○ Not quite sure what it’s good for (if you’re
using VCS…)
![Page 8: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/8.jpg)
Composer
● dependency manager for PHP projects○ allows you to declare the libraries your project
needs○ packagist.org is composer main archive
■ packagist doesn’t host the actual files, it just links to them
http://alanstorm.com/php_composer_magento_tutorial
![Page 9: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/9.jpg)
Dependency management basics
● file that states what the project needs ○ In vcs, editable○ composer.json (e.g. lib-x: 1.0.*)
![Page 10: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/10.jpg)
Dependency management basics
● file that states what the project needs ○ In vcs, editable○ composer.json (e.g. lib-x: 1.0.*)
● file that states what the project currently has○ In vcs, auto generated○ composer.lock (e.g. lib-x: 1.0.9)
![Page 11: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/11.jpg)
Dependency management basics
● directory that contains the files you need○ Can be in vcs, auto generated ○ vendor
![Page 12: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/12.jpg)
Dependency management basics
● lock file gets generated by running `composer update`○ grabs newest versions
![Page 13: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/13.jpg)
Dependency management basics
● lock file gets generated by running `composer update`○ grabs newest versions
● if there is a lock file present, you can install all modules by running `composer install`○ installs versions as specified in composer.lock,
even though there may be newer versions available!
![Page 14: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/14.jpg)
How does this work with Magento’s filesystem?
![Page 15: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/15.jpg)
{
"name": "doghouse/tumblr-share-link",
"type": "magento-module",
"license":"OSL-3.0",
"homepage":"http://stash.dhmedia.com.au/projects/DMMODULES/repos/tumblrsharelink-magento-2014",
"description":"Generate Tumblr link and photo share URLs",
"authors":[
{
"name":"Erfan Imani",
"email":"[email protected]"
}
],
"require": {
"magento-hackathon/magento-composer-installer": "*"
},
"extra": {
"map": [
["Doghouse_TumblrShareLink.xml", "app/etc/modules/Doghouse_TumblrShareLink.xml"],
["TumblrShareLink", "app/code/community/Doghouse/TumblrShareLink"]
]
}
}
![Page 16: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/16.jpg)
{ "..." "extra": { "map": [ ["Doghouse_TumblrShareLink.xml", "app/etc/modules/Doghouse_TumblrShareLink.xml"], ["TumblrShareLink", "app/code/community/Doghouse/TumblrShareLink"] ] }}
![Page 17: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/17.jpg)
{
"minimum-stability":"dev",
"require": {
"magento-hackathon/magento-composer-installer":"*",
"fbrnc/aoe_scheduler":"*",
"fbrnc/aoe_profiler":"*"
},
"repositories": [
{
"packagist": false
},
{
"type": "composer",
"url": "http://packages.firegento.com"
}
],
"extra": {
"magento-root-dir": "./",
"magento-deploystrategy": "copy",
"magento-force": true
}
}
http://blog.versioneye.com/2014/07/22/intro-to-firegento/
![Page 18: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/18.jpg)
{ "..." "extra": { "magento-root-dir": "./", "magento-deploystrategy": "copy", "magento-force": true }}
![Page 19: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/19.jpg)
Magento & Composer with VCS
Method #1● symlink, vendor not version controlled
○ when cloning the project, you have to install all dependencies
○ deployment system becomes responsible for fetching all dependencies
![Page 20: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/20.jpg)
![Page 21: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/21.jpg)
1. “You’re reliant on the npm infrastructure being up and working when you
need it (it won’t always be, as was so clearly demonstrated on Feburary
27th... and in January... and November... and etc...).
2. You’re assuming nobody will subvert the repository and insert malicious
code (not as far-fetched as it sounds—it happened to Ruby).
3. You’re relying on npm to serve the exact bug-for-bug compatible version
of the code that you originally developed and tested against, including all
subdependencies(which it doesn’t, not without special effort).
4. You’re trusting that the online repository will remain available and
serving the exact packages you need for the rest of your application’s
life, which could be decades.“ http://www.letscodejavascript.
com/v3/blog/2014/03/the_npm_debacle
![Page 22: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/22.jpg)
Magento & Composer with VCS
Method #2● symlink, vendor in VCS
○ you might need to add them as git submodules
http://www.lornajane.net/posts/2014/using-composer-without-gitignoring
![Page 23: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/23.jpg)
Magento & Composer with VCS
Method #3● copy, vendor not version controlled
○ you can see a diff when you update modules
○ you don’t have to run composer install to have a project work
○ deployments run smooth, even if certain repo’s aren’t available
○ disadvantage: files are now in two places
![Page 24: Modern tools for magento development](https://reader035.fdocuments.net/reader035/viewer/2022062303/554f5d27b4c905c8088b47a8/html5/thumbnails/24.jpg)
Next...
● Satis● Bower● Sass/Compass (and Bundler)● Grunt