Class: EY::Serverside::RailsAssets::Strategy::Shifting

Inherits:
Shared
  • Object
show all
Defined in:
lib/engineyard-serverside/rails_assets/strategy.rb

Overview

The default behavior and the one used since the beginning of asset support in engineyard-serverside. Assets are compiled into a fresh shared directory. Previous shared assets are shifted to a last_assets directory to prevent errors during deploy.

When no assets changes are detected, the two shared directories are symlinked into the active release without any changes.

Instance Attribute Summary

Attributes inherited from Shared

#paths, #runner

Instance Method Summary collapse

Methods inherited from Shared

#initialize

Constructor Details

This class inherits a constructor from EY::Serverside::RailsAssets::Strategy::Shared

Instance Method Details

#prepareObject



155
156
157
158
159
160
161
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 155

def prepare
  shift_existing_assets
  yield
rescue
  unshift_existing_assets
  raise
end

#reuseObject

link shared/assets and shared/last_assets into public



151
152
153
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 151

def reuse
  run "mkdir -p #{shared_assets_path} #{last_assets_path} && #{link_assets}"
end