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
Boxiang Sun
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
Hide 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
class
UpdatePagesService
<
BaseService
Inva
il
dStateError
=
Class
.
new
(
StandardError
)
Inva
li
dStateError
=
Class
.
new
(
StandardError
)
FailedToExtractError
=
Class
.
new
(
StandardError
)
BLOCK_SIZE
=
32
.
kilobytes
...
...
@@ -21,8 +21,8 @@ module Projects
@status
.
enqueue!
@status
.
run!
raise
Inva
il
dStateError
,
'missing pages artifacts'
unless
build
.
artifacts?
raise
Inva
il
dStateError
,
'pages are outdated'
unless
latest?
raise
Inva
li
dStateError
,
'missing pages artifacts'
unless
build
.
artifacts?
raise
Inva
li
dStateError
,
'pages are outdated'
unless
latest?
# Create temporary directory in which we will extract the artifacts
FileUtils
.
mkdir_p
(
tmp_path
)
...
...
@@ -31,13 +31,13 @@ module Projects
# Check if we did extract public directory
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
il
dStateError
,
'pages are outdated'
unless
latest?
raise
Inva
li
dStateError
,
'pages miss the public folder'
unless
Dir
.
exist?
(
archive_public_path
)
raise
Inva
li
dStateError
,
'pages are outdated'
unless
latest?
deploy_page!
(
archive_public_path
)
success
end
rescue
Inva
il
dStateError
=>
e
rescue
Inva
li
dStateError
=>
e
error
(
e
.
message
)
rescue
=>
e
error
(
e
.
message
)
...
...
@@ -75,18 +75,18 @@ module Projects
if
artifacts
.
ends_with?
(
'.zip'
)
extract_zip_archive!
(
temp_path
)
else
raise
Inva
il
dStateError
,
'unsupported artifacts format'
raise
Inva
li
dStateError
,
'unsupported artifacts format'
end
end
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
public_entry
=
build
.
artifacts_metadata_entry
(
SITE_PATH
,
recursive:
true
)
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
# 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