diff options
author | James Lopez <james@jameslopez.es> | 2016-04-14 17:57:25 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-04-14 17:57:25 +0300 |
commit | 0852f539aa389c66ef377b7d567c931f928e147f (patch) | |
tree | 82797f5e855f9235d445c943af7161b4cc7d2238 /lib/gitlab/import_export/command_line_util.rb | |
parent | 91ffd8028977984d3ea9a741a3a655ff6dae76b2 (diff) |
refactored stuff, added a save and compress all class and moved mostly everything to lib
Diffstat (limited to 'lib/gitlab/import_export/command_line_util.rb')
-rw-r--r-- | lib/gitlab/import_export/command_line_util.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/command_line_util.rb b/lib/gitlab/import_export/command_line_util.rb new file mode 100644 index 00000000000..7bf4b476b6c --- /dev/null +++ b/lib/gitlab/import_export/command_line_util.rb @@ -0,0 +1,25 @@ +module Gitlab + module ImportExport + module CommandLineUtil + def tar_cf(archive:, dir:) + tar_with_options(archive: archive, dir: dir, options: 'cf') + end + + def tar_czf(archive:, dir:) + tar_with_options(archive: archive, dir: dir, options: 'czf') + end + + def git_bundle(git_bin_path: Gitlab.config.git.bin_path, repo_path:, bundle_path:) + cmd = %W(#{git_bin_path} --git-dir=#{repo_path} bundle create #{bundle_path} --all) + _output, status = Gitlab::Popen.popen(cmd) + status.zero? + end + + def tar_with_options(archive:, dir:, options:) + cmd = %W(tar -#{options} #{archive} -C #{dir} .) + _output, status = Gitlab::Popen.popen(cmd) + status.zero? + end + end + end +end |