Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ensure that github owner names that include dashes are handled correctly #33

Merged
merged 1 commit into from

2 participants

@thommay

Hi,
our organisation name has a dash in it, which was causing 404s when we tried to create hooks in github.
This fixes that.
-Thom

@sr
sr commented

Nice, thanks!

@sr sr merged commit 14c8ba4 into github:master
@sr sr referenced this pull request from a commit
@sr sr fix whitespace errors introduced in #33 f7e7adf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 26, 2012
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 2 deletions.
  1. +2 −2 lib/janky/repository.rb
  2. +13 −0 test/janky_test.rb
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
Something went wrong with that request. Please try again.