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
Kazuhiko Shiozaki
gitlab-shell
Commits
23c76715
Commit
23c76715
authored
Feb 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let test adding repo for real
parent
c902d83b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+4
-4
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+16
-1
No files found.
lib/gitlab_projects.rb
View file @
23c76715
...
...
@@ -3,7 +3,7 @@ require 'fileutils'
require_relative
'gitlab_config'
class
GitlabProjects
attr_
accessor
:project_name
attr_
reader
:project_name
,
:full_path
def
initialize
@command
=
ARGV
.
shift
...
...
@@ -25,12 +25,12 @@ class GitlabProjects
protected
def
add_project
FileUtils
.
mkdir_p
(
@
full_path
,
mode:
0770
)
cmd
=
"cd
#{
@full_path
}
&& git init --bare && ln -s
#{
@hook_path
}
#{
@
full_path
}
/hooks/post-receive"
FileUtils
.
mkdir_p
(
full_path
,
mode:
0770
)
cmd
=
"cd
#{
full_path
}
&& git init --bare && ln -s
#{
@hook_path
}
#{
full_path
}
/hooks/post-receive"
system
(
cmd
)
end
def
rm_project
FileUtils
.
rm_rf
(
@
full_path
)
FileUtils
.
rm_rf
(
full_path
)
end
end
spec/gitlab_projects_spec.rb
View file @
23c76715
...
...
@@ -17,10 +17,21 @@ describe GitlabProjects do
before
do
argv
(
'add-project'
,
'gitlab-ci.git'
)
@gl_projects
=
GitlabProjects
.
new
@gl_projects
.
stub
(
full_path:
tmp_repo_path
)
end
after
do
FileUtils
.
rm_rf
(
tmp_repo_path
)
end
it
"should create a directory"
do
@gl_projects
.
stub
(
system:
true
)
@gl_projects
.
send
:add_project
File
.
exists?
(
tmp_repo_path
).
should
be_true
end
it
"should receive valid cmd"
do
valid_cmd
=
"cd
/home/git/repositories/gitlab-ci.git && git init --bare && ln -s /home/git/gitlab-shell/hooks/post-receive /home/git/repositories/gitlab-ci.git
/hooks/post-receive"
valid_cmd
=
"cd
#{
tmp_repo_path
}
&& git init --bare && ln -s /home/git/gitlab-shell/hooks/post-receive
#{
tmp_repo_path
}
/hooks/post-receive"
@gl_projects
.
should_receive
(
:system
).
with
(
valid_cmd
)
@gl_projects
.
send
:add_project
end
...
...
@@ -31,4 +42,8 @@ describe GitlabProjects do
ARGV
[
i
]
=
arg
end
end
def
tmp_repo_path
File
.
join
(
ROOT_PATH
,
'tmp'
,
'gitlab-ci.git'
)
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