Module: Gluttonberg::Library
- Defined in:
- lib/gluttonberg/library.rb,
lib/gluttonberg/library/config.rb,
lib/gluttonberg/library/storage.rb,
lib/gluttonberg/library/processor.rb,
lib/gluttonberg/library/storage/s3.rb,
lib/gluttonberg/library/quick_magick.rb,
lib/gluttonberg/library/processor/audio.rb,
lib/gluttonberg/library/processor/image.rb,
lib/gluttonberg/library/attachment_mixin.rb,
lib/gluttonberg/library/config/image_sizes.rb,
lib/gluttonberg/library/quick_magick/image.rb,
lib/gluttonberg/library/storage/filesystem.rb,
lib/gluttonberg/library/default_asset_types.rb,
lib/gluttonberg/library/quick_magick/image/draw.rb,
lib/gluttonberg/library/quick_magick/image_list.rb,
lib/gluttonberg/library/quick_magick/image/serialization.rb,
lib/gluttonberg/library/quick_magick/image/operators_and_settings.rb
Overview
The library module encapsulates the few bits of functionality that lives outside of the library models and controllers. It contains some configuration details and is responsible for bootstrapping the various bits of meta-data used when categorising uploaded assets.
Defined Under Namespace
Modules: AttachmentMixin, Config, DefaultAssetTypes, Processor, QuickMagick, Storage Classes: String
Constant Summary collapse
- UNCATEGORISED_CATEGORY =
'uncategorised'
- @@assets_root =
nil
- @@test_assets_root =
nil
- @@tmp_assets_root =
nil
Class Method Summary collapse
- .bootstrap ⇒ Object
-
.build_default_asset_types ⇒ Object
Adds a the inbuilt asset types to the database.
-
.flush_asset_types ⇒ Object
Removes and re-adds all asset types.
-
.rebuild ⇒ Object
This method is mainly for administrative purposes.
-
.root ⇒ Object
Returns the path to the directory where assets are stored.
- .set_asset_root(asset_root, tmp_asset_root, test_asset_root) ⇒ Object
- .tmp_root ⇒ Object
Class Method Details
.bootstrap ⇒ Object
22 23 24 |
# File 'lib/gluttonberg/library.rb', line 22 def self.bootstrap build_default_asset_types end |
.build_default_asset_types ⇒ Object
Adds a the inbuilt asset types to the database.
64 65 66 67 68 |
# File 'lib/gluttonberg/library.rb', line 64 def self.build_default_asset_types # ensure that all the categories exist AssetCategory.build_defaults DefaultAssetTypes.build end |
.flush_asset_types ⇒ Object
Removes and re-adds all asset types.
58 59 60 61 |
# File 'lib/gluttonberg/library.rb', line 58 def self.flush_asset_types AssetType.all.each{|asset_type| asset_type.destroy} AssetMimeType.all.each{|asset_mime_type| asset_mime_type.destroy} end |
.rebuild ⇒ Object
This method is mainly for administrative purposes. It will rebuild the table of asset types, then recategorise each asset.
51 52 53 54 55 |
# File 'lib/gluttonberg/library.rb', line 51 def self.rebuild flush_asset_types build_default_asset_types Asset.refresh_all_asset_types end |
.root ⇒ Object
Returns the path to the directory where assets are stored.
33 34 35 36 37 38 39 |
# File 'lib/gluttonberg/library.rb', line 33 def self.root if ::Rails.env == "test" @@test_assets_root else @@assets_root end end |
.set_asset_root(asset_root, tmp_asset_root, test_asset_root) ⇒ Object
26 27 28 29 30 |
# File 'lib/gluttonberg/library.rb', line 26 def self.set_asset_root(asset_root , tmp_asset_root , test_asset_root) @@assets_root = asset_root @@tmp_assets_root = tmp_asset_root @@test_assets_root = test_asset_root end |
.tmp_root ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/gluttonberg/library.rb', line 41 def self.tmp_root if ::Rails.env == "test" @@test_assets_root else @@tmp_assets_root end end |