summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/backup/database.rb11
-rw-r--r--lib/backup/repository.rb9
-rw-r--r--spec/models/gollum_wiki_spec.rb4
-rw-r--r--spec/models/wiki_page_spec.rb4
-rw-r--r--spec/support/test_env.rb8
5 files changed, 17 insertions, 19 deletions
diff --git a/lib/backup/database.rb b/lib/backup/database.rb
index 6ada5bb4ea2..c4fb2e2e159 100644
--- a/lib/backup/database.rb
+++ b/lib/backup/database.rb
@@ -1,5 +1,4 @@
require 'yaml'
-require 'shellwords'
module Backup
class Database
@@ -14,20 +13,20 @@ module Backup
def dump
case config["adapter"]
when /^mysql/ then
- system("mysqldump #{mysql_args} #{Shellwords.shellescape(config['database'])} > #{Shellwords.shellescape(db_file_name)}")
+ system("mysqldump #{mysql_args} #{config['database']} > #{db_file_name}")
when "postgresql" then
pg_env
- system("pg_dump #{Shellwords.shellescape(config['database'])} > #{db_file_name}")
+ system("pg_dump #{config['database']} > #{db_file_name}")
end
end
def restore
case config["adapter"]
when /^mysql/ then
- system("mysql #{mysql_args} #{Shellwords.shellescape(config['database'])} < #{db_file_name}")
+ system("mysql #{mysql_args} #{config['database']} < #{db_file_name}")
when "postgresql" then
pg_env
- system("psql #{Shellwords.shellescape(config['database'])} -f #{Shellwords.shellescape(db_file_name)}")
+ system("psql #{config['database']} -f #{db_file_name}")
end
end
@@ -46,7 +45,7 @@ module Backup
'encoding' => '--default-character-set',
'password' => '--password'
}
- args.map { |opt, arg| "#{arg}=#{Shellwords.shellescape(config[opt])}" if config[opt] }.compact.join(' ')
+ args.map { |opt, arg| "#{arg}='#{config[opt]}'" if config[opt] }.compact.join(' ')
end
def pg_env
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 3649ff99d24..252201f11be 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -1,5 +1,4 @@
require 'yaml'
-require 'shellwords'
module Backup
class Repository
@@ -19,7 +18,7 @@ module Backup
# Create namespace dir if missing
FileUtils.mkdir_p(File.join(backup_repos_path, project.namespace.path)) if project.namespace
- if system("cd #{Shellwords.shellescape(path_to_repo(project))} > /dev/null 2>&1 && git bundle create #{Shellwords.shellescape(path_to_bundle(project))} --all > /dev/null 2>&1")
+ if system("cd #{path_to_repo(project)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(project)} --all > /dev/null 2>&1")
puts "[DONE]".green
else
puts "[FAILED]".red
@@ -31,7 +30,7 @@ module Backup
print " * #{wiki.path_with_namespace} ... "
if wiki.empty?
puts " [SKIPPED]".cyan
- elsif system("cd #{Shellwords.shellescape(path_to_repo(wiki))} > /dev/null 2>&1 && git bundle create #{Shellwords.shellescape(path_to_bundle(wiki))} --all > /dev/null 2>&1")
+ elsif system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1")
puts " [DONE]".green
else
puts " [FAILED]".red
@@ -54,7 +53,7 @@ module Backup
project.namespace.ensure_dir_exist if project.namespace
- if system("git clone --bare #{Shellwords.shellescape(path_to_bundle(project))} #{Shellwords.shellescape(path_to_repo(project))} > /dev/null 2>&1")
+ if system("git clone --bare #{path_to_bundle(project)} #{path_to_repo(project)} > /dev/null 2>&1")
puts "[DONE]".green
else
puts "[FAILED]".red
@@ -64,7 +63,7 @@ module Backup
if File.exists?(path_to_bundle(wiki))
print " * #{wiki.path_with_namespace} ... "
- if system("git clone --bare #{Shellwords.shellescape(path_to_bundle(wiki))} #{Shellwords.shellescape(path_to_repo(wiki))} > /dev/null 2>&1")
+ if system("git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)} > /dev/null 2>&1")
puts " [DONE]".green
else
puts " [FAILED]".red
diff --git a/spec/models/gollum_wiki_spec.rb b/spec/models/gollum_wiki_spec.rb
index de786478de9..9e07d9ee191 100644
--- a/spec/models/gollum_wiki_spec.rb
+++ b/spec/models/gollum_wiki_spec.rb
@@ -1,11 +1,11 @@
require "spec_helper"
-require "shellwords"
describe GollumWiki do
def create_temp_repo(path)
FileUtils.mkdir_p path
- system("git init --quiet #{Shellwords.shellescape(path)}")
+ command = "git init --quiet #{path};"
+ system(command)
end
def remove_temp_repo(path)
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index b9883342c3a..67f2a6da42d 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -1,11 +1,11 @@
require "spec_helper"
-require "shellwords"
describe WikiPage do
def create_temp_repo(path)
FileUtils.mkdir_p path
- system("git init --quiet #{Shellwords.shellescape(path)}")
+ command = "git init --quiet #{path};"
+ system(command)
end
def remove_temp_repo(path)
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 5c6f96abc1b..16e10b1a62b 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -1,5 +1,4 @@
require 'rspec/mocks'
-require 'shellwords'
module TestEnv
extend self
@@ -103,7 +102,7 @@ module TestEnv
repo = repo(namespace, name)
# Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq
- system("ln -s -f #{Shellwords.shellescape(seed_repo_path())} #{Shellwords.shellescape(repo)}")
+ system("ln -s -f #{seed_repo_path()} #{repo}")
create_satellite(repo, namespace, name)
end
@@ -167,11 +166,12 @@ module TestEnv
# Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already
satellite_dir = File.dirname(satellite_repo)
FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir)
- system("ln -s -f #{Shellwords.shellescape(seed_satellite_path)} #{Shellwords.shellescape(satellite_repo)}")
+ system("ln -s -f #{seed_satellite_path} #{satellite_repo}")
end
def create_temp_repo(path)
FileUtils.mkdir_p path
- system("git init --quiet --bare #{Shellwords.shellescape(path)}")
+ command = "git init --quiet --bare #{path};"
+ system(command)
end
end