Module: Capistrano::Magento2::Setup

Defined in:
lib/capistrano/magento2.rb

Instance Method Summary collapse

Instance Method Details

#deployed_versionObject



55
56
57
58
59
60
61
62
# File 'lib/capistrano/magento2.rb', line 55

def deployed_version
  # Generate a static content version string, but only if one has not already been set on a previous call
  if not fetch(:magento_static_deployed_version)
    set :magento_static_deployed_version, DateTime.now.strftime("%s")
    info "Static content version: #{fetch(:magento_static_deployed_version)}"
  end
  return fetch(:magento_static_deployed_version)
end

#static_content_deploy(params) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/capistrano/magento2.rb', line 37

def static_content_deploy params
  if magento_version >= Gem::Version.new('2.2.0-rc')
    # Using -f here just in case MAGE_MODE environment variable in shell is set to something other than production
    execute :magento, "setup:static-content:deploy -f #{params}"
  else
    # Sets pipefail option in shell allowing command exit codes to halt execution when piping command output
    if not SSHKit.config.command_map[:magento].include? 'set -o pipefail' # avoids trouble on multi-host deploys
      @@pipefail_less = SSHKit.config.command_map[:magento].dup
      SSHKit.config.command_map[:magento] = "set -o pipefail; #{@@pipefail_less}"
    end

    execute :magento, "setup:static-content:deploy #{params} | stdbuf -o0 tr -d ."

    # Unsets pipefail option in shell so it won't affect future command executions
    SSHKit.config.command_map[:magento] = @@pipefail_less
  end
end