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
6cd9888f
Commit
6cd9888f
authored
Aug 09, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store gpg return directory locally
parent
3a9f210b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
lib/gitlab/gpg.rb
lib/gitlab/gpg.rb
+9
-5
spec/lib/gitlab/gpg_spec.rb
spec/lib/gitlab/gpg_spec.rb
+22
-0
No files found.
lib/gitlab/gpg.rb
View file @
6cd9888f
...
...
@@ -44,19 +44,23 @@ module Gitlab
def
using_tmp_keychain
Dir
.
mktmpdir
do
|
dir
|
@original_dirs
||=
[
GPGME
::
Engine
.
dirinfo
(
'homedir'
)]
@original_dirs
.
push
(
dir
)
previous_dir
=
current_home_dir
GPGME
::
Engine
.
home_dir
=
dir
return_value
=
yield
@original_dirs
.
pop
GPGME
::
Engine
.
home_dir
=
@original_dirs
[
-
1
]
GPGME
::
Engine
.
home_dir
=
previous_dir
return_value
end
end
# 1. Returns the custom home directory if one has been set by calling
# `GPGME::Engine.home_dir=`
# 2. Returns the default home directory otherwise
def
current_home_dir
GPGME
::
Engine
.
info
.
first
.
home_dir
||
GPGME
::
Engine
.
dirinfo
(
'homedir'
)
end
end
end
spec/lib/gitlab/gpg_spec.rb
View file @
6cd9888f
...
...
@@ -43,6 +43,28 @@ describe Gitlab::Gpg do
).
to
eq
[]
end
end
describe
'.current_home_dir'
do
let
(
:default_home_dir
)
{
GPGME
::
Engine
.
dirinfo
(
'homedir'
)
}
it
'returns the default value when no explicit home dir has been set'
do
expect
(
described_class
.
current_home_dir
).
to
eq
default_home_dir
end
it
'returns the explicitely set home dir'
do
GPGME
::
Engine
.
home_dir
=
'/tmp/gpg'
expect
(
described_class
.
current_home_dir
).
to
eq
'/tmp/gpg'
GPGME
::
Engine
.
home_dir
=
GPGME
::
Engine
.
dirinfo
(
'homedir'
)
end
it
'returns the default value when explicitely setting the home dir to nil'
do
GPGME
::
Engine
.
home_dir
=
nil
expect
(
described_class
.
current_home_dir
).
to
eq
default_home_dir
end
end
end
describe
Gitlab
::
Gpg
::
CurrentKeyChain
do
...
...
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