Class: AssetS3::Base
- Inherits:
-
Object
- Object
- AssetS3::Base
- Defined in:
- lib/asset_s3.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_ASSET_PATHS =
["favicon.ico", "images", "javascripts", "stylesheets"]
- @@asset_paths =
DEFAULT_ASSET_PATHS
Class Method Summary collapse
- .absolute_path(path) ⇒ Object
- .asset_paths ⇒ Object
- .asset_paths=(paths) ⇒ Object
- .assets ⇒ Object
- .fingerprint(path) ⇒ Object
- .path_prefix ⇒ Object
Class Method Details
.absolute_path(path) ⇒ Object
22 23 24 |
# File 'lib/asset_s3.rb', line 22 def self.absolute_path(path) File.join(path_prefix, path) end |
.asset_paths ⇒ Object
18 19 20 |
# File 'lib/asset_s3.rb', line 18 def self.asset_paths @@asset_paths end |
.asset_paths=(paths) ⇒ Object
14 15 16 |
# File 'lib/asset_s3.rb', line 14 def self.asset_paths=(paths) @@asset_paths = paths end |
.assets ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/asset_s3.rb', line 26 def self.assets asset_paths.inject([]) do |assets, path| path = absolute_path(path) assets << path if File.exists?(path) && !File.directory?(path) assets += Dir.glob("#{path}/**/*").inject([]) do |m, file| m << file unless File.directory?(file) m end end end |
.fingerprint(path) ⇒ Object
37 38 39 |
# File 'lib/asset_s3.rb', line 37 def self.fingerprint(path) path.gsub(path_prefix, "") end |
.path_prefix ⇒ Object
10 11 12 |
# File 'lib/asset_s3.rb', line 10 def self.path_prefix File.join(Rails.root, "public") end |