Skip to content

Commit

Permalink
Don't fail Expm.Package.public_homepage if there is no homepage or re…
Browse files Browse the repository at this point in the history
…po URL
  • Loading branch information
yrashk committed Jun 14, 2013
1 parent f97cc34 commit 2c7c8ab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/package.ex
Expand Up @@ -143,15 +143,19 @@ defrecord Expm.Package,
github_repo = Enum.find(repositories(package), fn(r) ->
Regex.match?(%r(.*github.com/.+), r[:git])
end)
path = Regex.replace(%r{.*github.com/(.+)$},github_repo[:r],"\\1")
path = Regex.replace(%r{(.+)(\.git)$}, path, "\\1")
github_repo = Keyword.put github_repo, :github, path
unless nil?(github_repo) do
path = Regex.replace(%r{.*github.com/(.+)$},github_repo[:r],"\\1")
path = Regex.replace(%r{(.+)(\.git)$}, path, "\\1")
github_repo = Keyword.put github_repo, :github, path
end
end
cond do
not nil?(homepage(package)) ->
homepage(package)
not nil?(github_repo) ->
"https://github.com/#{github_repo[:github]}"
true ->
""
end
end

Expand Down

0 comments on commit 2c7c8ab

Please sign in to comment.