Module: Cuporter::Document::Assets

Defined in:
lib/cuporter/document/assets.rb

Constant Summary collapse

PUBLIC_SOURCE_PATH =
File.expand_path( "public", File.dirname(__FILE__) + "../../../../")
RELATIVE_PUBLIC_ASSETS_PATH =
"cuporter_public"

Class Method Summary collapse

Class Method Details

.base_path(use_copied_public_assets) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/cuporter/document/assets.rb', line 15

def self.base_path(use_copied_public_assets)
  # we count on the dirs being created by the option parser
  if use_copied_public_assets
    RELATIVE_PUBLIC_ASSETS_PATH
  else
    PUBLIC_SOURCE_PATH
  end
end

.copy(output_file_path) ⇒ Object



8
9
10
11
12
13
# File 'lib/cuporter/document/assets.rb', line 8

def self.copy(output_file_path)
  assets_target = "#{File.dirname(output_file_path)}/#{RELATIVE_PUBLIC_ASSETS_PATH}"
  FileUtils.rm_rf(assets_target) if File.exists?(assets_target)
  FileUtils.mkdir(assets_target)
  FileUtils.cp_r("#{PUBLIC_SOURCE_PATH}/.", assets_target)
end