Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
99d87d86
Commit
99d87d86
authored
Mar 08, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP - added wiki repo bundler
parent
556cafa4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
0 deletions
+61
-0
app/services/projects/import_export/command_line_util.rb
app/services/projects/import_export/command_line_util.rb
+6
-0
app/services/projects/import_export/wiki_repo_bundler.rb
app/services/projects/import_export/wiki_repo_bundler.rb
+30
-0
spec/services/projects/import_export/wiki_repo_bundler_spec.rb
...services/projects/import_export/wiki_repo_bundler_spec.rb
+25
-0
No files found.
app/services/projects/import_export/command_line_util.rb
View file @
99d87d86
...
...
@@ -6,6 +6,12 @@ module Projects
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
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
end
end
end
app/services/projects/import_export/wiki_repo_bundler.rb
0 → 100644
View file @
99d87d86
module
Projects
module
ImportExport
class
WikiRepoBundler
<
RepoBundler
def
bundle
@wiki
=
ProjectWiki
.
new
(
@project
)
return
false
if
!
wiki?
@full_path
=
File
.
join
(
@export_path
,
project_filename
)
bundle_to_disk
end
def
bundle_to_disk
FileUtils
.
mkdir_p
(
@export_path
)
git_bundle
(
repo_path:
path_to_repo
,
bundle_path:
@full_path
)
rescue
#TODO: handle error
false
end
private
def
path_to_repo
@wiki
.
repository
.
path_to_repo
end
def
wiki?
File
.
exists?
(
@wiki
.
repository
.
path_to_repo
)
&&
!
@wiki
.
repository
.
empty?
end
end
end
end
spec/services/projects/import_export/wiki_repo_bundler_spec.rb
0 → 100644
View file @
99d87d86
require
'spec_helper'
describe
Projects
::
ImportExport
::
WikiRepoBundler
,
services:
true
do
describe
:bundle
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Projects
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
path_with_namespace
)
}
let
(
:wiki_bundler
)
{
Projects
::
ImportExport
::
WikiRepoBundler
.
new
(
project:
project
,
shared:
shared
)
}
before
(
:each
)
do
project
.
team
<<
[
user
,
:master
]
allow_any_instance_of
(
Projects
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
end
after
(
:each
)
do
FileUtils
.
rm_rf
(
export_path
)
end
it
'bundles the repo successfully'
do
expect
(
wiki_bundler
.
bundle
).
to
be
true
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment