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
Jérome Perrin
gitlab-ce
Commits
47ac3347
Commit
47ac3347
authored
Apr 27, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InvaildStateError -> InvalidStateError
parent
ad113a3c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+9
-9
No files found.
app/services/projects/update_pages_service.rb
View file @
47ac3347
module
Projects
module
Projects
class
UpdatePagesService
<
BaseService
class
UpdatePagesService
<
BaseService
Inva
il
dStateError
=
Class
.
new
(
StandardError
)
Inva
li
dStateError
=
Class
.
new
(
StandardError
)
FailedToExtractError
=
Class
.
new
(
StandardError
)
FailedToExtractError
=
Class
.
new
(
StandardError
)
BLOCK_SIZE
=
32
.
kilobytes
BLOCK_SIZE
=
32
.
kilobytes
...
@@ -21,8 +21,8 @@ module Projects
...
@@ -21,8 +21,8 @@ module Projects
@status
.
enqueue!
@status
.
enqueue!
@status
.
run!
@status
.
run!
raise
Inva
il
dStateError
,
'missing pages artifacts'
unless
build
.
artifacts?
raise
Inva
li
dStateError
,
'missing pages artifacts'
unless
build
.
artifacts?
raise
Inva
il
dStateError
,
'pages are outdated'
unless
latest?
raise
Inva
li
dStateError
,
'pages are outdated'
unless
latest?
# Create temporary directory in which we will extract the artifacts
# Create temporary directory in which we will extract the artifacts
FileUtils
.
mkdir_p
(
tmp_path
)
FileUtils
.
mkdir_p
(
tmp_path
)
...
@@ -31,13 +31,13 @@ module Projects
...
@@ -31,13 +31,13 @@ module Projects
# Check if we did extract public directory
# Check if we did extract public directory
archive_public_path
=
File
.
join
(
archive_path
,
'public'
)
archive_public_path
=
File
.
join
(
archive_path
,
'public'
)
raise
Inva
il
dStateError
,
'pages miss the public folder'
unless
Dir
.
exist?
(
archive_public_path
)
raise
Inva
li
dStateError
,
'pages miss the public folder'
unless
Dir
.
exist?
(
archive_public_path
)
raise
Inva
il
dStateError
,
'pages are outdated'
unless
latest?
raise
Inva
li
dStateError
,
'pages are outdated'
unless
latest?
deploy_page!
(
archive_public_path
)
deploy_page!
(
archive_public_path
)
success
success
end
end
rescue
Inva
il
dStateError
=>
e
rescue
Inva
li
dStateError
=>
e
error
(
e
.
message
)
error
(
e
.
message
)
rescue
=>
e
rescue
=>
e
error
(
e
.
message
)
error
(
e
.
message
)
...
@@ -75,18 +75,18 @@ module Projects
...
@@ -75,18 +75,18 @@ module Projects
if
artifacts
.
ends_with?
(
'.zip'
)
if
artifacts
.
ends_with?
(
'.zip'
)
extract_zip_archive!
(
temp_path
)
extract_zip_archive!
(
temp_path
)
else
else
raise
Inva
il
dStateError
,
'unsupported artifacts format'
raise
Inva
li
dStateError
,
'unsupported artifacts format'
end
end
end
end
def
extract_zip_archive!
(
temp_path
)
def
extract_zip_archive!
(
temp_path
)
raise
Inva
il
dStateError
,
'missing artifacts metadata'
unless
build
.
artifacts_metadata?
raise
Inva
li
dStateError
,
'missing artifacts metadata'
unless
build
.
artifacts_metadata?
# Calculate page size after extract
# Calculate page size after extract
public_entry
=
build
.
artifacts_metadata_entry
(
SITE_PATH
,
recursive:
true
)
public_entry
=
build
.
artifacts_metadata_entry
(
SITE_PATH
,
recursive:
true
)
if
public_entry
.
total_size
>
max_size
if
public_entry
.
total_size
>
max_size
raise
Inva
il
dStateError
,
"artifacts for pages are too large:
#{
public_entry
.
total_size
}
"
raise
Inva
li
dStateError
,
"artifacts for pages are too large:
#{
public_entry
.
total_size
}
"
end
end
# Requires UnZip at least 6.00 Info-ZIP.
# Requires UnZip at least 6.00 Info-ZIP.
...
...
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