Class: Arli::Actions::MoveToLibraryPath

Inherits:
Action
  • Object
show all
Includes:
Helpers::SystemCommands
Defined in:
lib/arli/actions/move_to_library_path.rb

Constant Summary

Constants included from Helpers::Output

Helpers::Output::CHAR_FAILURE, Helpers::Output::CHAR_SUCCESS

Instance Attribute Summary

Attributes inherited from Action

#config, #library

Instance Method Summary collapse

Methods included from Helpers::SystemCommands

#backup!, #handle_preexisting_folder, #run_system_command

Methods included from Helpers::Output

#___, #__p, #__pf, #__pt, #abort?, #action_fail, #action_ok, #backup?, #cursor, #debug, #debug?, disable!, enable!, enabled?, #error, #fuck, #header, #hr, #indent_cursor, #info, #ok, #overwrite?, #print_action_failure, #print_action_starting, #print_action_success, #print_target_dir, #quiet?, #raise_invalid_arli_command!, #report_exception, #verbose?

Methods inherited from Action

inherited, #initialize, #mv, #run!, #supported?, #to_s

Methods included from Helpers::Inherited

included

Constructor Details

This class inherits a constructor from Arli::Actions::Action

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/arli/actions/move_to_library_path.rb', line 12

def execute
  Dir.chdir(config.runtime.pwd) do
    handle_preexisting_folder(path) if exists?
    if Dir.exist?(temp_path) && !Dir.exist?(path)
      FileUtils.mkdir_p(File.dirname(path))
      ___ "current: #{Dir.pwd.yellow}\ntemp_path: #{temp_path.yellow}\nlibrary_path: #{path.yellow}\n" if debug?
      mv(temp_path, path)
    elsif Dir.exist?(path)
      raise ::Arli::Errors::InstallerError,
            "Directory #{path} was not expected to still be there!"
    elsif !Dir.exist?(temp_path)
      raise ::Arli::Errors::InstallerError,
            "Directory #{temp_path} was expected to exist!"
    end
  end
end