Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
commit 9f79cebe7856716ca792008b25dd047636b38e43 2 parents b5d2cb6 + 14c8ba4
@sr sr authored
View
2  lib/janky/app.rb
@@ -58,7 +58,7 @@ def authorize_repo(repo)
mustache :index
end
- get "/:repo_name/:branch" do |repo_name, branch|
+ get %r{\/([-_\.0-9a-zA-Z]+)\/([-_\.a-zA-z0-9\/]+)} do |repo_name, branch|
repo = find_repo(repo_name)
authorize_repo(repo)
View
4 lib/janky/hubot.rb
@@ -31,7 +31,7 @@ class Hubot < Sinatra::Base
end
# Build a repository's branch.
- post "/:repo_name/:branch" do |repo_name, branch_name|
+ post %r{\/([-_\.0-9a-zA-Z]+)\/([-_\.a-zA-z0-9\/]+)} do |repo_name, branch_name|
repo = find_repo(repo_name)
branch = repo.branch_for(branch_name)
build = branch.current_build
@@ -81,7 +81,7 @@ class Hubot < Sinatra::Base
end
# Get the status of a repository's branch.
- get "/:repo_name/:branch_name" do |repo_name, branch_name|
+ get %r{\/([-_\.0-9a-zA-Z]+)\/([-_\.a-zA-z0-9\/]+)} do |repo_name, branch_name|
limit = params["limit"]
repo = find_repo(repo_name)
View
4 lib/janky/repository.rb
@@ -86,14 +86,14 @@ def builder
#
# Returns the user name as a String.
def github_owner
- uri[/github\.com[\/:](\w+)\//] && $1
+ uri[/github\.com[\/:]([a-zA-Z0-9\-_]+)\//] && $1
end
# Name of this repository on GitHub.
#
# Returns the name as a String.
def github_name
- uri[/github\.com[\/:](\w+)\/([a-zA-Z0-9\-_]+)/] && $2
+ uri[/github\.com[\/:]([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_]+)/] && $2
end
# Name of the Campfire room receiving build notifications.
View
13 test/janky_test.rb
@@ -268,4 +268,17 @@ def setup
assert hubot_build("janky", "master").not_found?
assert hubot_build("github", "master").not_found?
end
+
+ test "github owner is parsed correctly" do
+ repo = Janky::Repository.setup("github/janky")
+ assert_equal "github", repo.github_owner
+ assert_equal "janky", repo.github_name
+ end
+
+ test "owner with a dash is parsed correctly" do
+ repo = Janky::Repository.setup("digital-science/central-ftp-manage")
+ assert_equal "digital-science", repo.github_owner
+ assert_equal "central-ftp-manage", repo.github_name
+ end
+
end

0 comments on commit 9f79ceb

Please sign in to comment.
Something went wrong with that request. Please try again.