Class: EY::Serverside::RailsAssets::Strategy::Private
- Defined in:
- lib/engineyard-serverside/rails_assets/strategy.rb
Overview
Precompile assets fresh every time. Shared assets are not symlinked and assets stay with the release that compiled them. The assets of the previous deploy are symlinked as into the current deploy to prevent errors during deploy.
When no assets changes are detected, the deploy uses rsync to copy the previous release's assets into the current assets directory.
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(paths, runner) ⇒ Private
constructor
A new instance of Private.
-
#prepare ⇒ Object
link the previous assets into the new public/last_assets/assets to prevent missing assets during deploy.
- #reuse ⇒ Object
Constructor Details
#initialize(paths, runner) ⇒ Private
Returns a new instance of Private.
31 32 33 34 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 31 def initialize(paths, runner) @paths = paths @runner = runner end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
29 30 31 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 29 def paths @paths end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
29 30 31 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 29 def runner @runner end |
Instance Method Details
#prepare ⇒ Object
link the previous assets into the new public/last_assets/assets to prevent missing assets during deploy.
This results in the directory structure:
deploy_root/current/public/last_assets/assets -> deploy_root/releases/<prev>/public/assets
45 46 47 48 49 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 45 def prepare last = paths.public.join('last_assets') run "mkdir -p #{last} && ln -nfs #{previous_assets_path} #{last.join('assets')}" yield end |
#reuse ⇒ Object
36 37 38 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 36 def reuse run "mkdir -p #{paths.public_assets} && rsync -aq #{previous_assets_path}/ #{paths.public_assets}" end |