move loadConfig to Travis.run
This commit is contained in:
parent
b9179e3439
commit
1566595cda
|
@ -42,7 +42,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-api.git
|
||||
revision: 3e371251f7ae5c3ebf4ce0186783183afaabd599
|
||||
revision: 6cdfd6a8a450baa169e105a85627b1bf7bbe800e
|
||||
specs:
|
||||
travis-api (0.0.1)
|
||||
backports (~> 2.5)
|
||||
|
@ -60,7 +60,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-core.git
|
||||
revision: 6c974f0c0ad529748e95222c3145a0f085311ad1
|
||||
revision: e7a811451c9497c564aacf1dc26a6db7236da520
|
||||
branch: sf-more-services
|
||||
specs:
|
||||
travis-core (0.0.1)
|
||||
|
|
|
@ -34,8 +34,7 @@ Travis.reopen
|
|||
@set('auth', Travis.Auth.create(store: @store, endpoint: Travis.config.api_endpoint))
|
||||
|
||||
@slider = new Travis.Slider()
|
||||
|
||||
@pusher = new Travis.Pusher()
|
||||
@pusher = new Travis.Pusher(Travis.config.pusher)
|
||||
@tailing = new Travis.Tailing()
|
||||
|
||||
signIn: ->
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
Travis.Pusher = ->
|
||||
@active_channels = []
|
||||
if Travis.config.pusher?.key?
|
||||
Pusher.warn = @warn.bind(this)
|
||||
@pusher = new Pusher(Travis.config.pusher.key)
|
||||
@subscribe(channel) for channel in Travis.Pusher.CHANNELS
|
||||
Travis.Pusher = (config) ->
|
||||
@init(config) if config
|
||||
this
|
||||
|
||||
$.extend Travis.Pusher,
|
||||
|
@ -11,6 +7,13 @@ $.extend Travis.Pusher,
|
|||
CHANNEL_PREFIX: ''
|
||||
|
||||
$.extend Travis.Pusher.prototype,
|
||||
active_channels: []
|
||||
|
||||
init: (config) ->
|
||||
Pusher.warn = @warn.bind(this)
|
||||
@pusher = new Pusher(config.key)
|
||||
@subscribe(channel) for channel in Travis.Pusher.CHANNELS
|
||||
|
||||
subscribe: (channel) ->
|
||||
if @pusher && @active_channels.indexOf(channel) == -1
|
||||
@active_channels.push(channel)
|
||||
|
@ -42,8 +45,8 @@ $.extend Travis.Pusher.prototype,
|
|||
{ worker: data }
|
||||
|
||||
warn: (type, warning) ->
|
||||
# console.warn(warning) unless @ignoreWarning(warning)
|
||||
console.warn(warning) unless @ignoreWarning(warning)
|
||||
|
||||
# ignoreWarning: (warning) ->
|
||||
# if message = warning.data?.message
|
||||
# message.indexOf('Existing subscription') == 0 || message.indexOf('No current subscription') == 0
|
||||
ignoreWarning: (warning) ->
|
||||
if message = warning.data?.message
|
||||
message.indexOf('Existing subscription') == 0 or message.indexOf('No current subscription') == 0
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# window.onTrue = (object, path, callback) ->
|
||||
# if object.get(path)
|
||||
# callback()
|
||||
# else
|
||||
# observer = ->
|
||||
# object.removeObserver path, observer
|
||||
# callback()
|
||||
# object.addObserver path, observer
|
||||
#
|
||||
# window.onceLoaded = ->
|
||||
# objects = Array.prototype.slice.apply(arguments)
|
||||
# callback = objects.pop()
|
||||
#
|
||||
# # sadly Ember.Enumerable.compact does not remove undefined values
|
||||
# objects = ((object || null) for object in objects).compact()
|
||||
# object = objects.shift()
|
||||
#
|
||||
# if object
|
||||
# path = if Ember.isArray(object) then 'firstObject.isLoaded' else 'isLoaded'
|
||||
# onTrue object, path, ->
|
||||
# if objects.length == 0
|
||||
# callback(object)
|
||||
# else
|
||||
# onceLoaded.apply(objects + [callback])
|
||||
# else
|
||||
# callback object
|
|
@ -33,26 +33,27 @@ require 'ext/ember/namespace'
|
|||
|
||||
INTERVALS: { sponsors: -1, times: -1, updateTimes: 1000 }
|
||||
|
||||
loadConfig: (callback) ->
|
||||
Travis.get '/config', (data) ->
|
||||
$.extend Travis.config, data.config
|
||||
callback()
|
||||
|
||||
run: (attrs) ->
|
||||
@redirectOnHashbang()
|
||||
|
||||
console.log "Connecting to #{Travis.config.api_endpoint}"
|
||||
app = Travis.App.create(attrs || {})
|
||||
# TODO: router expects the classes for controllers on main namespace, so
|
||||
# if we want to keep app at Travis.app, we need to copy that, it would
|
||||
# be ideal to send a patch to ember and get rid of this
|
||||
$.each Travis, (key, value) ->
|
||||
app[key] = value if value && value.isClass && key != 'constructor'
|
||||
@loadConfig (config) =>
|
||||
console.log "Connecting to #{Travis.config.api_endpoint}"
|
||||
app = Travis.App.create(attrs || {})
|
||||
# TODO: router expects the classes for controllers on main namespace, so
|
||||
# if we want to keep app at Travis.app, we need to copy that, it would
|
||||
# be ideal to send a patch to ember and get rid of this
|
||||
$.each Travis, (key, value) ->
|
||||
app[key] = value if value && value.isClass && key != 'constructor'
|
||||
|
||||
@app = app
|
||||
@store = app.store
|
||||
@app = app
|
||||
@store = app.store
|
||||
|
||||
app.initialize()
|
||||
app.initialize()
|
||||
|
||||
redirectOnHashbang: ->
|
||||
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
||||
|
||||
loadConfig: (callback) ->
|
||||
Travis.get '/config', (data) =>
|
||||
$.extend @config, data.config
|
||||
callback(data.config)
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
// minispade.require('mocks')
|
||||
minispade.require('app')
|
||||
$(function() {
|
||||
Travis.loadConfig(function() {
|
||||
Travis.run()
|
||||
});
|
||||
Travis.run()
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user