Class: FrontendGenerators::AssetsCopier

Inherits:
Object
  • Object
show all
Defined in:
lib/frontend_generators/assets_copier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#assetObject (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_filesObject



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_dirnameObject



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_assetsObject



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