HTTPS everywhere for github.com

This commit is contained in:
Hiro Asari 2014-01-11 15:07:54 -05:00
parent 2b65686636
commit 4e24d9835a
8 changed files with 31 additions and 31 deletions

View File

@ -84,19 +84,19 @@ require 'config/emoij'
_githubReferenceLink: (reference, current, matched) -> _githubReferenceLink: (reference, current, matched) ->
owner = matched.owner || current.owner owner = matched.owner || current.owner
repo = matched.repo || current.repo repo = matched.repo || current.repo
"<a href=\"http://github.com/#{owner}/#{repo}/issues/#{matched.number}\">#{reference}</a>" "<a href=\"https://github.com/#{owner}/#{repo}/issues/#{matched.number}\">#{reference}</a>"
_githubUserRegexp: new RegExp("\\B@([\\w-]+)", 'g') _githubUserRegexp: new RegExp("\\B@([\\w-]+)", 'g')
_githubUserLink: (reference, username) -> _githubUserLink: (reference, username) ->
"<a href=\"http://github.com/#{username}\">#{reference}</a>" "<a href=\"https://github.com/#{username}\">#{reference}</a>"
_githubCommitReferenceRegexp: new RegExp("([\\w-]+)?\\/([\\w-]+)?@([0-9A-Fa-f]+)", 'g') _githubCommitReferenceRegexp: new RegExp("([\\w-]+)?\\/([\\w-]+)?@([0-9A-Fa-f]+)", 'g')
_githubCommitReferenceLink: (reference, current, matched) -> _githubCommitReferenceLink: (reference, current, matched) ->
owner = matched.owner || current.owner owner = matched.owner || current.owner
repo = matched.repo || current.repo repo = matched.repo || current.repo
"<a href=\"http://github.com/#{owner}/#{repo}/commit/#{matched.sha}\">#{reference}</a>" "<a href=\"https://github.com/#{owner}/#{repo}/commit/#{matched.sha}\">#{reference}</a>"
_normalizeDateString: (string) -> _normalizeDateString: (string) ->
if window.JHW if window.JHW

View File

@ -3,22 +3,22 @@
"#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true" "#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true"
githubPullRequest: (slug, pullRequestNumber) -> githubPullRequest: (slug, pullRequestNumber) ->
"http://github.com/#{slug}/pull/#{pullRequestNumber}" "https://github.com/#{slug}/pull/#{pullRequestNumber}"
githubCommit: (slug, sha) -> githubCommit: (slug, sha) ->
"http://github.com/#{slug}/commit/#{sha}" "https://github.com/#{slug}/commit/#{sha}"
githubRepo: (slug) -> githubRepo: (slug) ->
"http://github.com/#{slug}" "https://github.com/#{slug}"
githubWatchers: (slug) -> githubWatchers: (slug) ->
"http://github.com/#{slug}/watchers" "https://github.com/#{slug}/watchers"
githubNetwork: (slug) -> githubNetwork: (slug) ->
"http://github.com/#{slug}/network" "https://github.com/#{slug}/network"
githubAdmin: (slug) -> githubAdmin: (slug) ->
"http://github.com/#{slug}/settings/hooks#travis_minibucket" "https://github.com/#{slug}/settings/hooks#travis_minibucket"
statusImage: (slug, branch) -> statusImage: (slug, branch) ->
"#{location.protocol}//#{location.host}/#{slug}.png" + if branch then "?branch=#{branch}" else '' "#{location.protocol}//#{location.host}/#{slug}.png" + if branch then "?branch=#{branch}" else ''

View File

@ -7,7 +7,7 @@ require 'travis/model'
_reposCount: Ember.attr(Number, key: 'repos_count') _reposCount: Ember.attr(Number, key: 'repos_count')
urlGithub: (-> urlGithub: (->
"http://github.com/#{@get('login')}" "https://github.com/#{@get('login')}"
).property() ).property()
# TODO: maybe it would be good to add a "default" value for Ember.attr # TODO: maybe it would be good to add a "default" value for Ember.attr

View File

@ -16,11 +16,11 @@ require 'travis/model'
).property('ownerName', 'name') ).property('ownerName', 'name')
urlGithub: (-> urlGithub: (->
"http://github.com/#{@get('slug')}" "https://github.com/#{@get('slug')}"
).property() ).property()
urlGithubAdmin: (-> urlGithubAdmin: (->
"http://github.com/#{@get('slug')}/settings/hooks#travis_minibucket" "https://github.com/#{@get('slug')}/settings/hooks#travis_minibucket"
).property() ).property()
toggle: -> toggle: ->

View File

@ -66,7 +66,7 @@ test "updating current build", ->
state: 'started' state: 'started'
config: {} config: {}
pull_request: false pull_request: false
compare_url: 'http://github.com/compare/0123456..1234567' compare_url: 'https://github.com/compare/0123456..1234567'
repository: repository:
id: 1 id: 1
last_build_number: '3' last_build_number: '3'

View File

@ -1,6 +1,6 @@
@displaysRepository = (repo) -> @displaysRepository = (repo) ->
equal($('#repo h3 a').attr('href'), repo.href, 'repository title should link to repo page') equal($('#repo h3 a').attr('href'), repo.href, 'repository title should link to repo page')
equal($('#repo .github-icon a').attr('href'), "http://github.com#{repo.href}", 'github icon should link to repo on github') equal($('#repo .github-icon a').attr('href'), "https://github.com#{repo.href}", 'github icon should link to repo on github')
@displaysTabs = (tabs) -> @displaysTabs = (tabs) ->
for name, tab of tabs for name, tab of tabs
@ -27,13 +27,13 @@
equal(element.text(), data.duration) equal(element.text(), data.duration)
element = $('#summary .commit a') element = $('#summary .commit a')
equal(element.attr('href'), "http://github.com/#{data.repo}/commit/#{data.commit}") equal(element.attr('href'), "https://github.com/#{data.repo}/commit/#{data.commit}")
element = $('#summary .commit a') element = $('#summary .commit a')
equal(element.text(), "#{data.commit} (#{data.branch})") equal(element.text(), "#{data.commit} (#{data.branch})")
element = $('#summary .compare a') element = $('#summary .compare a')
equal(element.attr('href'), "http://github.com/compare/#{data.compare}") equal(element.attr('href'), "https://github.com/compare/#{data.compare}")
element = $('#summary .compare a') element = $('#summary .compare a')
equal(element.text(), data.compare) equal(element.text(), data.compare)

View File

@ -24,10 +24,10 @@ builds = [
] ]
commits = [ commits = [
{ id: '1', sha: '1234567', branch: 'master', message: 'commit message 1', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'http://github.com/compare/0123456..1234567' }, { id: '1', sha: '1234567', branch: 'master', message: 'commit message 1', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'https://github.com/compare/0123456..1234567' },
{ id: '2', sha: '2345678', branch: 'feature', message: 'commit message 2', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'http://github.com/compare/0123456..2345678' }, { id: '2', sha: '2345678', branch: 'feature', message: 'commit message 2', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'https://github.com/compare/0123456..2345678' },
{ id: '3', sha: '3456789', branch: 'master', message: 'commit message 3', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'http://github.com/compare/0123456..3456789' }, { id: '3', sha: '3456789', branch: 'master', message: 'commit message 3', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'https://github.com/compare/0123456..3456789' },
{ id: '4', sha: '4567890', branch: 'master', message: 'commit message 4', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'http://github.com/compare/0123456..4567890' }, { id: '4', sha: '4567890', branch: 'master', message: 'commit message 4', author_name: 'author name', author_email: 'author@email.com', committer_name: 'committer name', committer_email: 'committer@email.com', compare_url: 'https://github.com/compare/0123456..4567890' },
] ]
jobs = [ jobs = [

View File

@ -3,53 +3,53 @@ module "Travis.Helpers.githubify"
test 'replaces #Num with github issues link', -> test 'replaces #Num with github issues link', ->
message = 'Solved #11hey' message = 'Solved #11hey'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Solved <a href="http://github.com/travis-ci/travis-web/issues/11">#11</a>hey' expected = 'Solved <a href="https://github.com/travis-ci/travis-web/issues/11">#11</a>hey'
equal(result, expected, "#num should be converted to a link") equal(result, expected, "#num should be converted to a link")
test 'replaces User#Num with github issues link to forked repo', -> test 'replaces User#Num with github issues link to forked repo', ->
message = 'Solved test#11hey' message = 'Solved test#11hey'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Solved <a href="http://github.com/test/travis-web/issues/11">test#11</a>hey' expected = 'Solved <a href="https://github.com/test/travis-web/issues/11">test#11</a>hey'
equal(result, expected, "user#num should be converted to a link") equal(result, expected, "user#num should be converted to a link")
test 'replaces User/Project#Num with github issues link to another repo', -> test 'replaces User/Project#Num with github issues link to another repo', ->
message = 'Solved test_1-a2/test-a_11#11hey' message = 'Solved test_1-a2/test-a_11#11hey'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Solved <a href="http://github.com/test_1-a2/test-a_11/issues/11">test_1-a2/test-a_11#11</a>hey' expected = 'Solved <a href="https://github.com/test_1-a2/test-a_11/issues/11">test_1-a2/test-a_11#11</a>hey'
equal(result, expected, "owner/repo#num should be converted to a link") equal(result, expected, "owner/repo#num should be converted to a link")
test 'replaces gh-Num with github issues link', -> test 'replaces gh-Num with github issues link', ->
message = 'Solved gh-22hey' message = 'Solved gh-22hey'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Solved <a href="http://github.com/travis-ci/travis-web/issues/22">gh-22</a>hey' expected = 'Solved <a href="https://github.com/travis-ci/travis-web/issues/22">gh-22</a>hey'
equal(result, expected, "gh-Num should be converted to a link") equal(result, expected, "gh-Num should be converted to a link")
test 'replaces multiple references with github issues links', -> test 'replaces multiple references with github issues links', ->
message = 'Try #1 and test#2 and test/testing#3' message = 'Try #1 and test#2 and test/testing#3'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Try <a href="http://github.com/travis-ci/travis-web/issues/1">#1</a> and ' expected = 'Try <a href="https://github.com/travis-ci/travis-web/issues/1">#1</a> and '
expected += '<a href="http://github.com/test/travis-web/issues/2">test#2</a> and ' expected += '<a href="https://github.com/test/travis-web/issues/2">test#2</a> and '
expected += '<a href="http://github.com/test/testing/issues/3">test/testing#3</a>' expected += '<a href="https://github.com/test/testing/issues/3">test/testing#3</a>'
equal(result, expected, "references should be converted to links") equal(result, expected, "references should be converted to links")
test 'replaces multiple references with github issues links', -> test 'replaces multiple references with github issues links', ->
message = 'Try #1 and test#2 and test/testing#3' message = 'Try #1 and test#2 and test/testing#3'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'Try <a href="http://github.com/travis-ci/travis-web/issues/1">#1</a> and ' expected = 'Try <a href="https://github.com/travis-ci/travis-web/issues/1">#1</a> and '
expected += '<a href="http://github.com/test/travis-web/issues/2">test#2</a> and ' expected += '<a href="https://github.com/test/travis-web/issues/2">test#2</a> and '
expected += '<a href="http://github.com/test/testing/issues/3">test/testing#3</a>' expected += '<a href="https://github.com/test/testing/issues/3">test/testing#3</a>'
equal(result, expected, "references should be converted to links") equal(result, expected, "references should be converted to links")
test 'replaces @user with github user link', -> test 'replaces @user with github user link', ->
message = 'It is for you @tender_love1' message = 'It is for you @tender_love1'
result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web')
expected = 'It is for you <a href="http://github.com/tender_love1">@tender_love1</a>' expected = 'It is for you <a href="https://github.com/tender_love1">@tender_love1</a>'
equal(result, expected, "@user should be converted to a link") equal(result, expected, "@user should be converted to a link")