M. Petersen M. Petersen - 11 months ago 70
Ruby Question

What does this Ruby code mean?

I am trying to make a backup restore of gitlab and it kind of works but th command line always says that the restore of the repositories failed. I think I found the conditional statement in the code which responsible for the [failed] statement. Has someone a clue what this is doing or know a direction in which I should go to find my mistake?

if Kernel.system("git clone --bare #{path_to_bundle} #{project.repository.path_to_repo} > /dev/null 2>&1")
puts "[DONE]".green
puts "[FAILED]".red


Kernel.system calls the given shell command. When it fails it return a false value.

In your case it means git clone --bare #{path_to_bundle} #{project.repository.path_to_repo} > /dev/null 2>&1 fails.

You can check why it fails when you execute this command on the command line by hand without > /dev/null 2>&1 .

To get the command you can at a debug print before the command

if Kernel.system(pp("git clone --bare #{path_to_bundle} #{project.repository.path_to_repo} > /dev/null 2>&1"))