Skip to content

Commit

Permalink
Added check for Magento version before utilizing --no-dev
Browse files Browse the repository at this point in the history
This is because Magento 2.0 will not function without certain require-dev installed. So to get the best of both worlds, check the version number!!

real: #22
  • Loading branch information
davidalger committed Sep 8, 2016
1 parent acff06d commit f4a095e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/capistrano/tasks/magento.rake
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,26 @@ namespace :magento do
namespace :composer do
desc 'Run composer install'
task :install do
composer_flags = '--prefer-dist --no-interaction'

if fetch(:magento_deploy_production)
composer_flags += ' --optimize-autoloader --no-dev'
end

on release_roles :all do
within release_path do
composer_flags = '--prefer-dist --no-interaction'

if fetch(:magento_deploy_production)
composer_flags += ' --optimize-autoloader'
end

execute :composer, "install #{composer_flags} 2>&1"

if fetch(:magento_deploy_production)
feature_version = capture :magento, "-V | cut -d' ' -f4 | cut -d. -f1-2"

if feature_version.to_f > 2.0
composer_flags += ' --no-dev'
execute :composer, "install #{composer_flags} 2>&1" # removes require-dev components from prev command
end
end

if test "[ -d #{release_path}/update ]" # can't count on this, but emit warning if not present
execute :composer, "install #{composer_flags} -d ./update 2>&1"
else
Expand Down

0 comments on commit f4a095e

Please sign in to comment.