Magento Automation Tools

Composer

Dependency Manager for PHP to add,install, or update modules or themes

Dependencies Definition


"require": {
      "connect20/aw_blog": "1.3.5",
      "userfactor/theme": "dev-master",
},

"repositories": [
      {
            "type": "composer",
            "url": "http://packages.firegento.com"
      },
      {
            "type":"vcs",
            "url":"git@bitbucket.org:userfactor/theme.git"
      },
]

Usage


#Install Modules
composer install

#Update Modules
composer update

N98-Magerun

Command line tools to run Magento specific tasks

Examples


#List available commands
n98-magerun.phar list

#Print database information
n98-magerun.phar db:info

#Dump Database
n98-magerun.phar db:dump

#Import Database
n98-magerun.phar db:import

Bash Aliases


alias exportdb = 'n98-magerun.phar db:dump --strip="@development" --compression="gzip"'
alias importdb = 'n98-magerun.phar db:import --compression="gzip"'
alias exportmedia = 'n98-magerun.phar media:dump'
alias reindex = 'n98-magerun.phar index:reindex:all'
alias clean = 'n98-magerun.phar cache:clean'
alias flush = 'n98-magerun.phar cache:flush'

Grunt

JavaScript task runner to automate development tasks

Tasks Definition


//Tasks
grunt.registerTask('default',['compass:prod','uglify']);
grunt.registerTask('dev',['compass:dev','uglify','watch']);
//Magento theme variables
magento: {
theme:'vendor/'+projectName+'/theme/',
appDir: 'vendor/'+projectName+'/theme/app/design/frontend/'+projectName+'/default/',
jsDir: 'vendor/'+projectName+'/theme/js/'+projectName,
skinDir: 'vendor/'+projectName+'/theme/skin/frontend/'+projectName+'/default/'
}

Compile Sass


compass: {
      dev:{
            options: {
                  sassDir: '<%= magento.skinDir %>scss',
                  cssDir: '<%= magento.skinDir %>css',
                  environment: 'development',
                  outputStyle: 'expanded',
                  force: true
            }
      },
      prod:{
            options: {
                  sassDir: '<%= magento.skinDir %>scss',
                  cssDir: '<%= magento.skinDir %>css',
                  environment: 'production',
                  outputStyle: 'compressed',
                  force: true
            }
      },
},

Minify JS


//Minify JS
uglify: {
      options: {
            mangle: false
      },
      magentoLibs: {
            files: {
                  '<%= magento.jsDir %>/magento.js': [
                        'htdocs/js/prototype/prototype.js',
                        'htdocs/js/lib/ccard.js',
                        'htdocs/js/prototype/validation.js',
                        'htdocs/js/prototype/window.js',
                        'htdocs/js/scriptaculous/builder.js',
                        'htdocs/js/scriptaculous/effects.js',
                        'htdocs/js/scriptaculous/controls.js',
                        'htdocs/js/scriptaculous/slider.js',
                        'htdocs/js/varien/js.js',
                        'htdocs/js/varien/form.js',
                        'htdocs/js/mage/translate.js',
                        'htdocs/js/mage/cookies.js'
                  ]
            }
      },
}

Watch for Changes


watch: {
      options: {
            spawn: false,
            interval: 500,
            debounceDelay: 500,
            livereload: true,
      },

      sass: {
          files: ['<%= magento.skinDir %>scss/**/*.scss'],
          tasks: ['compass:dev']
      },

      js: {
            files: ['<%= magento.skinDir %>js/**/*.js'],
            tasks: ['uglify:custom']
      },
}