Sha256: 442100dc7a10197119c42fdadca82a70bc1fb677d9c0c0cd9eebafdc74312b5d

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

module FrontendGenerators; class AssetCopier

  attr_reader :asset_path, :asset_root_dirname

  def initialize(asset_path, asset_root_dirname)
    @asset_path = asset_path
    @asset_root_dirname = asset_root_dirname
  end

  def full_copy
    FileUtils.mkdir_p(destination_dirname)
    copy_asset
    puts message
  end

  def copy_asset
    FileUtils.cp(asset_path, destination_dirname)
  end

  def message
    "#{Rainbow("create").green}    #{destination_partial_path}"
  end

  def destination_dirname
    p = asset_path.gsub(asset_root_dirname, Turf.find(:destination_root))
    dirname = File.dirname(p)
    FileUtils.mkdir_p(dirname)
    dirname
  end

  def destination_partial_path
    asset_path.gsub(asset_root_dirname, "")
  end

end; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frontend-generators-0.0.4 lib/frontend_generators/asset_copier.rb
frontend-generators-0.0.3 lib/frontend_generators/asset_copier.rb