Class: EY::Serverside::RailsAssets::Strategy::Shared
- Inherits:
-
Object
- Object
- EY::Serverside::RailsAssets::Strategy::Shared
- Defined in:
- lib/engineyard-serverside/rails_assets/strategy.rb
Overview
Basic shared assets. Precompiled assets go into a single shared assets directory. The assets directory is never cleaned, so a deploy hook should be used to clean assets appropriately.
When no assets changes are detected, shared directory is only symlinked and precompile task is not run.
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) ⇒ Shared
constructor
A new instance of Shared.
- #prepare ⇒ Object
- #reusable? ⇒ Boolean
- #reuse ⇒ Object
Constructor Details
#initialize(paths, runner) ⇒ Shared
Returns a new instance of Shared.
87 88 89 90 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 87 def initialize(paths, runner) @paths = paths @runner = runner end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
86 87 88 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 86 def paths @paths end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
86 87 88 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 86 def runner @runner end |
Instance Method Details
#prepare ⇒ Object
100 101 102 103 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 100 def prepare reuse yield end |
#reusable? ⇒ Boolean
92 93 94 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 92 def reusable? shared_assets_path.directory? && shared_assets_path.entries.any? end |
#reuse ⇒ Object
96 97 98 |
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 96 def reuse run "mkdir -p #{shared_assets_path} && ln -nfs #{shared_assets_path} #{paths.public}" end |