Class: Flowcation::Assets
- Inherits:
-
Object
- Object
- Flowcation::Assets
- Defined in:
- lib/flowcation/assets.rb
Class Method Summary collapse
Class Method Details
.copy_assets(source:, target:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flowcation/assets.rb', line 17 def self.copy_assets(source:, target:) FileUtils.mkdir_p(target) Dir.entries(source).reject {|file_name| %w(. ..).include?(file_name) }.each do |file_name| if File.directory? File.join(source, file_name) copy_assets \ source: File.join(source, file_name), target: File.join(target, file_name) else FileUtils.cp(File.join(source, file_name), target) end end end |
.from_config(config = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/flowcation/assets.rb', line 4 def self.from_config(config={}) config.each do |name, | ['folders'].each do |path, asset_folder_name| asset_folder_path = File.join(['output'], asset_folder_name) FileUtils.mkdir_p(asset_folder_path) asset_folder = File.new(asset_folder_path) copy_assets \ source: File.join(['input'], path), target: asset_folder end end end |