diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 10:03:13 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 10:03:13 -0800 |
commit | 9f1a4acf62d9d94dd06b7b12375d4914a3afb941 (patch) | |
tree | 8b880bf023bf20c407542ccf10f13d21f0e10a64 /app/models | |
parent | 546dd4c2b6080f5b73ae681706d9617392afad04 (diff) | |
parent | 6b9177ca0209b78398edb409f11bb7b4f5db7ca3 (diff) | |
download | gitlab-ce-9f1a4acf62d9d94dd06b7b12375d4914a3afb941.tar.gz |
Merge pull request #2207 from koenpunt/system-to-fileutils
replaced system() calls with FileUtils.* methods
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/namespace.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index d34e5a99c79..89c1f9adb5a 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -52,7 +52,7 @@ class Namespace < ActiveRecord::Base def ensure_dir_exist unless dir_exists? - system("mkdir -m 770 #{namespace_full_path}") + FileUtils.mkdir( namespace_full_path, mode: 0770 ) end end @@ -71,11 +71,12 @@ class Namespace < ActiveRecord::Base if File.exists?(new_path) raise "Already exists" end - - if system("mv #{old_path} #{new_path}") + + begin + FileUtils.mv( old_path, new_path ) send_update_instructions @require_update_gitolite = true - else + rescue Exception => e raise "Namespace move error #{old_path} #{new_path}" end end @@ -88,7 +89,7 @@ class Namespace < ActiveRecord::Base def rm_dir dir_path = File.join(Gitlab.config.gitolite.repos_path, path) - system("rm -rf #{dir_path}") + FileUtils.rm_r( dir_path, force: true ) end def send_update_instructions |