travis-web/assets/javascripts/travis.coffee
Piotr Sarnacki 1134028996 Travis mostly works with new router
I haven't touched almost all of the things related to profile. I'm not
also sure what's the state of authentication at this point.

Conflicts:

	Gemfile
	Gemfile.lock
	Procfile
	assets/javascripts/app/app.coffee
	assets/javascripts/app/controllers.coffee
	assets/javascripts/app/controllers/auth.coffee
	assets/javascripts/app/controllers/profile.coffee
	assets/javascripts/app/routes.coffee
	assets/javascripts/app/templates/builds/list.hbs
	assets/javascripts/app/templates/builds/show.hbs
	assets/javascripts/app/templates/jobs/list.hbs
	assets/javascripts/app/templates/layouts/top.hbs
	assets/javascripts/app/templates/repos/list.hbs
	assets/javascripts/app/templates/repos/show/tabs.hbs
	assets/javascripts/app/templates/workers/list.hbs
	assets/javascripts/app/views.coffee
	assets/javascripts/app/views/repo/show.coffee
	assets/javascripts/travis.coffee
	public/index.html
	public/javascripts/application.js
	public/stylesheets/application.css
2012-09-26 16:30:16 +02:00

54 lines
1.9 KiB
CoffeeScript

require 'ext/jquery'
require 'ext/ember/namespace'
@Travis = Em.Namespace.create
config:
api_endpoint: $('meta[rel="travis.api_endpoint"]').attr('href')
CONFIG_KEYS: ['rvm', 'gemfile', 'env', 'jdk', 'otp_release', 'php', 'node_js', 'perl', 'python', 'scala']
ROUTES:
'profile/:login/me': ['profile', 'user']
'profile/:login': ['profile', 'hooks']
'profile': ['profile', 'hooks']
'stats': ['stats', 'show']
':owner/:name/jobs/:id/:line': ['home', 'job']
':owner/:name/jobs/:id': ['home', 'job']
':owner/:name/builds/:id': ['home', 'build']
':owner/:name/builds': ['home', 'builds']
':owner/:name/pull_requests': ['home', 'pullRequests']
':owner/:name/branches': ['home', 'branches']
':owner/:name': ['home', 'current']
'': ['home', 'index']
'#': ['home', 'index']
QUEUES: [
{ name: 'common', display: 'Common' }
{ name: 'php', display: 'PHP, Perl and Python' }
{ name: 'node_js', display: 'Node.js' }
{ name: 'jvmotp', display: 'JVM and Erlang' }
{ name: 'rails', display: 'Rails' }
{ name: 'spree', display: 'Spree' }
]
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 || {})
# 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.initialize()