Class: TinyMCE::Rails::AssetInstaller
- Inherits:
-
Object
- Object
- TinyMCE::Rails::AssetInstaller
- Defined in:
- lib/tinymce/rails/asset_installer.rb,
lib/tinymce/rails/asset_installer/copy.rb,
lib/tinymce/rails/asset_installer/compile.rb,
lib/tinymce/rails/asset_installer/copy_no_preserve.rb
Defined Under Namespace
Classes: Compile, Copy, CopyNoPreserve
Instance Attribute Summary collapse
-
#assets ⇒ Object
readonly
Returns the value of attribute assets.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(assets, target, manifest_path) ⇒ AssetInstaller
constructor
A new instance of AssetInstaller.
- #install ⇒ Object
- #log_level ⇒ Object
- #log_level=(level) ⇒ Object
- #logical_path(file) ⇒ Object
- #manifest ⇒ Object
- #with_asset(src, dest) ⇒ Object
Constructor Details
#initialize(assets, target, manifest_path) ⇒ AssetInstaller
Returns a new instance of AssetInstaller.
13 14 15 16 17 18 19 20 |
# File 'lib/tinymce/rails/asset_installer.rb', line 13 def initialize(assets, target, manifest_path) @assets = assets @target = target @manifest_path = manifest_path || target @logger = Logger.new($stderr) @logger.level = Logger::INFO end |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
10 11 12 |
# File 'lib/tinymce/rails/asset_installer.rb', line 10 def assets @assets end |
#logger ⇒ Object
Returns the value of attribute logger.
11 12 13 |
# File 'lib/tinymce/rails/asset_installer.rb', line 11 def logger @logger end |
#strategy ⇒ Object
Returns the value of attribute strategy.
10 11 12 |
# File 'lib/tinymce/rails/asset_installer.rb', line 10 def strategy @strategy end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
10 11 12 |
# File 'lib/tinymce/rails/asset_installer.rb', line 10 def target @target end |
Instance Method Details
#install ⇒ Object
22 23 24 |
# File 'lib/tinymce/rails/asset_installer.rb', line 22 def install (strategy || Copy).new(self).call end |
#log_level ⇒ Object
26 27 28 |
# File 'lib/tinymce/rails/asset_installer.rb', line 26 def log_level @logger.level end |
#log_level=(level) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/tinymce/rails/asset_installer.rb', line 30 def log_level=(level) if level.is_a?(Integer) @logger.level = level else @logger.level = Logger.const_get(level.to_s.upcase) end end |
#logical_path(file) ⇒ Object
50 51 52 |
# File 'lib/tinymce/rails/asset_installer.rb', line 50 def logical_path(file) file.relative_path_from(@assets.parent).to_s end |
#manifest ⇒ Object
46 47 48 |
# File 'lib/tinymce/rails/asset_installer.rb', line 46 def manifest @manifest ||= AssetManifest.load(@manifest_path) end |
#with_asset(src, dest) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/tinymce/rails/asset_installer.rb', line 54 def with_asset(src, dest) if src != dest src = File.join(@target, src) dest = File.join(@target, dest) yield src, dest if File.exist?(src) end end |