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
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-shell
Commits
8f9c11af
Commit
8f9c11af
authored
Oct 28, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #179 from feedhenry/projects_list
Added list-projects command & spec
parents
823aba63
6cd167ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
README.md
README.md
+4
-0
bin/gitlab-projects
bin/gitlab-projects
+2
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+9
-1
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+16
-0
No files found.
README.md
View file @
8f9c11af
...
...
@@ -31,6 +31,10 @@ Remove repo:
./bin/gitlab-projects rm-project gitlab/gitlab-ci.git
List repos:
./bin/gitlab-projects list-projects
Import repo:
# Default timeout is 2 minutes
...
...
bin/gitlab-projects
View file @
8f9c11af
...
...
@@ -11,6 +11,8 @@ require_relative '../lib/gitlab_init'
#
# /bin/gitlab-projects rm-project gitlab/gitlab-ci.git
#
# /bin/gitlab-projects list-projects
#
# /bin/gitlab-projects mv-project gitlab/gitlab-ci.git randx/fork.git
#
# /bin/gitlab-projects fork-project gitlab/gitlab-ci.git randx
...
...
lib/gitlab_projects.rb
View file @
8f9c11af
...
...
@@ -31,7 +31,7 @@ class GitlabProjects
@command
=
ARGV
.
shift
@project_name
=
ARGV
.
shift
@repos_path
=
GitlabConfig
.
new
.
repos_path
@full_path
=
File
.
join
(
@repos_path
,
@project_name
)
@full_path
=
File
.
join
(
@repos_path
,
@project_name
)
unless
@project_name
.
nil?
end
def
exec
...
...
@@ -41,6 +41,7 @@ class GitlabProjects
when
'create-tag'
;
create_tag
when
'rm-tag'
;
rm_tag
when
'add-project'
;
add_project
when
'list-projects'
;
puts
list_projects
when
'rm-project'
;
rm_project
when
'mv-project'
;
mv_project
when
'import-project'
;
import_project
...
...
@@ -93,6 +94,13 @@ class GitlabProjects
system
(
*
cmd
)
&&
self
.
class
.
create_hooks
(
full_path
)
end
def
list_projects
$logger
.
info
'Listing projects'
Dir
.
chdir
(
repos_path
)
do
next
Dir
.
glob
(
'**/*.git'
)
end
end
def
rm_project
$logger
.
info
"Removing project
#{
@project_name
}
from <
#{
full_path
}
>."
FileUtils
.
rm_rf
(
full_path
)
...
...
spec/gitlab_projects_spec.rb
View file @
8f9c11af
...
...
@@ -135,6 +135,22 @@ describe GitlabProjects do
end
end
describe
:list_projects
do
let
(
:gl_projects
)
do
build_gitlab_projects
(
'add-project'
,
"list_test/
#{
repo_name
}
"
)
end
before
do
FileUtils
.
mkdir_p
(
tmp_repos_path
)
end
it
'should create projects and list them'
do
GitlabProjects
.
stub
(
create_hooks:
true
)
gl_projects
.
exec
gl_projects
.
send
(
:list_projects
).
should
==
[
"list_test/
#{
repo_name
}
"
]
end
end
describe
:mv_project
do
let
(
:gl_projects
)
{
build_gitlab_projects
(
'mv-project'
,
repo_name
,
'repo.git'
)
}
let
(
:new_repo_path
)
{
File
.
join
(
tmp_repos_path
,
'repo.git'
)
}
...
...
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