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
4908b894
Commit
4908b894
authored
Feb 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project builder
parent
fcf70b91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
bin/gitlab-projects
bin/gitlab-projects
+14
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+35
-0
No files found.
bin/gitlab-projects
0 → 100755
View file @
4908b894
#!/usr/bin/env ruby
#
# GitLab Projects shell. Add/remove projects from /home/git/repositories
#
# Ex.
# /bin/gitlab-projects add-project gitlab/gitlab-ci.git
#
#
ROOT_PATH
=
File
.
join
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)),
".."
)
require
File
.
join
(
ROOT_PATH
,
'lib'
,
'gitlab_projects'
)
GitlabProjects
.
new
.
exec
exit
lib/gitlab_projects.rb
0 → 100644
View file @
4908b894
require
'open3'
require
'fileutils'
require_relative
'gitlab_config'
class
GitlabProjects
attr_accessor
:project_name
def
initialize
@command
=
ARGV
.
shift
@project_name
=
ARGV
.
shift
@repos_path
=
GitlabConfig
.
new
.
repos_path
@full_path
=
File
.
join
(
@repos_path
,
@project_name
)
end
def
exec
case
@command
when
'add-project'
;
add_project
when
'rm-project'
;
rm_project
else
puts
'not allowed'
end
end
protected
def
add_project
FileUtils
.
mkdir_p
(
@full_path
,
mode:
0770
)
cmd
=
"cd
#{
@full_path
}
&& git init --bare"
system
(
cmd
)
end
def
rm_project
FileUtils
.
rm_rf
(
@full_path
)
end
end
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