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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
96ebc8c4
Commit
96ebc8c4
authored
Aug 10, 2016
by
bogdanvlviv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `File::exist?` instead of `File::exists?`
Since version ruby-2.2.0, method `File::exists?` is deprecated.
parent
3a46eac1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
19 deletions
+20
-19
CHANGELOG
CHANGELOG
+1
-0
lib/backup/files.rb
lib/backup/files.rb
+1
-1
lib/backup/manager.rb
lib/backup/manager.rb
+1
-1
lib/backup/repository.rb
lib/backup/repository.rb
+4
-4
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+10
-10
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+1
-1
lib/tasks/spinach.rake
lib/tasks/spinach.rake
+1
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
96ebc8c4
...
...
@@ -95,6 +95,7 @@ v 8.11.0 (unreleased)
- Avoid to show the original password field when password is automatically set. !5712 (duduribeiro)
- Fix importing GitLab projects with an invalid MR source project
- Sort folders with submodules in Files view !5521
- Each `File::exists?` replaced to `File::exist?` because of deprecate since ruby version 2.2.0
v 8.10.5
- Add a data migration to fix some missing timestamps in the members table. !5670
...
...
lib/backup/files.rb
View file @
96ebc8c4
...
...
@@ -27,7 +27,7 @@ module Backup
def
backup_existing_files_dir
timestamped_files_path
=
File
.
join
(
files_parent_dir
,
"
#{
name
}
.
#{
Time
.
now
.
to_i
}
"
)
if
File
.
exist
s
?
(
app_files_dir
)
if
File
.
exist?
(
app_files_dir
)
FileUtils
.
mv
(
app_files_dir
,
File
.
expand_path
(
timestamped_files_path
))
end
end
...
...
lib/backup/manager.rb
View file @
96ebc8c4
...
...
@@ -114,7 +114,7 @@ module Backup
tar_file
=
ENV
[
"BACKUP"
].
nil?
?
File
.
join
(
"
#{
file_list
.
first
}
_gitlab_backup.tar"
)
:
File
.
join
(
ENV
[
"BACKUP"
]
+
"_gitlab_backup.tar"
)
unless
File
.
exist
s
?
(
tar_file
)
unless
File
.
exist?
(
tar_file
)
puts
"The specified backup doesn't exist!"
exit
1
end
...
...
lib/backup/repository.rb
View file @
96ebc8c4
...
...
@@ -28,7 +28,7 @@ module Backup
wiki
=
ProjectWiki
.
new
(
project
)
if
File
.
exist
s
?
(
path_to_repo
(
wiki
))
if
File
.
exist?
(
path_to_repo
(
wiki
))
$progress
.
print
" *
#{
wiki
.
path_with_namespace
}
... "
if
wiki
.
repository
.
empty?
$progress
.
puts
" [SKIPPED]"
.
color
(
:cyan
)
...
...
@@ -49,7 +49,7 @@ module Backup
def
restore
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
path
|
next
unless
File
.
exist
s
?
(
path
)
next
unless
File
.
exist?
(
path
)
# Move repos dir to 'repositories.old' dir
bk_repos_path
=
File
.
join
(
path
,
'..'
,
'repositories.old.'
+
Time
.
now
.
to_i
.
to_s
)
...
...
@@ -63,7 +63,7 @@ module Backup
project
.
ensure_dir_exist
if
File
.
exist
s
?
(
path_to_bundle
(
project
))
if
File
.
exist?
(
path_to_bundle
(
project
))
FileUtils
.
mkdir_p
(
path_to_repo
(
project
))
cmd
=
%W(tar -xf
#{
path_to_bundle
(
project
)
}
-C
#{
path_to_repo
(
project
)
}
)
else
...
...
@@ -80,7 +80,7 @@ module Backup
wiki
=
ProjectWiki
.
new
(
project
)
if
File
.
exist
s
?
(
path_to_bundle
(
wiki
))
if
File
.
exist?
(
path_to_bundle
(
wiki
))
$progress
.
print
" *
#{
wiki
.
path_with_namespace
}
... "
# If a wiki bundle exists, first remove the empty repo
...
...
lib/tasks/gitlab/check.rake
View file @
96ebc8c4
...
...
@@ -73,7 +73,7 @@ namespace :gitlab do
database_config_file
=
Rails
.
root
.
join
(
"config"
,
"database.yml"
)
if
File
.
exist
s
?
(
database_config_file
)
if
File
.
exist?
(
database_config_file
)
puts
"yes"
.
color
(
:green
)
else
puts
"no"
.
color
(
:red
)
...
...
@@ -94,7 +94,7 @@ namespace :gitlab do
gitlab_config_file
=
Rails
.
root
.
join
(
"config"
,
"gitlab.yml"
)
if
File
.
exist
s
?
(
gitlab_config_file
)
if
File
.
exist?
(
gitlab_config_file
)
puts
"yes"
.
color
(
:green
)
else
puts
"no"
.
color
(
:red
)
...
...
@@ -113,7 +113,7 @@ namespace :gitlab do
print
"GitLab config outdated? ... "
gitlab_config_file
=
Rails
.
root
.
join
(
"config"
,
"gitlab.yml"
)
unless
File
.
exist
s
?
(
gitlab_config_file
)
unless
File
.
exist?
(
gitlab_config_file
)
puts
"can't check because of previous errors"
.
color
(
:magenta
)
end
...
...
@@ -144,7 +144,7 @@ namespace :gitlab do
script_path
=
"/etc/init.d/gitlab"
if
File
.
exist
s
?
(
script_path
)
if
File
.
exist?
(
script_path
)
puts
"yes"
.
color
(
:green
)
else
puts
"no"
.
color
(
:red
)
...
...
@@ -169,7 +169,7 @@ namespace :gitlab do
recipe_path
=
Rails
.
root
.
join
(
"lib/support/init.d/"
,
"gitlab"
)
script_path
=
"/etc/init.d/gitlab"
unless
File
.
exist
s
?
(
script_path
)
unless
File
.
exist?
(
script_path
)
puts
"can't check because of previous errors"
.
color
(
:magenta
)
return
end
...
...
@@ -361,7 +361,7 @@ namespace :gitlab do
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repo_base_path
|
print
"
#{
name
}
... "
if
File
.
exist
s
?
(
repo_base_path
)
if
File
.
exist?
(
repo_base_path
)
puts
"yes"
.
color
(
:green
)
else
puts
"no"
.
color
(
:red
)
...
...
@@ -385,7 +385,7 @@ namespace :gitlab do
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repo_base_path
|
print
"
#{
name
}
... "
unless
File
.
exist
s
?
(
repo_base_path
)
unless
File
.
exist?
(
repo_base_path
)
puts
"can't check because of previous errors"
.
color
(
:magenta
)
return
end
...
...
@@ -408,7 +408,7 @@ namespace :gitlab do
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repo_base_path
|
print
"
#{
name
}
... "
unless
File
.
exist
s
?
(
repo_base_path
)
unless
File
.
exist?
(
repo_base_path
)
puts
"can't check because of previous errors"
.
color
(
:magenta
)
return
end
...
...
@@ -438,7 +438,7 @@ namespace :gitlab do
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repo_base_path
|
print
"
#{
name
}
... "
unless
File
.
exist
s
?
(
repo_base_path
)
unless
File
.
exist?
(
repo_base_path
)
puts
"can't check because of previous errors"
.
color
(
:magenta
)
return
end
...
...
lib/tasks/gitlab/shell.rake
View file @
96ebc8c4
...
...
@@ -90,7 +90,7 @@ namespace :gitlab do
task
build_missing_projects: :environment
do
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
path_to_repo
=
project
.
repository
.
path_to_repo
if
File
.
exist
s
?
(
path_to_repo
)
if
File
.
exist?
(
path_to_repo
)
print
'-'
else
if
Gitlab
::
Shell
.
new
.
add_repository
(
project
.
repository_storage_path
,
...
...
lib/tasks/spinach.rake
View file @
96ebc8c4
...
...
@@ -46,7 +46,7 @@ def run_spinach_tests(tags)
success
=
run_spinach_command
(
%W(--tags
#{
tags
}
)
)
3
.
times
do
|
_
|
break
if
success
break
unless
File
.
exist
s
?
(
'tmp/spinach-rerun.txt'
)
break
unless
File
.
exist?
(
'tmp/spinach-rerun.txt'
)
tests
=
File
.
foreach
(
'tmp/spinach-rerun.txt'
).
map
(
&
:chomp
)
puts
''
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
96ebc8c4
...
...
@@ -42,7 +42,7 @@ describe 'gitlab:app namespace rake task' do
before
do
allow
(
Dir
).
to
receive
(
:glob
).
and_return
([])
allow
(
Dir
).
to
receive
(
:chdir
)
allow
(
File
).
to
receive
(
:exist
s
?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
Kernel
).
to
receive
(
:system
).
and_return
(
true
)
allow
(
FileUtils
).
to
receive
(
:cp_r
).
and_return
(
true
)
allow
(
FileUtils
).
to
receive
(
:mv
).
and_return
(
true
)
...
...
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