Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
1d180b7a
Commit
1d180b7a
authored
Feb 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GitlabConfig. Fixed adding key
parent
451b4a64
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
lib/gitlab_config.rb
lib/gitlab_config.rb
+17
-0
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+3
-5
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+2
-3
No files found.
lib/gitlab_config.rb
0 → 100644
View file @
1d180b7a
require
'yaml'
class
GitlabConfig
attr_reader
:config
def
initialize
@config
=
YAML
.
load_file
(
File
.
join
(
ROOT_PATH
,
'config.yml'
))
end
def
repos_path
@config
[
'repos_path'
]
=
"/home/git/repositories"
end
def
auth_file
@config
[
'auth_file'
]
=
"/home/git/.ssh/authorized_keys"
end
end
lib/gitlab_keys.rb
View file @
1d180b7a
require
'open3'
require
'open3'
require
'yaml
'
require
_relative
'gitlab_config
'
class
GitlabKeys
class
GitlabKeys
attr_accessor
:auth_file
,
:key
,
:username
attr_accessor
:auth_file
,
:key
,
:username
...
@@ -8,9 +8,7 @@ class GitlabKeys
...
@@ -8,9 +8,7 @@ class GitlabKeys
@command
=
ARGV
.
shift
@command
=
ARGV
.
shift
@username
=
ARGV
.
shift
@username
=
ARGV
.
shift
@key
=
ARGV
.
shift
@key
=
ARGV
.
shift
@auth_file
=
GitlabConfig
.
new
.
auth_file
config
=
YAML
.
load_file
(
File
.
join
(
ROOT_PATH
,
'config.yml'
))
@auth_file
=
config
[
'auth_file'
]
end
end
def
exec
def
exec
...
@@ -27,7 +25,7 @@ class GitlabKeys
...
@@ -27,7 +25,7 @@ class GitlabKeys
def
add_key
def
add_key
cmd
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell
#{
@username
}
\"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
#{
@key
}
"
cmd
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell
#{
@username
}
\"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
#{
@key
}
"
cmd
=
"echo
\
"
#{
cmd
}
\"
>>
#{
auth_file
}
"
cmd
=
"echo
\
'
#{
cmd
}
\'
>>
#{
auth_file
}
"
system
(
cmd
)
system
(
cmd
)
end
end
...
...
lib/gitlab_shell.rb
View file @
1d180b7a
require
'open3'
require
'open3'
require
'yaml
'
require
_relative
'gitlab_config
'
class
GitlabShell
class
GitlabShell
attr_accessor
:username
,
:repo_name
,
:git_cmd
,
:repos_path
attr_accessor
:username
,
:repo_name
,
:git_cmd
,
:repos_path
...
@@ -7,8 +7,7 @@ class GitlabShell
...
@@ -7,8 +7,7 @@ class GitlabShell
def
initialize
def
initialize
@username
=
ARGV
.
shift
@username
=
ARGV
.
shift
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
@config
=
YAML
.
load_file
(
File
.
join
(
ROOT_PATH
,
'config.yml'
))
@repos_path
=
GitlabConfig
.
new
.
repos_path
@repos_path
=
@config
[
'repos_path'
]
end
end
def
exec
def
exec
...
...
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