Method: ViewAssets::Manager::Modifier#update_index

Defined in:
lib/view_assets/manager/modifier.rb

#update_index(index, new_index) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/view_assets/manager/modifier.rb', line 42

def update_index(index, new_index)
  path_to_index = PathInfo.new(index).abs
  new_path_to_index = PathInfo.new(new_index).abs

  if FileTest.exists?(path_to_index)
    FileUtils.mv(path_to_index, new_path_to_index)
  elsif FileTest.exists?("#{path_to_index}.#{ext}")
    FileUtils.mv("#{path_to_index}.#{ext}", "#{new_path_to_index}.#{ext}")
  else
    raise Error.new(red("Manifest #{index} doesn't exist."))
  end
end