Class: EY::Serverside::RailsAssets::Strategy::Shared

Inherits:
Object
  • Object
show all
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.

Direct Known Subclasses

Cleaning, Shifting

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths, runner) ⇒ Shared

Returns a new instance of Shared.



75
76
77
78
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 75

def initialize(paths, runner)
  @paths = paths
  @runner = runner
end

Instance Attribute Details

#paths ⇒ Object (readonly)

Returns the value of attribute paths.



74
75
76
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 74

def paths
  @paths
end

#runner ⇒ Object (readonly)

Returns the value of attribute runner.



74
75
76
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 74

def runner
  @runner
end

Instance Method Details

#prepare ⇒ Object



88
89
90
91
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 88

def prepare
  reuse
  yield
end

#reusable? ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 80

def reusable?
  shared_assets_path.directory? && shared_assets_path.entries.any?
end

#reuse ⇒ Object



84
85
86
# File 'lib/engineyard-serverside/rails_assets/strategy.rb', line 84

def reuse
  run "mkdir -p #{shared_assets_path} && ln -nfs #{shared_assets_path} #{paths.public}"
end