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, #reusable?

Constructor Details

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

Instance Method Details

#prepareObject



175
176
177
178
179
180
181
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 175

def prepare
  shift_existing_assets
  yield
rescue
  unshift_existing_assets
  raise
end

#reuseObject

link shared/assets and shared/last_assets into public



171
172
173
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 171

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