Use ENV.config instead of Travis.config

This commit is contained in:
Piotr Sarnacki 2015-01-30 17:15:13 +01:00
parent 6fb1bfaaaf
commit 165d072d79
12 changed files with 40 additions and 28 deletions

View File

@ -1,7 +1,7 @@
config = ENV.config
Adapter = DS.ActiveModelAdapter.extend Adapter = DS.ActiveModelAdapter.extend
host: (-> host: config.api_endpoint
Travis.config.api_endpoint
).property()
ajaxOptions: (url, type, options) -> ajaxOptions: (url, type, options) ->
hash = @_super(url, type, options) hash = @_super(url, type, options)

View File

@ -86,7 +86,7 @@ App = Ember.Application.extend(Ember.Evented,
new Date() new Date()
onUserUpdate: (user) -> onUserUpdate: (user) ->
if Travis.config.pro if config.pro
@identifyCustomer(user) @identifyCustomer(user)
@subscribePusher(user) @subscribePusher(user)
@setupCharm(user) @setupCharm(user)

View File

@ -1,7 +1,8 @@
require 'models/model' require 'models/model'
config = ENV.config
Model = Travis.Model Model = Travis.Model
Repo = Travis.Repo
Hook = Model.extend Hook = Model.extend
name: DS.attr() name: DS.attr()
@ -20,11 +21,11 @@ Hook = Model.extend
).property('ownerName', 'name') ).property('ownerName', 'name')
urlGithub: (-> urlGithub: (->
"#{Travis.config.source_endpoint}/#{@get('slug')}" "#{config.source_endpoint}/#{@get('slug')}"
).property() ).property()
urlGithubAdmin: (-> urlGithubAdmin: (->
"#{Travis.config.source_endpoint}/#{@get('slug')}/settings/hooks#travis_minibucket" "#{config.source_endpoint}/#{@get('slug')}/settings/hooks#travis_minibucket"
).property() ).property()
toggle: -> toggle: ->

View File

@ -1,6 +1,7 @@
require 'utils/log-chunks' require 'utils/log-chunks'
Ajax = Travis.ajax Ajax = Travis.ajax
config = ENV.config
Request = Ember.Object.extend Request = Ember.Object.extend
HEADERS: HEADERS:
@ -13,7 +14,7 @@ Request = Ember.Object.extend
success: (body, status, xhr) => Ember.run(this, -> @handle(body, status, xhr)) success: (body, status, xhr) => Ember.run(this, -> @handle(body, status, xhr))
handle: (body, status, xhr) -> handle: (body, status, xhr) ->
if Travis.config.pro if config.pro
@log.set('token', xhr.getResponseHeader('X-Log-Access-Token')) @log.set('token', xhr.getResponseHeader('X-Log-Access-Token'))
if xhr.status == 204 if xhr.status == 204
@ -58,7 +59,7 @@ Log = Ember.Object.extend
@append part @append part
parts: (-> parts: (->
#if Travis.config.pusher_log_fallback #if config.pusher_log_fallback
# Travis.LogChunks.create(content: [], missingPartsCallback: => @fetchMissingParts.apply(this, arguments)) # Travis.LogChunks.create(content: [], missingPartsCallback: => @fetchMissingParts.apply(this, arguments))
#else #else
Ember.ArrayProxy.create(content: []) Ember.ArrayProxy.create(content: [])

View File

@ -4,6 +4,7 @@ require 'models/model'
Model = Travis.Model Model = Travis.Model
Ajax = Travis.ajax Ajax = Travis.ajax
Account = Travis.Account Account = Travis.Account
config = ENV.config
User = Model.extend User = Model.extend
name: DS.attr() name: DS.attr()
@ -25,7 +26,7 @@ User = Model.extend
).observes('isSyncing') ).observes('isSyncing')
urlGithub: (-> urlGithub: (->
"#{Travis.config.source_endpoint}/#{@get('login')}" "#{config.source_endpoint}/#{@get('login')}"
).property() ).property()
_rawPermissions: (-> _rawPermissions: (->

View File

@ -13,7 +13,7 @@ Router = Ember.Router.extend
didTransition: -> didTransition: ->
@_super.apply @, arguments @_super.apply @, arguments
if Travis.config.ga_code if config.ga_code
_gaq.push ['_trackPageview', location.pathname] _gaq.push ['_trackPageview', location.pathname]
Router.map -> Router.map ->

View File

@ -1,3 +1,5 @@
config = ENV.config
Route = Ember.Route.extend Route = Ember.Route.extend
beforeModel: (transition) -> beforeModel: (transition) ->
@auth.autoSignIn() unless @signedIn() @auth.autoSignIn() unless @signedIn()
@ -13,7 +15,7 @@ Route = Ember.Route.extend
needsAuth: (-> needsAuth: (->
# on pro, we need to auth on every route # on pro, we need to auth on every route
Travis.config.pro config.pro
).property() ).property()
Travis.Route = Route Travis.Route = Route

View File

@ -1,7 +1,7 @@
require 'config/emoij' require 'config/emoij'
config_keys_map = Travis.CONFIG_KEYS_MAP config_keys_map = Travis.CONFIG_KEYS_MAP
config = Travis.config config = ENV.config
githubCommitUrl = Travis.Urls.githubCommit githubCommitUrl = Travis.Urls.githubCommit
timeago = $.timeago timeago = $.timeago
intersect = $.intersect intersect = $.intersect

View File

@ -1,43 +1,45 @@
config = ENV.config
plainTextLog = (id) -> plainTextLog = (id) ->
"#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true" "#{config.api_endpoint}/jobs/#{id}/log.txt?deansi=true"
githubPullRequest = (slug, pullRequestNumber) -> githubPullRequest = (slug, pullRequestNumber) ->
"#{Travis.config.source_endpoint}/#{slug}/pull/#{pullRequestNumber}" "#{config.source_endpoint}/#{slug}/pull/#{pullRequestNumber}"
githubCommit = (slug, sha) -> githubCommit = (slug, sha) ->
"#{Travis.config.source_endpoint}/#{slug}/commit/#{sha}" "#{config.source_endpoint}/#{slug}/commit/#{sha}"
githubRepo = (slug) -> githubRepo = (slug) ->
"#{Travis.config.source_endpoint}/#{slug}" "#{config.source_endpoint}/#{slug}"
githubWatchers = (slug) -> githubWatchers = (slug) ->
"#{Travis.config.source_endpoint}/#{slug}/watchers" "#{config.source_endpoint}/#{slug}/watchers"
githubNetwork = (slug) -> githubNetwork = (slug) ->
"#{Travis.config.source_endpoint}/#{slug}/network" "#{config.source_endpoint}/#{slug}/network"
githubAdmin = (slug) -> githubAdmin = (slug) ->
"#{Travis.config.source_endpoint}/#{slug}/settings/hooks#travis_minibucket" "#{config.source_endpoint}/#{slug}/settings/hooks#travis_minibucket"
statusImage = (slug, branch) -> statusImage = (slug, branch) ->
if Travis.config.pro if config.pro
token = Travis.__container__.lookup('controller:currentUser').get('token') token = Travis.__container__.lookup('controller:currentUser').get('token')
"#{location.protocol}//#{location.host}/#{slug}.svg?token=#{token}" + if branch then "&branch=#{branch}" else '' "#{location.protocol}//#{location.host}/#{slug}.svg?token=#{token}" + if branch then "&branch=#{branch}" else ''
else else
"#{location.protocol}//#{location.host}/#{slug}.svg" + if branch then "?branch=#{encodeURIComponent(branch)}" else '' "#{location.protocol}//#{location.host}/#{slug}.svg" + if branch then "?branch=#{encodeURIComponent(branch)}" else ''
ccXml = (slug) -> ccXml = (slug) ->
if Travis.config.pro if config.pro
token = Travis.__container__.lookup('controller:currentUser').get('token') token = Travis.__container__.lookup('controller:currentUser').get('token')
"##{Travis.config.api_endpoint}/repos/#{slug}/cc.xml?token=#{token}" "##{config.api_endpoint}/repos/#{slug}/cc.xml?token=#{token}"
else else
"#{Travis.config.api_endpoint}/repos/#{slug}/cc.xml" "#{config.api_endpoint}/repos/#{slug}/cc.xml"
email = (email) -> email = (email) ->
"mailto:#{email}" "mailto:#{email}"
gravatarImage = (email, size) -> gravatarImage = (email, size) ->
"https://www.gravatar.com/avatar/#{md5(email)}?s=#{size}&d=#{encodeURIComponent(Travis.config.avatar_default_url)}" "https://www.gravatar.com/avatar/#{md5(email)}?s=#{size}&d=#{encodeURIComponent(config.avatar_default_url)}"
Travis.Urls = { Travis.Urls = {
plainTextLog: plainTextLog, plainTextLog: plainTextLog,

View File

@ -5,6 +5,8 @@ require 'utils/log-folder'
Log.DEBUG = false Log.DEBUG = false
Log.LIMIT = 10000 Log.LIMIT = 10000
config = ENV.config
Travis.reopen Travis.reopen
LogView: Travis.View.extend LogView: Travis.View.extend
templateName: 'jobs/log' templateName: 'jobs/log'
@ -106,7 +108,7 @@ Travis.reopen
plainTextLogUrl: (-> plainTextLogUrl: (->
if id = @get('log.job.id') if id = @get('log.job.id')
url = Travis.Urls.plainTextLog(id) url = Travis.Urls.plainTextLog(id)
if Travis.config.pro if config.pro
url += "&access_token=#{@get('job.log.token')}" url += "&access_token=#{@get('job.log.token')}"
url url
).property('job.log.id', 'job.log.token') ).property('job.log.id', 'job.log.token')

View File

@ -1,3 +1,5 @@
config = ENV.config
View = Travis.View.extend View = Travis.View.extend
templateName: 'repos/show/actions' templateName: 'repos/show/actions'
@ -116,7 +118,7 @@ View = Travis.View.extend
plainTextLogUrl: (-> plainTextLogUrl: (->
if id = @get('jobIdForLog') if id = @get('jobIdForLog')
url = Travis.Urls.plainTextLog(id) url = Travis.Urls.plainTextLog(id)
if Travis.config.pro if config.pro
token = @get('job.log.token') || @get('build.jobs.firstObject.log.token') token = @get('job.log.token') || @get('build.jobs.firstObject.log.token')
url += "&access_token=#{token}" url += "&access_token=#{token}"
url url

View File

@ -1,5 +1,6 @@
statusImage = Travis.Urls.statusImage statusImage = Travis.Urls.statusImage
StatusImagesView = Travis.StatusImagesView StatusImagesView = Travis.StatusImagesView
config = ENV.config
View = Travis.View.extend View = Travis.View.extend
reposBinding: 'controllers.repos' reposBinding: 'controllers.repos'
@ -28,7 +29,7 @@ View = Travis.View.extend
ReposEmptyView: Travis.View.extend ReposEmptyView: Travis.View.extend
template: (-> template: (->
if Travis.config.pro if config.pro
'pro/repos/show/empty' 'pro/repos/show/empty'
else else
'' ''