Merge branch 'master' of github.com:travis-ci/travis-ember

Conflicts:
	public/javascripts/application.js
This commit is contained in:
Sven Fuchs 2012-09-23 03:22:54 +02:00
commit dc9881dbc8
6 changed files with 26 additions and 13 deletions

View File

@ -223,7 +223,7 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thin (1.4.1)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)

View File

@ -1,14 +1,13 @@
Travis.Pusher = ->
@active_channels = []
if Travis.Pusher.KEY
@pusher = new Pusher(Travis.Pusher.KEY)
if Travis.config.pusher?.key?
@pusher = new Pusher(Travis.config.pusher.key)
@subscribe(channel) for channel in Travis.Pusher.CHANNELS
this
$.extend Travis.Pusher,
CHANNELS: ['common']
CHANNEL_PREFIX: ''
KEY: ''
$.extend Travis.Pusher.prototype,
subscribe: (channel) ->

View File

@ -12,7 +12,7 @@ jQuery.support.cors = true
endpoint = Travis.config.api_endpoint || ''
options = options || {}
if access_token = Travis.app.get('accessToken')
if access_token = Travis.app?.get('accessToken')
options.headers ||= {}
options.headers['Authorization'] ||= "token #{access_token}"
@ -22,7 +22,19 @@ jQuery.support.cors = true
options.contentType = 'application/json; charset=utf-8'
options.context = this
if options.data && method != 'GET'
if options.data && method != 'GET' && method != 'get'
options.data = JSON.stringify(options.data)
$.ajax($.extend(options, @DEFAULT_OPTIONS))
@Travis.Ajax.instance = Em.Object.create(@Travis.Ajax)
$.extend @Travis,
get: (url, callback) ->
@ajax(url, 'get', success: callback)
post: (url, data, callback) ->
@Ajax.instance.post(url, data, callback)
ajax: (url, method, options) ->
@Ajax.instance.ajax(url, method, options)

View File

@ -33,6 +33,11 @@ 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) ->
console.log "Connecting to #{Travis.config.api_endpoint}"
@app = Travis.App.create(attrs || {})

View File

@ -10,13 +10,10 @@
<script>
// minispade.require('mocks')
minispade.require('app')
if(location.hostname != 'localhost') {
Travis.Pusher.KEY = '23ed642e81512118260e'
}
$(function() {
Travis.run()
Travis.loadConfig(function() {
Travis.run()
});
});
</script>
</head>

File diff suppressed because one or more lines are too long