Class: Gitlab::ImportExport::SnippetRepoRestorer
- Inherits:
-
RepoRestorer
- Object
- RepoRestorer
- Gitlab::ImportExport::SnippetRepoRestorer
- Defined in:
- lib/gitlab/import_export/snippet_repo_restorer.rb
Constant Summary collapse
- SnippetRepositoryError =
Class.new(StandardError)
Constants included from CommandLineUtil
CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, CommandLineUtil::CommandLineUtilError, CommandLineUtil::DEFAULT_DIR_MODE, CommandLineUtil::FileOversizedError, CommandLineUtil::HardLinkError, CommandLineUtil::UNTAR_MASK
Instance Attribute Summary collapse
-
#snippet ⇒ Object
readonly
Returns the value of attribute snippet.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from RepoRestorer
Instance Method Summary collapse
-
#initialize(snippet:, user:, shared:, path_to_bundle:) ⇒ SnippetRepoRestorer
constructor
A new instance of SnippetRepoRestorer.
- #restore ⇒ Object
Methods inherited from RepoRestorer
Methods included from CommandLineUtil
#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf
Constructor Details
#initialize(snippet:, user:, shared:, path_to_bundle:) ⇒ SnippetRepoRestorer
Returns a new instance of SnippetRepoRestorer.
10 11 12 13 14 15 16 |
# File 'lib/gitlab/import_export/snippet_repo_restorer.rb', line 10 def initialize(snippet:, user:, shared:, path_to_bundle:) @snippet = snippet @user = user @repository = snippet.repository @path_to_bundle = path_to_bundle.to_s @shared = shared end |
Instance Attribute Details
#snippet ⇒ Object (readonly)
Returns the value of attribute snippet.
6 7 8 |
# File 'lib/gitlab/import_export/snippet_repo_restorer.rb', line 6 def snippet @snippet end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/gitlab/import_export/snippet_repo_restorer.rb', line 6 def user @user end |
Instance Method Details
#restore ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/import_export/snippet_repo_restorer.rb', line 18 def restore if File.exist?(path_to_bundle) create_repository_from_bundle else create_repository_from_db end true rescue StandardError => e shared.error(e) false end |