Class: FrontendGenerators::AssetsCopier
- Inherits:
-
Object
- Object
- FrontendGenerators::AssetsCopier
- Defined in:
- lib/frontend_generators/assets_copier.rb
Instance Attribute Summary collapse
-
#asset ⇒ Object
readonly
Returns the value of attribute asset.
Instance Method Summary collapse
- #asset_files ⇒ Object
- #asset_root_dirname ⇒ Object
- #copy_assets ⇒ Object
-
#initialize(asset) ⇒ AssetsCopier
constructor
A new instance of AssetsCopier.
Constructor Details
#initialize(asset) ⇒ AssetsCopier
Returns a new instance of AssetsCopier.
5 6 7 |
# File 'lib/frontend_generators/assets_copier.rb', line 5 def initialize(asset) @asset = asset end |
Instance Attribute Details
#asset ⇒ Object (readonly)
Returns the value of attribute asset.
3 4 5 |
# File 'lib/frontend_generators/assets_copier.rb', line 3 def asset @asset end |
Instance Method Details
#asset_files ⇒ Object
20 21 22 |
# File 'lib/frontend_generators/assets_copier.rb', line 20 def asset_files Dir.glob("#{asset_root_dirname}/**/*").select{|f| File.file?(f)} end |
#asset_root_dirname ⇒ Object
16 17 18 |
# File 'lib/frontend_generators/assets_copier.rb', line 16 def asset_root_dirname File.join(Turf.find(:root), "assets", asset.to_s) end |
#copy_assets ⇒ Object
9 10 11 12 13 14 |
# File 'lib/frontend_generators/assets_copier.rb', line 9 def copy_assets asset_files.each do |asset_path| copier = AssetCopier.new(asset_path, asset_root_dirname) copier.full_copy end end |