From 4e24d9835a58a9d152237b4d15d56bf591f1b0bc Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Sat, 11 Jan 2014 15:07:54 -0500 Subject: [PATCH] HTTPS everywhere for github.com --- assets/scripts/app/helpers/helpers.coffee | 6 ++--- assets/scripts/app/helpers/urls.coffee | 12 +++++----- assets/scripts/app/models/account.coffee | 2 +- assets/scripts/app/models/hook.coffee | 4 ++-- .../spec/integration/build_spec.coffee | 2 +- .../scripts/spec/support/expectations.coffee | 6 ++--- assets/scripts/spec/support/mocks.coffee | 8 +++---- assets/scripts/spec/unit/helpers_spec.coffee | 22 +++++++++---------- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/assets/scripts/app/helpers/helpers.coffee b/assets/scripts/app/helpers/helpers.coffee index cd6f49a7..209f333f 100644 --- a/assets/scripts/app/helpers/helpers.coffee +++ b/assets/scripts/app/helpers/helpers.coffee @@ -84,19 +84,19 @@ require 'config/emoij' _githubReferenceLink: (reference, current, matched) -> owner = matched.owner || current.owner repo = matched.repo || current.repo - "#{reference}" + "#{reference}" _githubUserRegexp: new RegExp("\\B@([\\w-]+)", 'g') _githubUserLink: (reference, username) -> - "#{reference}" + "#{reference}" _githubCommitReferenceRegexp: new RegExp("([\\w-]+)?\\/([\\w-]+)?@([0-9A-Fa-f]+)", 'g') _githubCommitReferenceLink: (reference, current, matched) -> owner = matched.owner || current.owner repo = matched.repo || current.repo - "#{reference}" + "#{reference}" _normalizeDateString: (string) -> if window.JHW diff --git a/assets/scripts/app/helpers/urls.coffee b/assets/scripts/app/helpers/urls.coffee index 8af4d14e..17b75597 100644 --- a/assets/scripts/app/helpers/urls.coffee +++ b/assets/scripts/app/helpers/urls.coffee @@ -3,22 +3,22 @@ "#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true" githubPullRequest: (slug, pullRequestNumber) -> - "http://github.com/#{slug}/pull/#{pullRequestNumber}" + "https://github.com/#{slug}/pull/#{pullRequestNumber}" githubCommit: (slug, sha) -> - "http://github.com/#{slug}/commit/#{sha}" + "https://github.com/#{slug}/commit/#{sha}" githubRepo: (slug) -> - "http://github.com/#{slug}" + "https://github.com/#{slug}" githubWatchers: (slug) -> - "http://github.com/#{slug}/watchers" + "https://github.com/#{slug}/watchers" githubNetwork: (slug) -> - "http://github.com/#{slug}/network" + "https://github.com/#{slug}/network" githubAdmin: (slug) -> - "http://github.com/#{slug}/settings/hooks#travis_minibucket" + "https://github.com/#{slug}/settings/hooks#travis_minibucket" statusImage: (slug, branch) -> "#{location.protocol}//#{location.host}/#{slug}.png" + if branch then "?branch=#{branch}" else '' diff --git a/assets/scripts/app/models/account.coffee b/assets/scripts/app/models/account.coffee index 8fe049b6..03c29f79 100644 --- a/assets/scripts/app/models/account.coffee +++ b/assets/scripts/app/models/account.coffee @@ -7,7 +7,7 @@ require 'travis/model' _reposCount: Ember.attr(Number, key: 'repos_count') urlGithub: (-> - "http://github.com/#{@get('login')}" + "https://github.com/#{@get('login')}" ).property() # TODO: maybe it would be good to add a "default" value for Ember.attr diff --git a/assets/scripts/app/models/hook.coffee b/assets/scripts/app/models/hook.coffee index f35166ac..677708d1 100644 --- a/assets/scripts/app/models/hook.coffee +++ b/assets/scripts/app/models/hook.coffee @@ -16,11 +16,11 @@ require 'travis/model' ).property('ownerName', 'name') urlGithub: (-> - "http://github.com/#{@get('slug')}" + "https://github.com/#{@get('slug')}" ).property() urlGithubAdmin: (-> - "http://github.com/#{@get('slug')}/settings/hooks#travis_minibucket" + "https://github.com/#{@get('slug')}/settings/hooks#travis_minibucket" ).property() toggle: -> diff --git a/assets/scripts/spec/integration/build_spec.coffee b/assets/scripts/spec/integration/build_spec.coffee index a8fd4d11..69f5ce14 100644 --- a/assets/scripts/spec/integration/build_spec.coffee +++ b/assets/scripts/spec/integration/build_spec.coffee @@ -66,7 +66,7 @@ test "updating current build", -> state: 'started' config: {} pull_request: false - compare_url: 'http://github.com/compare/0123456..1234567' + compare_url: 'https://github.com/compare/0123456..1234567' repository: id: 1 last_build_number: '3' diff --git a/assets/scripts/spec/support/expectations.coffee b/assets/scripts/spec/support/expectations.coffee index f16de344..0e3aa4f1 100644 --- a/assets/scripts/spec/support/expectations.coffee +++ b/assets/scripts/spec/support/expectations.coffee @@ -1,6 +1,6 @@ @displaysRepository = (repo) -> 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) -> for name, tab of tabs @@ -27,13 +27,13 @@ equal(element.text(), data.duration) 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') equal(element.text(), "#{data.commit} (#{data.branch})") 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') equal(element.text(), data.compare) diff --git a/assets/scripts/spec/support/mocks.coffee b/assets/scripts/spec/support/mocks.coffee index 76f3b655..e4786764 100644 --- a/assets/scripts/spec/support/mocks.coffee +++ b/assets/scripts/spec/support/mocks.coffee @@ -24,10 +24,10 @@ builds = [ ] 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: '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: '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: '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: '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: '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: '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: 'https://github.com/compare/0123456..4567890' }, ] jobs = [ diff --git a/assets/scripts/spec/unit/helpers_spec.coffee b/assets/scripts/spec/unit/helpers_spec.coffee index fe049984..eeba0540 100644 --- a/assets/scripts/spec/unit/helpers_spec.coffee +++ b/assets/scripts/spec/unit/helpers_spec.coffee @@ -3,53 +3,53 @@ module "Travis.Helpers.githubify" test 'replaces #Num with github issues link', -> message = 'Solved #11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Solved #11hey' + expected = 'Solved #11hey' equal(result, expected, "#num should be converted to a link") test 'replaces User#Num with github issues link to forked repo', -> message = 'Solved test#11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Solved test#11hey' + expected = 'Solved test#11hey' equal(result, expected, "user#num should be converted to a link") test 'replaces User/Project#Num with github issues link to another repo', -> message = 'Solved test_1-a2/test-a_11#11hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Solved test_1-a2/test-a_11#11hey' + expected = 'Solved test_1-a2/test-a_11#11hey' equal(result, expected, "owner/repo#num should be converted to a link") test 'replaces gh-Num with github issues link', -> message = 'Solved gh-22hey' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Solved gh-22hey' + expected = 'Solved gh-22hey' equal(result, expected, "gh-Num should be converted to a link") test 'replaces multiple references with github issues links', -> message = 'Try #1 and test#2 and test/testing#3' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Try #1 and ' - expected += 'test#2 and ' - expected += 'test/testing#3' + expected = 'Try #1 and ' + expected += 'test#2 and ' + expected += 'test/testing#3' equal(result, expected, "references should be converted to links") test 'replaces multiple references with github issues links', -> message = 'Try #1 and test#2 and test/testing#3' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'Try #1 and ' - expected += 'test#2 and ' - expected += 'test/testing#3' + expected = 'Try #1 and ' + expected += 'test#2 and ' + expected += 'test/testing#3' equal(result, expected, "references should be converted to links") test 'replaces @user with github user link', -> message = 'It is for you @tender_love1' result = Travis.Helpers.githubify(message, 'travis-ci', 'travis-web') - expected = 'It is for you @tender_love1' + expected = 'It is for you @tender_love1' equal(result, expected, "@user should be converted to a link")