summaryrefslogtreecommitdiff
path: root/lib/backup/repository.rb
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-06-01 16:37:15 -0600
committerConnor Shea <connor.james.shea@gmail.com>2016-06-03 10:37:09 -0600
commit903946c78a0f73e5cbdfce7b93d31c4d1bd045cd (patch)
tree75ea69a57dda6c3315868638d04d9d9330c59f11 /lib/backup/repository.rb
parent8e7e3be5a1c1184a7a60145420eb9733396f9dee (diff)
downloadgitlab-ce-903946c78a0f73e5cbdfce7b93d31c4d1bd045cd.tar.gz
Replace colorize gem with rainbow.
Colorize is a gem licensed under the GPLv2, so we can’t use it in GitLab without relicensing GitLab under the terms of the GPL. Rainbow is licensed under the MIT license and does the exact same thing as Colorize, so Rainbow was added in place of Colorize. The syntax is slightly different for Rainbow vs. Colorize, and was updated in accordance. The gem is still a dependency of Spinach, so it’s included in the development/test environments, but won’t be packaged with the actual product, and therefore doesn’t require we relicense the product. An attempt at relicensing Colorize was made, but didn’t succeed as the library owner never responded. Rainbow library: https://github.com/sickill/rainbow Relevant issue regarding licensing in GitLab's gems: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3775
Diffstat (limited to 'lib/backup/repository.rb')
-rw-r--r--lib/backup/repository.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index a82a7e1f7bf..7b91215d50b 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -14,14 +14,14 @@ module Backup
FileUtils.mkdir_p(File.join(backup_repos_path, project.namespace.path)) if project.namespace
if project.empty_repo?
- $progress.puts "[SKIPPED]".cyan
+ $progress.puts "[SKIPPED]".color(:cyan)
else
cmd = %W(tar -cf #{path_to_bundle(project)} -C #{path_to_repo(project)} .)
output, status = Gitlab::Popen.popen(cmd)
if status.zero?
- $progress.puts "[DONE]".green
+ $progress.puts "[DONE]".color(:green)
else
- puts "[FAILED]".red
+ puts "[FAILED]".color(:red)
puts "failed: #{cmd.join(' ')}"
puts output
abort 'Backup failed'
@@ -33,14 +33,14 @@ module Backup
if File.exists?(path_to_repo(wiki))
$progress.print " * #{wiki.path_with_namespace} ... "
if wiki.repository.empty?
- $progress.puts " [SKIPPED]".cyan
+ $progress.puts " [SKIPPED]".color(:cyan)
else
cmd = %W(#{Gitlab.config.git.bin_path} --git-dir=#{path_to_repo(wiki)} bundle create #{path_to_bundle(wiki)} --all)
output, status = Gitlab::Popen.popen(cmd)
if status.zero?
- $progress.puts " [DONE]".green
+ $progress.puts " [DONE]".color(:green)
else
- puts " [FAILED]".red
+ puts " [FAILED]".color(:red)
puts "failed: #{cmd.join(' ')}"
abort 'Backup failed'
end
@@ -71,9 +71,9 @@ module Backup
end
if system(*cmd, silent)
- $progress.puts "[DONE]".green
+ $progress.puts "[DONE]".color(:green)
else
- puts "[FAILED]".red
+ puts "[FAILED]".color(:red)
puts "failed: #{cmd.join(' ')}"
abort 'Restore failed'
end
@@ -90,21 +90,21 @@ module Backup
cmd = %W(#{Gitlab.config.git.bin_path} clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)})
if system(*cmd, silent)
- $progress.puts " [DONE]".green
+ $progress.puts " [DONE]".color(:green)
else
- puts " [FAILED]".red
+ puts " [FAILED]".color(:red)
puts "failed: #{cmd.join(' ')}"
abort 'Restore failed'
end
end
end
- $progress.print 'Put GitLab hooks in repositories dirs'.yellow
+ $progress.print 'Put GitLab hooks in repositories dirs'.color(:yellow)
cmd = "#{Gitlab.config.gitlab_shell.path}/bin/create-hooks"
if system(cmd)
- $progress.puts " [DONE]".green
+ $progress.puts " [DONE]".color(:green)
else
- puts " [FAILED]".red
+ puts " [FAILED]".color(:red)
puts "failed: #{cmd}"
end