diff --git a/Assetfile b/Assetfile index 4eccd2fc..8c867331 100644 --- a/Assetfile +++ b/Assetfile @@ -31,6 +31,11 @@ input assets.scripts do end match 'vendor/**/*.js' do + if assets.production? + reject 'ember.js' + else + reject 'ember.prod.js' + end safe_concat assets.vendor_order, 'vendor.js' end diff --git a/Gemfile b/Gemfile index 2aa50f3a..a7922e0b 100644 --- a/Gemfile +++ b/Gemfile @@ -40,61 +40,3 @@ group :test do gem 'sinatra-contrib' end -require 'bundler/installer' - -module ::Bundler - class Installer < Environment - MAX_RETRIES = 3 - - def install_gem_from_spec(spec, standalone = false) - retries = 1 - # Download the gem to get the spec, because some specs that are returned - # by rubygems.org are broken and wrong. - Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems) - - # Fetch the build settings, if there are any - settings = Bundler.settings["build.#{spec.name}"] - Bundler.rubygems.with_build_args [settings] do - spec.source.install(spec) - Bundler.ui.debug "from #{spec.loaded_from} " - end - - # newline comes after installing, some gems say "with native extensions" - Bundler.ui.info "" - if Bundler.settings[:bin] && standalone - generate_standalone_bundler_executable_stubs(spec) - elsif Bundler.settings[:bin] - generate_bundler_executable_stubs(spec, :force => true) - end - - FileUtils.rm_rf(Bundler.tmp) - rescue Gem::RemoteFetcher::FetchError => e - if retries <= MAX_RETRIES - Bundler.ui.warn "#{e.class}: #{e.message}" - Bundler.ui.warn "Installing #{spec.name} (#{spec.version}) failed." - Bundler.ui.warn "Retrying (#{retries}/#{MAX_RETRIES})" - retries += 1 - sleep retries - retry - else - Bundler.ui.warn "Installing #{spec.name} (#{spec.version}) failed after #{retries} retries: #{e.message}." - Bundler.ui.warn "Giving up" - msg = "An error, most likely because of network issues, has occurred trying to install #{spec.name} (#{spec.version}), " - msg << "and Bundler cannot continue." - raise Bundler::InstallError, msg - end - rescue Exception => e - # install hook failed - raise e if e.is_a?(Bundler::InstallHookError) || e.is_a?(Bundler::SecurityError) - - # other failure, likely a native extension build failure - Bundler.ui.info "" - Bundler.ui.warn "#{e.class}: #{e.message}" - msg = "An error occurred while installing #{spec.name} (#{spec.version})," - msg << " and Bundler cannot continue.\nMake sure that `gem install" - msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling." - Bundler.ui.debug e.backtrace.join("\n") - raise Bundler::InstallError, msg - end - end -end diff --git a/NOTES.txt b/NOTES.txt index 577dc5a8..1b2fc3b7 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -10,7 +10,7 @@ # Handlebars -* Can't {{bindAttr}} be just {{attr}}? Who cares it's "bound" in that context? +* Can't {{bind-attr}} be just {{attr}}? Who cares it's "bound" in that context? {{#each}} isn't {{#bindEach}} either. * Why is {{#collection contentBinding="foo"}} not just {{#collection foo}}? diff --git a/assets/scripts/app/app.coffee b/assets/scripts/app/app.coffee index 4e16be6f..3f5adc8e 100644 --- a/assets/scripts/app/app.coffee +++ b/assets/scripts/app/app.coffee @@ -33,7 +33,7 @@ unless window.TravisApplication @slider = new Travis.Slider() @pusher = new Travis.Pusher(Travis.config.pusher_key) if Travis.config.pusher_key - @tailing = new Travis.Tailing() + @tailing = new Travis.Tailing($(window), '#tail', '#log') @set('auth', Travis.Auth.create(app: this, endpoint: Travis.config.api_endpoint)) diff --git a/assets/scripts/app/controllers/build.coffee b/assets/scripts/app/controllers/build.coffee index 2446117b..6e61ab6f 100644 --- a/assets/scripts/app/controllers/build.coffee +++ b/assets/scripts/app/controllers/build.coffee @@ -2,7 +2,6 @@ Travis.BuildController = Ember.Controller.extend needs: ['repo'] repoBinding: 'controllers.repo.repo' commitBinding: 'build.commit' - lineNumberBinding: 'controllers.repo.lineNumber' currentUserBinding: 'controllers.repo.currentUser' tabBinding: 'controllers.repo.tab' @@ -15,11 +14,3 @@ Travis.BuildController = Ember.Controller.extend urlGithubCommit: (-> Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha')) ).property('repo.slug', 'commit.sha') - - urlAuthor: (-> - Travis.Urls.email(@get('commit.authorEmail')) - ).property('commit.authorEmail') - - urlCommitter: (-> - Travis.Urls.email(@get('commit.committerEmail')) - ).property('commit.committerEmail') diff --git a/assets/scripts/app/controllers/job.coffee b/assets/scripts/app/controllers/job.coffee index 417e3eb3..7365d06d 100644 --- a/assets/scripts/app/controllers/job.coffee +++ b/assets/scripts/app/controllers/job.coffee @@ -4,7 +4,6 @@ Travis.JobController = Em.Controller.extend jobBinding: 'controllers.repo.job' repoBinding: 'controllers.repo.repo' commitBinding: 'job.commit' - lineNumberBinding: 'controllers.repo.lineNumber' currentUserBinding: 'controllers.repo.currentUser' tabBinding: 'controllers.repo.tab' @@ -13,11 +12,3 @@ Travis.JobController = Em.Controller.extend urlGithubCommit: (-> Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha')) ).property('repo.slug', 'commit.sha') - - urlAuthor: (-> - Travis.Urls.email(@get('commit.authorEmail')) - ).property('commit.authorEmail') - - urlCommitter: (-> - Travis.Urls.email(@get('commit.committerEmail')) - ).property('commit.committerEmail') diff --git a/assets/scripts/app/helpers/helpers.coffee b/assets/scripts/app/helpers/helpers.coffee index 37791f1a..209f333f 100644 --- a/assets/scripts/app/helpers/helpers.coffee +++ b/assets/scripts/app/helpers/helpers.coffee @@ -75,19 +75,28 @@ require 'config/emoij' self._githubReferenceLink(reference, { owner: owner, repo: repo }, { owner: matchedOwner, repo: matchedRepo, number: matchedNumber } ) text = text.replace @_githubUserRegexp, (reference, username) -> self._githubUserLink(reference, username) + text = text.replace @_githubCommitReferenceRegexp, (reference, matchedOwner, matchedRepo, matchedSHA) -> + self._githubCommitReferenceLink(reference, { owner: owner, repo: repo }, { owner: matchedOwner, repo: matchedRepo, sha: matchedSHA }) text + _githubReferenceRegexp: new RegExp("([\\w-]+)?\\/?([\\w-]+)?(?:#|gh-)(\\d+)", 'g') + _githubReferenceLink: (reference, current, matched) -> owner = matched.owner || current.owner repo = matched.repo || current.repo - "#{reference}" - - _githubReferenceRegexp: new RegExp("([\\w-]+)?\\/?([\\w-]+)?(?:#|gh-)(\\d+)", 'g') + "#{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}" _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/build.coffee b/assets/scripts/app/models/build.coffee index 779f7ad1..667daee9 100644 --- a/assets/scripts/app/models/build.coffee +++ b/assets/scripts/app/models/build.coffee @@ -45,7 +45,7 @@ require 'travis/model' ).property('jobs.@each.allowFailure') rawConfigKeys: (-> - keys = Travis.Helpers.configKeys(@get('config')) + keys = [] @get('jobs').forEach (job) -> Travis.Helpers.configKeys(job.get('config')).forEach (key) -> diff --git a/assets/scripts/app/models/hook.coffee b/assets/scripts/app/models/hook.coffee index 58fff636..4126292b 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/app/routes.coffee b/assets/scripts/app/routes.coffee index 06a20676..97f175a1 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -1,5 +1,4 @@ require 'travis/location' -require 'travis/line_number_parser' Ember.Router.reopen location: (if testMode? then Ember.NoneLocation.create() else Travis.Location.create()) @@ -60,7 +59,6 @@ Ember.Route.reopen if !@signedIn() && @get('needsAuth') Travis.auth.set('afterSignInTransition', transition) - transition.abort() Ember.RSVP.reject("needs-auth") else @_super.apply(this, arguments) @@ -116,12 +114,6 @@ Travis.Router.map -> @route 'index', path: '/' @route 'profile', path: '/profile' -Travis.ApplicationRoute = Ember.Route.extend Travis.LineNumberParser, - setupController: -> - @_super.apply this, arguments - - this.controllerFor('repo').set('lineNumber', @fetchLineNumber()) - Travis.SetupLastBuild = Ember.Mixin.create setupController: -> @repoDidLoad() diff --git a/assets/scripts/app/tailing.coffee b/assets/scripts/app/tailing.coffee index 276b18c7..3df8c872 100644 --- a/assets/scripts/app/tailing.coffee +++ b/assets/scripts/app/tailing.coffee @@ -1,12 +1,17 @@ -@Travis.Tailing = -> - @position = $(window).scrollTop() - $(window).scroll( $.throttle( 200, @onScroll.bind(this) ) ) - this - -$.extend Travis.Tailing.prototype, +class @Travis.Tailing options: timeout: 200 + tail: -> + $(@tail_selector) + log: -> + $(@log_selector) + + constructor: (@window, @tail_selector, @log_selector) -> + @position = @window.scrollTop() + @window.scroll( $.throttle( 200, @onScroll.bind(this) ) ) + this + run: -> @autoScroll() @positionButton() @@ -16,38 +21,43 @@ $.extend Travis.Tailing.prototype, if @active() then @stop() else @start() active: -> - $('#tail').hasClass('active') + @tail().hasClass('active') start: -> - $('#tail').addClass('active') + @tail().addClass('active') @run() stop: -> - $('#tail').removeClass('active') + @tail().removeClass('active') autoScroll: -> - return unless @active() - win = $(window) - log = $('#log') - logBottom = log.offset().top + log.outerHeight() + 40 - winBottom = win.scrollTop() + win.height() - win.scrollTop(logBottom - win.height()) if logBottom - winBottom > 0 + return false unless @active() + logBottom = @log().offset().top + @log().outerHeight() + 40 + winBottom = @window.scrollTop() + @window.height() + + if logBottom - winBottom > 0 + @window.scrollTop(logBottom - @window.height()) + true + else + false onScroll: -> @positionButton() - position = $(window).scrollTop() + position = @window.scrollTop() @stop() if position < @position @position = position positionButton: -> - tail = $('#tail') - return if tail.length is 0 - offset = $(window).scrollTop() - $('#log').offset().top - max = $('#log').height() - $('#tail').height() + 5 - offset = max if offset > max + return if @tail().length is 0 + offset = @window.scrollTop() - @log().offset().top + max = @log().height() - @tail().height() + 5 - if offset > 0 - tail.css(position: 'fixed', right: 32) + if offset > 0 && offset <= max + @tail().removeClass('bottom') + @tail().addClass('scrolling') else - tail.css(position: 'absolute', right: 2) - + if offset > max + @tail().addClass('bottom') + else + @tail().removeClass('bottom') + @tail().removeClass('scrolling') diff --git a/assets/scripts/app/templates/builds/list.hbs b/assets/scripts/app/templates/builds/list.hbs index 9e1baff4..5d73ca69 100644 --- a/assets/scripts/app/templates/builds/list.hbs +++ b/assets/scripts/app/templates/builds/list.hbs @@ -26,16 +26,16 @@ {{#if id}} - {{#linkTo "build" repo this}} + {{#link-to "build" repo this}} {{number}} - {{/linkTo}} + {{/link-to}} {{/if}} {{{formatMessage commit.message short="true" repoBinding=build.repo}}} - + {{formatCommit commit}} @@ -44,15 +44,15 @@ {{#if view.isPullRequestsList}} - + #{{pullRequestNumber}} {{/if}} - + {{formatDuration duration}} - + {{formatTime finishedAt}} {{/view}} diff --git a/assets/scripts/app/templates/builds/show.hbs b/assets/scripts/app/templates/builds/show.hbs index bf8e5354..7c3d8f81 100644 --- a/assets/scripts/app/templates/builds/show.hbs +++ b/assets/scripts/app/templates/builds/show.hbs @@ -8,38 +8,38 @@ {{#if build.id}} {{#if build.repo.slug}} - {{#linkTo "build" repo build}}{{build.number}}{{/linkTo}} + {{#link-to "build" repo build}}{{build.number}}{{/link-to}} {{/if}} {{/if}}
{{t builds.state}}
{{capitalize build.state}}
{{t builds.finished_at}}
-
{{formatTime build.finishedAt}}
+
{{formatTime build.finishedAt}}
{{t builds.duration}}
-
{{formatDuration build.duration}}
+
{{formatDuration build.duration}}
{{#with build}}
{{t builds.commit}}
-
{{formatCommit commit}}
+
{{formatCommit commit}}
{{#if pullRequest}}
{{t builds.pull_request}}
-
#{{pullRequestNumber}} {{pullRequestTitle}}
+
#{{pullRequestNumber}} {{pullRequestTitle}}
{{else}} {{#if commit.compareUrl}}
{{t builds.compare}}
-
{{pathFrom commit.compareUrl}}
+
{{pathFrom commit.compareUrl}}
{{/if}} {{/if}} {{#if commit.authorName}}
{{t builds.author}}
-
{{commit.authorName}}
+
{{commit.authorName}}
{{/if}} {{#if commit.committerName}}
{{t builds.committer}}
-
{{commit.committerName}}
+
{{commit.committerName}}
{{/if}}
{{/with}} diff --git a/assets/scripts/app/templates/jobs/list.hbs b/assets/scripts/app/templates/jobs/list.hbs index 4429a4d9..22314a35 100644 --- a/assets/scripts/app/templates/jobs/list.hbs +++ b/assets/scripts/app/templates/jobs/list.hbs @@ -25,14 +25,14 @@ {{#if job.id}} {{#if job.repo.slug}} - {{#linkTo "job" repo job}}{{number}}{{/linkTo}} + {{#link-to "job" repo job}}{{number}}{{/link-to}} {{/if}} {{/if}} - + {{formatDuration duration}} - + {{formatTime finishedAt}} {{#each value in configValues}} diff --git a/assets/scripts/app/templates/jobs/pre.hbs b/assets/scripts/app/templates/jobs/pre.hbs index 457d9699..c3aee48e 100644 --- a/assets/scripts/app/templates/jobs/pre.hbs +++ b/assets/scripts/app/templates/jobs/pre.hbs @@ -17,14 +17,14 @@ {{#if view.job.sponsor.name}} {{/if}} {{#if view.limited}}

This log is too long to be displayed. Please reduce the verbosity of your - build or download the the raw log. + build or download the the raw log.

{{/if}} diff --git a/assets/scripts/app/templates/jobs/show.hbs b/assets/scripts/app/templates/jobs/show.hbs index ebee6825..0d3bd35e 100644 --- a/assets/scripts/app/templates/jobs/show.hbs +++ b/assets/scripts/app/templates/jobs/show.hbs @@ -1,5 +1,5 @@ {{#if job.isLoaded}} -
+
Job
@@ -7,38 +7,38 @@ {{#if job.id}} {{#if job.repo.slug}} - {{#linkTo "job" repo job}}{{job.number}}{{/linkTo}} + {{#link-to "job" repo job}}{{job.number}}{{/link-to}} {{/if}} {{/if}}
{{t jobs.state}}
{{capitalize job.state}}
{{t jobs.finished_at}}
-
{{formatTime job.finishedAt}}
+
{{formatTime job.finishedAt}}
{{t jobs.duration}}
-
{{formatDuration job.duration}}
+
{{formatDuration job.duration}}
{{#with job}}
{{t jobs.commit}}
-
{{formatCommit commit}}
+
{{formatCommit commit}}
{{#if build.pullRequest}}
{{t builds.pull_request}}
-
#{{build.pullRequestNumber}} {{build.pullRequestTitle}}
+
#{{build.pullRequestNumber}} {{build.pullRequestTitle}}
{{else}} {{#if commit.compareUrl}}
{{t jobs.compare}}
-
{{pathFrom commit.compareUrl}}
+
{{pathFrom commit.compareUrl}}
{{/if}} {{/if}} {{#if commit.authorName}}
{{t jobs.author}}
-
{{commit.authorName}}
+
{{commit.authorName}}
{{/if}} {{#if commit.committerName}}
{{t jobs.committer}}
-
{{commit.committerName}}
+
{{commit.committerName}}
{{/if}}
{{/with}} diff --git a/assets/scripts/app/templates/layouts/top.hbs b/assets/scripts/app/templates/layouts/top.hbs index e883d6aa..0f583cf6 100644 --- a/assets/scripts/app/templates/layouts/top.hbs +++ b/assets/scripts/app/templates/layouts/top.hbs @@ -1,10 +1,10 @@ -{{#linkTo "index.current"}} +{{#link-to "index.current"}}

Travis

-{{/linkTo}} +{{/link-to}}
{{#collection Travis.AccountsListView contentBinding="controller"}} - {{#linkTo "account.index" view.account class="name"}}{{view.name}}{{/linkTo}} + {{#link-to "account.index" view.account class="name"}}{{view.name}}{{/link-to}}

Repositories: {{view.account.reposCount}} diff --git a/assets/scripts/app/templates/profile/tabs.hbs b/assets/scripts/app/templates/profile/tabs.hbs index 8f770575..6afb10c8 100644 --- a/assets/scripts/app/templates/profile/tabs.hbs +++ b/assets/scripts/app/templates/profile/tabs.hbs @@ -1,17 +1,17 @@