diff --git a/Assetfile b/Assetfile index edb50985..c4c50a97 100644 --- a/Assetfile +++ b/Assetfile @@ -49,7 +49,9 @@ input assets.scripts do match %r(^(?!vendor|spec).*\.js$) do modules = proc { |input| input.path.gsub(%r((^app/|lib/|\.js$)), '') } - minispade(string: assets.development?, rewrite_requires: true, module_id_generator: modules) + # why did we use the string strategy for development? makes it impossible to set breakpoints + # minispade(string: assets.development?, rewrite_requires: true, module_id_generator: modules) + minispade(string: false, rewrite_requires: true, module_id_generator: modules) end match %r(^(?!spec).*\.js$) do diff --git a/Gemfile b/Gemfile index 2a324fc8..64632540 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'rack-ssl', '~> 1.3' gem 'rack-protection', '~> 1.3' gem 'rack-mobile-detect' gem 'sinatra' +gem 'hashr' gem 'rake-pipeline', github: 'livingsocial/rake-pipeline' gem 'rake-pipeline-web-filters', github: 'wycats/rake-pipeline-web-filters' diff --git a/Gemfile.lock b/Gemfile.lock index 762adf84..72b86129 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,15 @@ GIT remote: git://github.com/livingsocial/rake-pipeline.git - revision: 65b1e744defa208e313703d89f3453447cc103b2 + revision: a75d96fbadcc659a35a0ae59212e0bc60b58cc54 specs: rake-pipeline (0.8.0) json - rake (~> 10.0.0) + rake (~> 10.1.0) thor GIT remote: git://github.com/wycats/rake-pipeline-web-filters.git - revision: fd8d838491bd6b8de0bab72d90115b9a4f2da8a1 + revision: 7bd283aac83d7c46a8908f089033a6087d7cd68f specs: rake-pipeline-web-filters (0.6.0) rack @@ -18,98 +18,104 @@ GIT GEM remote: http://rubygems.org/ specs: - POpen4 (0.1.4) - Platform (>= 0.4.0) - open4 - Platform (0.4.0) - backports (3.0.3) - celluloid (0.15.2) - timers (~> 1.1.0) - chunky_png (1.2.7) - coderay (1.0.9) - coffee-script (2.2.0) + backports (3.6.3) + celluloid (0.16.0) + timers (~> 4.0.0) + chunky_png (1.3.1) + coderay (1.1.0) + coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.5.0) - compass (0.12.2) + coffee-script-source (1.8.0) + compass (1.0.1) chunky_png (~> 1.2) - fssm (>= 0.2.7) - sass (~> 3.1) - diff-lcs (1.2.1) - eventmachine (1.0.0) - execjs (1.4.0) + compass-core (~> 1.0.1) + compass-import-once (~> 1.0.5) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + sass (>= 3.3.13, < 3.5) + compass-core (1.0.1) multi_json (~> 1.0) - ffi (1.9.3) - foreman (0.61.0) - thor (>= 0.13.6) - fssm (0.2.10) - guard (1.6.2) - listen (>= 0.6.0) - lumberjack (>= 1.0.2) - pry (>= 0.9.10) - terminal-table (>= 1.4.3) - thor (>= 0.14.6) - json (1.7.7) - libv8 (3.16.14.3) - listen (2.7.9) + sass (>= 3.3.0, < 3.5) + compass-import-once (1.0.5) + sass (>= 3.2, < 3.5) + diff-lcs (1.2.5) + dotenv (0.11.1) + dotenv-deployment (~> 0.0.2) + dotenv-deployment (0.0.2) + execjs (2.2.1) + ffi (1.9.6) + foreman (0.75.0) + dotenv (~> 0.11.1) + thor (~> 0.19.1) + formatador (0.2.5) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + hashr (0.0.22) + hitimes (1.2.2) + json (1.8.1) + libv8 (3.16.14.7) + listen (2.7.11) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) - lumberjack (1.0.2) - method_source (0.8.1) - multi_json (1.6.1) - open4 (1.3.0) - pry (0.9.12) - coderay (~> 1.0.5) - method_source (~> 0.8) + lumberjack (1.0.9) + method_source (0.8.2) + multi_json (1.10.1) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) slop (~> 3.4) - puma (2.6.0) + puma (2.9.1) rack (>= 1.1, < 2.0) rack (1.5.2) rack-mobile-detect (0.4.0) rack - rack-protection (1.3.2) + rack-protection (1.5.3) rack - rack-ssl (1.3.3) + rack-ssl (1.4.1) rack rack-test (0.6.2) rack (>= 1.0) - rake (10.0.3) - rb-fsevent (0.9.3) + rake (10.1.1) + rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) rerun (0.10.0) listen (~> 2.7, >= 2.7.3) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.0) - rspec-expectations (2.13.0) + rspec (2.99.0) + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-core (2.99.2) + rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) - sass (3.2.6) - sinatra (1.3.5) + rspec-mocks (2.99.2) + sass (3.4.5) + sinatra (1.4.5) rack (~> 1.4) - rack-protection (~> 1.3) - tilt (~> 1.3, >= 1.3.3) - sinatra-contrib (1.3.2) + rack-protection (~> 1.4) + tilt (~> 1.3, >= 1.3.4) + sinatra-contrib (1.4.2) backports (>= 2.0) - eventmachine + multi_json rack-protection rack-test - sinatra (~> 1.3.0) + sinatra (~> 1.4.0) tilt (~> 1.3) - slop (3.4.3) - terminal-table (1.4.5) - thor (0.17.0) - tilt (1.3.3) - timers (1.1.0) - uglifier (1.3.0) + slop (3.6.0) + thor (0.19.1) + tilt (1.4.1) + timers (4.0.1) + hitimes + uglifier (2.5.3) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - yui-compressor (0.9.6) - POpen4 (>= 0.1.4) + json (>= 1.8.0) + yui-compressor (0.12.0) PLATFORMS ruby @@ -119,6 +125,7 @@ DEPENDENCIES compass foreman guard + hashr libv8 (~> 3.16.0) puma rack-mobile-detect diff --git a/assets/scripts/app/app.coffee b/assets/scripts/app/app.coffee index 6514083f..d79fbb61 100644 --- a/assets/scripts/app/app.coffee +++ b/assets/scripts/app/app.coffee @@ -43,7 +43,7 @@ unless window.TravisApplication Travis.SshKey.adapter = Travis.SshKeyAdapter.create() @slider = new Travis.Slider() - @pusher = new Travis.Pusher(Travis.config.pusher_key) if Travis.config.pusher_key + @pusher = new Travis.Pusher(key: Travis.config.pusher_key, host: Travis.config.pusher_host) if Travis.config.pusher_key @tailing = new Travis.Tailing($(window), '#tail', '#log') @toTop = new Travis.ToTop($(window), '.to-top', '#log-container') diff --git a/assets/scripts/app/auth.coffee b/assets/scripts/app/auth.coffee index 43b88517..613c44d7 100644 --- a/assets/scripts/app/auth.coffee +++ b/assets/scripts/app/auth.coffee @@ -109,7 +109,7 @@ window.Auth = Ember.Object.extend expectedOrigin: -> endpoint = @get('endpoint') - if endpoint[0] == '/' then @receivingEnd else endpoint + if endpoint[0] == '/' then @receivingEnd else endpoint.match(/^https?:\/\/[^\/]*/)[0] sendToApp: (name) -> # TODO: this is an ugly solution, we need to do one of 2 things: diff --git a/assets/scripts/app/helpers/helpers.coffee b/assets/scripts/app/helpers/helpers.coffee index 42aa27b7..8f24bbd1 100644 --- a/assets/scripts/app/helpers/helpers.coffee +++ b/assets/scripts/app/helpers/helpers.coffee @@ -86,12 +86,12 @@ 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') diff --git a/assets/scripts/app/helpers/urls.coffee b/assets/scripts/app/helpers/urls.coffee index ab6f606f..cda9bbc5 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) -> - "https://github.com/#{slug}/pull/#{pullRequestNumber}" + "#{Travis.config.source_endpoint}/#{slug}/pull/#{pullRequestNumber}" githubCommit: (slug, sha) -> - "https://github.com/#{slug}/commit/#{sha}" + "#{Travis.config.source_endpoint}/#{slug}/commit/#{sha}" githubRepo: (slug) -> - "https://github.com/#{slug}" + "#{Travis.config.source_endpoint}/#{slug}" githubWatchers: (slug) -> - "https://github.com/#{slug}/watchers" + "#{Travis.config.source_endpoint}/#{slug}/watchers" githubNetwork: (slug) -> - "https://github.com/#{slug}/network" + "#{Travis.config.source_endpoint}/#{slug}/network" githubAdmin: (slug) -> - "https://github.com/#{slug}/settings/hooks#travis_minibucket" + "#{Travis.config.source_endpoint}/#{slug}/settings/hooks#travis_minibucket" statusImage: (slug, branch) -> "#{location.protocol}//#{location.host}/#{slug}.svg" + if branch then "?branch=#{encodeURIComponent(branch)}" else '' diff --git a/assets/scripts/app/models/account.coffee b/assets/scripts/app/models/account.coffee index 03c29f79..513782db 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: (-> - "https://github.com/#{@get('login')}" + "#{Travis.config.source_endpoint}/#{@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 4126292b..350706aa 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: (-> - "https://github.com/#{@get('slug')}" + "#{Travis.config.source_endpoint}/#{@get('slug')}" ).property() urlGithubAdmin: (-> - "https://github.com/#{@get('slug')}/settings/hooks#travis_minibucket" + "#{Travis.config.source_endpoint}/#{@get('slug')}/settings/hooks#travis_minibucket" ).property() toggle: -> diff --git a/assets/scripts/app/models/job.coffee b/assets/scripts/app/models/job.coffee index 23649a37..58c5d271 100644 --- a/assets/scripts/app/models/job.coffee +++ b/assets/scripts/app/models/job.coffee @@ -102,8 +102,7 @@ require 'travis/model' Travis.pusher.unsubscribe "job-#{@get('id')}" onStateChange: (-> - if @get('state') == 'finished' && Travis.pusher - Travis.pusher.unsubscribe "job-#{@get('id')}" + @unsubscribe() if @get('state') == 'finished' && Travis.pusher ).observes('state') isPropertyLoaded: (key) -> diff --git a/assets/scripts/app/models/repo.coffee b/assets/scripts/app/models/repo.coffee index 91d12919..aa8c1e99 100644 --- a/assets/scripts/app/models/repo.coffee +++ b/assets/scripts/app/models/repo.coffee @@ -5,6 +5,7 @@ require 'travis/model' id: Ember.attr('string') slug: Ember.attr('string') description: Ember.attr('string') + private: Ember.attr('boolean') lastBuildId: Ember.attr('string') lastBuildNumber: Ember.attr(Number) lastBuildState: Ember.attr('string') diff --git a/assets/scripts/app/models/user.coffee b/assets/scripts/app/models/user.coffee index bd2468a3..d6467085 100644 --- a/assets/scripts/app/models/user.coffee +++ b/assets/scripts/app/models/user.coffee @@ -26,7 +26,7 @@ require 'travis/model' ).observes('isSyncing') urlGithub: (-> - "https://github.com/#{@get('login')}" + "#{Travis.config.source_endpoint}/#{@get('login')}" ).property() _rawPermissions: (-> diff --git a/assets/scripts/app/pusher.coffee b/assets/scripts/app/pusher.coffee index faf00514..5cc394b9 100644 --- a/assets/scripts/app/pusher.coffee +++ b/assets/scripts/app/pusher.coffee @@ -1,5 +1,5 @@ -Travis.Pusher = (key) -> - @init(key) # if key +Travis.Pusher = (config) -> + @init(config) this $.extend Travis.Pusher, @@ -10,37 +10,40 @@ $.extend Travis.Pusher, $.extend Travis.Pusher.prototype, active_channels: [] - init: (key) -> + init: (config) -> Pusher.warn = @warn.bind(this) - @pusher = new Pusher(key, encrypted: Travis.Pusher.ENCRYPTED) + Pusher.host = config.host if config.host + @pusher = new Pusher(config.key, encrypted: Travis.Pusher.ENCRYPTED, disableStats: true) @subscribeAll(Travis.Pusher.CHANNELS) if Travis.Pusher.CHANNELS @callbacksToProcess = [] Visibility.change (e, state) => - if state == 'visible' - @processSavedCallbacks() + @processSavedCallbacks() if state == 'visible' setInterval @processSavedCallbacks.bind(this), @processingIntervalWhenHidden subscribeAll: (channels) -> - for channel in channels - name = @prefix(channel) - channel = @pusher.subscribe(channel) - channel.bind_all((event, data) => @receive(event, data)) + @subscribe(channel) for channel in channels subscribe: (channel) -> - console.log("subscribing to #{channel}") + return unless channel channel = @prefix(channel) - @pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unless @pusher?.channel(channel) + console.log("subscribing to #{channel}") + unless @pusher?.channel(channel) + @pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unsubscribe: (channel) -> - console.log("unsubscribing from #{channel}") + return unless channel channel = @prefix(channel) + console.log("unsubscribing from #{channel}") @pusher.unsubscribe(channel) if @pusher?.channel(channel) prefix: (channel) -> - "#{Travis.Pusher.CHANNEL_PREFIX}#{channel}" + if channel.indexOf(Travis.Pusher.CHANNEL_PREFIX) != 0 + "#{Travis.Pusher.CHANNEL_PREFIX}#{channel}" + else + channel # process pusher messages in batches every 5 minutes when the page is hidden processingIntervalWhenHidden: 1000 * 60 * 5 @@ -84,5 +87,17 @@ $.extend Travis.Pusher.prototype, when 'annotation:created', 'annotation:updated' { annotation: data } - warn: (type, warning) -> - console.warn(warning) + warn: (type, object) -> + console.warn(type, object.error) unless @ignoreWarning(type, object.error) + + ignoreWarning: (type, error) -> + code = error?.data?.code || 0 + message = error?.data?.message || '' + @ignoreCode(code) || @ignoreMessage(message) + + ignoreCode: (code) -> + code == 1006 + + ignoreMessage: (message) -> + message.indexOf('Existing subscription') == 0 or message.indexOf('No current subscription') == 0 + diff --git a/assets/scripts/app/templates/repos/list.hbs b/assets/scripts/app/templates/repos/list.hbs index 41acd7be..17ea50f4 100644 --- a/assets/scripts/app/templates/repos/list.hbs +++ b/assets/scripts/app/templates/repos/list.hbs @@ -20,6 +20,7 @@ {{/if}} {{/with}} + {{#if lastBuildHash.number }}
Duration: {{formatDuration lastBuildDuration}} @@ -28,6 +29,7 @@ Finished: {{formatTime lastBuildFinishedAt}}
+ {{/if}}