Sha256: 86eac01036266dd9ef04c1b117925be8c79b426831ed67c9a6db70b42f574f91

Contents?: true

Size: 758 Bytes

Versions: 5

Compression:

Stored size: 758 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).to_s)
    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

5 entries across 5 versions & 1 rubygems

Version Path
frontend-generators-0.2.0 lib/frontend_generators/asset_copier.rb
frontend-generators-0.1.2 lib/frontend_generators/asset_copier.rb
frontend-generators-0.1.1 lib/frontend_generators/asset_copier.rb
frontend-generators-0.1.0 lib/frontend_generators/asset_copier.rb
frontend-generators-0.0.6 lib/frontend_generators/asset_copier.rb