diff options
author | James Lopez <james@jameslopez.es> | 2016-05-03 11:13:10 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-05-03 11:13:10 +0200 |
commit | 58b0b1a6615958d2ca7628a06898f81b316e6637 (patch) | |
tree | 05978f615fd58fd58620ac967648190e3bf4a0b6 /lib/gitlab/import_export/command_line_util.rb | |
parent | fedfba55194ed51c6a7510c01fa94091e92c71cf (diff) | |
download | gitlab-ce-58b0b1a6615958d2ca7628a06898f81b316e6637.tar.gz |
picking export stuff from the UI branch
Diffstat (limited to 'lib/gitlab/import_export/command_line_util.rb')
-rw-r--r-- | lib/gitlab/import_export/command_line_util.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/command_line_util.rb b/lib/gitlab/import_export/command_line_util.rb index 7bf4b476b6c..5ff72f5ff8d 100644 --- a/lib/gitlab/import_export/command_line_util.rb +++ b/lib/gitlab/import_export/command_line_util.rb @@ -5,6 +5,14 @@ module Gitlab tar_with_options(archive: archive, dir: dir, options: 'cf') end + def untar_zxf(archive:, dir:) + untar_with_options(archive: archive, dir: dir, options: 'zxf') + end + + def untar_xf(archive:, dir:) + untar_with_options(archive: archive, dir: dir, options: 'xf') + end + def tar_czf(archive:, dir:) tar_with_options(archive: archive, dir: dir, options: 'czf') end @@ -20,6 +28,12 @@ module Gitlab _output, status = Gitlab::Popen.popen(cmd) status.zero? end + + def untar_with_options(archive:, dir:, options:) + cmd = %W(tar -#{options} #{archive} -C #{dir}) + _output, status = Gitlab::Popen.popen(cmd) + status.zero? + end end end end |