Skip to content

Commit

Permalink
Cleanup warnings / special cases for Magento 2.1.0 and earlier; #77
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Aug 18, 2017
1 parent 4f246bd commit 804477e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [ ] Verify 2.1.1 and newer deployment ability
- [ ] Verify 2.2-RC2.0 deployment ability
- [ ] Verify 2.1.0 and older throw version check error and halt deployment
- [ ] Ensure static content deploy is correctly deploying both secure and insecure versions of require js config file (preferably eliminate double runs here)
- [ ] Update README to reflect new minimum version requirement for Magento

## v0.7.1 Dev Checklist
Expand Down
23 changes: 4 additions & 19 deletions lib/capistrano/tasks/magento.rake
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,14 @@ namespace :magento do
deploy_themes = fetch(:magento_deploy_themes)
deploy_jobs = fetch(:magento_deploy_jobs)

if deploy_themes.count() > 0 and _magento_version >= Gem::Version.new('2.1.1')
if deploy_themes.count() > 0
deploy_themes = deploy_themes.join(' -t ').prepend(' -t ')
elsif deploy_themes.count() > 0
warn "\e[0;31mWarning: the :magento_deploy_themes setting is only supported in Magento 2.1.1 and later\e[0m"
deploy_themes = nil
else
deploy_themes = nil
end

if deploy_jobs and _magento_version >= Gem::Version.new('2.1.1')
if deploy_jobs
deploy_jobs = "--jobs #{deploy_jobs} "
elsif deploy_jobs
warn "\e[0;31mWarning: the :magento_deploy_jobs setting is only supported in Magento 2.1.1 and later\e[0m"
deploy_jobs = nil
else
deploy_jobs = nil
end
Expand All @@ -304,11 +298,7 @@ namespace :magento do
deploy_languages = [fetch(:magento_deploy_languages).join(' ')]
end

# Output is being checked for a success message because this command may easily fail due to customizations
# and 2.0.x CLI commands do not return error exit codes on failure. See magento/magento2#3060 for details.
within release_path do

# Workaround for 2.1 specific issue: https://github.com/magento/magento2/pull/6437
execute "touch #{release_path}/pub/static/deployed_version.txt"

# Generates all but the secure versions of RequireJS configs
Expand All @@ -320,14 +310,9 @@ namespace :magento do

# As of Magento 2.1.3, it became necessary to exclude "--no-javacript" in order for secure versions of
# RequireJs configs to be generated
if _magento_version < Gem::Version.new('2.1.3')
deploy_flags.push('javascript')
end

deploy_flags = deploy_flags.join(' --no-').prepend(' --no-');
deploy_flags.push('javascript') if _magento_version < Gem::Version.new('2.1.3')

# Magento 2.1.0 and earlier lack support for these flags, so generation of secure files requires full re-run
deploy_flags = nil if _magento_version <= Gem::Version.new('2.1.0')
deploy_flags = deploy_flags.join(' --no-').prepend(' --no-');

within release_path do with(https: 'on') {
deploy_languages.each {|lang| static_content_deploy "#{deploy_jobs}#{lang}#{deploy_themes}#{deploy_flags}"}
Expand Down

0 comments on commit 804477e

Please sign in to comment.