Change config keys to camel case

This commit is contained in:
Piotr Sarnacki 2015-02-05 11:35:41 +01:00
parent 86b0e3a765
commit 141457c4f9
18 changed files with 38 additions and 37 deletions

View File

@ -2,7 +2,7 @@
`import config from 'travis/config/environment'` `import config from 'travis/config/environment'`
Adapter = DS.ActiveModelAdapter.extend Adapter = DS.ActiveModelAdapter.extend
host: config.api_endpoint host: config.apiEndpoint
ajaxOptions: (url, type, options) -> ajaxOptions: (url, type, options) ->
hash = @_super(url, type, options) hash = @_super(url, type, options)

View File

@ -22,7 +22,7 @@ Controller = Ember.Controller.extend
billingUrl: (-> billingUrl: (->
id = if @get('account.type') == 'user' then 'user' else @get('account.login') id = if @get('account.type') == 'user' then 'user' else @get('account.login')
"#{@get('config').billing_endpoint}/subscriptions/#{id}" "#{@get('config').billingEndpoint}/subscriptions/#{id}"
).property('account.login', 'account.type') ).property('account.login', 'account.type')
`export default Controller` `export default Controller`

View File

@ -1,9 +1,9 @@
`import config from 'travis/config/environment'` `import config from 'travis/config/environment'`
initialize = (container) -> initialize = (container) ->
if config.ga_code if config.gaCode
window._gaq = [] window._gaq = []
_gaq.push(['_setAccount', config.ga_code]) _gaq.push(['_setAccount', config.gaCode])
ga = document.createElement('script') ga = document.createElement('script')
ga.type = 'text/javascript' ga.type = 'text/javascript'

View File

@ -19,11 +19,11 @@ Hook = Model.extend
).property('ownerName', 'name') ).property('ownerName', 'name')
urlGithub: (-> urlGithub: (->
"#{config.source_endpoint}/#{@get('slug')}" "#{config.sourceEndpoint}/#{@get('slug')}"
).property() ).property()
urlGithubAdmin: (-> urlGithubAdmin: (->
"#{config.source_endpoint}/#{@get('slug')}/settings/hooks#travis_minibucket" "#{config.sourceEndpoint}/#{@get('slug')}/settings/hooks#travis_minibucket"
).property() ).property()
toggle: -> toggle: ->

View File

@ -23,7 +23,7 @@ User = Model.extend
).observes('isSyncing') ).observes('isSyncing')
urlGithub: (-> urlGithub: (->
"#{config.source_endpoint}/#{@get('login')}" "#{config.sourceEndpoint}/#{@get('login')}"
).property() ).property()
_rawPermissions: (-> _rawPermissions: (->

View File

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

View File

@ -1,11 +1,12 @@
`import Ember from 'ember'` `import Ember from 'ember'`
`import TravisRoute from 'travis/routes/basic'` `import TravisRoute from 'travis/routes/basic'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend Route = TravisRoute.extend
queryParams: queryParams:
filter: { replace: true } filter: { replace: true }
model: -> model: ->
apiEndpoint = @get('config').api_endpoint apiEndpoint = config.apiEndpoint
$.ajax(apiEndpoint + '/v3/repos?repository.active=true', { $.ajax(apiEndpoint + '/v3/repos?repository.active=true', {
headers: { headers: {
Authorization: 'token ' + @auth.token() Authorization: 'token ' + @auth.token()

View File

@ -1,7 +1,7 @@
<div id="about" class="box"> <div id="about" class="box">
<h4>How can we help?</h4> <h4>How can we help?</h4>
<ul> <ul>
{{#if config.billing_endpoint}} {{#if config.billingEndpoint}}
<li><a href="#" {{action displayCharm target="Travis"}}>Support Ticket</a></li> <li><a href="#" {{action displayCharm target="Travis"}}>Support Ticket</a></li>
{{/if}} {{/if}}
<li><a href="http://chat.travis-ci.com">Live Chat</a></li> <li><a href="http://chat.travis-ci.com">Live Chat</a></li>

View File

@ -1,6 +1,6 @@
<h3>{{view.name}}</h3> <h3>{{view.name}}</h3>
{{#if config.billing_endpoint}} {{#if config.billingEndpoint}}
{{#if view.subscribed}} {{#if view.subscribed}}
<a class="button activated" {{bind-attr href="billingUrl"}}> <a class="button activated" {{bind-attr href="billingUrl"}}>
Subscription active! Subscription active!

View File

@ -11,7 +11,7 @@
</h5> </h5>
</li> </li>
{{/if}} {{/if}}
{{#if config.billing_endpoint}} {{#if config.billingEndpoint}}
<li id="tab_billing" class="right"> <li id="tab_billing" class="right">
<h5> <h5>
<a {{bind-attr href="billingUrl"}}>Billing</a> <a {{bind-attr href="billingUrl"}}>Billing</a>

View File

@ -56,7 +56,7 @@
<p> <p>
Integrating <a href="https://codeclimate.com">Code Climate's test coverage</a> reporting with your test Integrating <a href="https://codeclimate.com">Code Climate's test coverage</a> reporting with your test
suite on Travis CI allows to track changes in coverage over time. If you haven't tried it out already, <a suite on Travis CI allows to track changes in coverage over time. If you haven't tried it out already, <a
{{bind-attr href=config.code_climate_url}}" target="_blank">sign {{bind-attr href=config.codeClimateUrl}}" target="_blank">sign
up today</a> to improve your code's quality. New customers get 20% off for the first three months! up today</a> to improve your code's quality. New customers get 20% off for the first three months!
</p> </p>

View File

@ -36,7 +36,7 @@
</li> </li>
{{/unless}} {{/unless}}
{{#if config.pages_endpoint}} {{#if config.pagesEndpoint}}
<li class="menu legal"> <li class="menu legal">
<p class="handle"> <p class="handle">
<a {{bind-attr href="config.url_legal"}}>Legal</a> <a {{bind-attr href="config.url_legal"}}>Legal</a>
@ -77,9 +77,9 @@
<li> <li>
{{#link-to "profile" class="signed-in"}}Accounts{{/link-to}} {{#link-to "profile" class="signed-in"}}Accounts{{/link-to}}
</li> </li>
{{#if config.billing_endpoint}} {{#if config.billingEndpoint}}
<li> <li>
<a {{bind-attr href="config.billing_endpoint"}}>Billing</a> <a {{bind-attr href="config.billingEndpoint"}}>Billing</a>
</li> </li>
{{/if}} {{/if}}
<li> <li>

View File

@ -39,7 +39,7 @@ ajax = Em.Object.create
method = method || "GET" method = method || "GET"
method = method.toUpperCase() method = method.toUpperCase()
endpoint = config.api_endpoint || '' endpoint = config.apiEndpoint || ''
options = options || {} options = options || {}
token = Travis.sessionStorage.getItem('travis.token') token = Travis.sessionStorage.getItem('travis.token')

View File

@ -12,7 +12,7 @@ Auth = Ember.Object.extend
Travis.sessionStorage.getItem('travis.token') Travis.sessionStorage.getItem('travis.token')
endpoint: (-> endpoint: (->
config.api_endpoint config.apiEndpoint
).property(), ).property(),
signOut: -> signOut: ->

View File

@ -110,12 +110,12 @@ _githubReferenceRegexp = new RegExp("([\\w-]+)?\\/?([\\w-]+)?(?:#|gh-)(\\d+)", '
_githubReferenceLink = (reference, current, matched) -> _githubReferenceLink = (reference, current, matched) ->
owner = matched.owner || current.owner owner = matched.owner || current.owner
repo = matched.repo || current.repo repo = matched.repo || current.repo
"<a href=\"#{config.source_endpoint}/#{owner}/#{repo}/issues/#{matched.number}\">#{reference}</a>" "<a href=\"#{config.sourceEndpoint}/#{owner}/#{repo}/issues/#{matched.number}\">#{reference}</a>"
_githubUserRegexp = new RegExp("\\B@([\\w-]+)", 'g') _githubUserRegexp = new RegExp("\\B@([\\w-]+)", 'g')
_githubUserLink = (reference, username) -> _githubUserLink = (reference, username) ->
"<a href=\"#{config.source_endpoint}/#{username}\">#{reference}</a>" "<a href=\"#{config.sourceEndpoint}/#{username}\">#{reference}</a>"
_githubCommitReferenceRegexp = new RegExp("([\\w-]+)?\\/([\\w-]+)?@([0-9A-Fa-f]+)", 'g') _githubCommitReferenceRegexp = new RegExp("([\\w-]+)?\\/([\\w-]+)?@([0-9A-Fa-f]+)", 'g')

View File

@ -1,25 +1,25 @@
`import config from 'travis/config/environment'` `import config from 'travis/config/environment'`
plainTextLog = (id) -> plainTextLog = (id) ->
"#{config.api_endpoint}/jobs/#{id}/log.txt?deansi=true" "#{config.apiEndpoint}/jobs/#{id}/log.txt?deansi=true"
githubPullRequest = (slug, pullRequestNumber) -> githubPullRequest = (slug, pullRequestNumber) ->
"#{config.source_endpoint}/#{slug}/pull/#{pullRequestNumber}" "#{config.sourceEndpoint}/#{slug}/pull/#{pullRequestNumber}"
githubCommit = (slug, sha) -> githubCommit = (slug, sha) ->
"#{config.source_endpoint}/#{slug}/commit/#{sha}" "#{config.sourceEndpoint}/#{slug}/commit/#{sha}"
githubRepo = (slug) -> githubRepo = (slug) ->
"#{config.source_endpoint}/#{slug}" "#{config.sourceEndpoint}/#{slug}"
githubWatchers = (slug) -> githubWatchers = (slug) ->
"#{config.source_endpoint}/#{slug}/watchers" "#{config.sourceEndpoint}/#{slug}/watchers"
githubNetwork = (slug) -> githubNetwork = (slug) ->
"#{config.source_endpoint}/#{slug}/network" "#{config.sourceEndpoint}/#{slug}/network"
githubAdmin = (slug) -> githubAdmin = (slug) ->
"#{config.source_endpoint}/#{slug}/settings/hooks#travis_minibucket" "#{config.sourceEndpoint}/#{slug}/settings/hooks#travis_minibucket"
statusImage = (slug, branch) -> statusImage = (slug, branch) ->
if config.pro if config.pro
@ -31,9 +31,9 @@ statusImage = (slug, branch) ->
ccXml = (slug) -> ccXml = (slug) ->
if config.pro if config.pro
token = Travis.__container__.lookup('controller:currentUser').get('token') token = Travis.__container__.lookup('controller:currentUser').get('token')
"##{config.api_endpoint}/repos/#{slug}/cc.xml?token=#{token}" "##{config.apiEndpoint}/repos/#{slug}/cc.xml?token=#{token}"
else else
"#{config.api_endpoint}/repos/#{slug}/cc.xml" "#{config.apiEndpoint}/repos/#{slug}/cc.xml"
email = (email) -> email = (email) ->
"mailto:#{email}" "mailto:#{email}"

View File

@ -19,7 +19,7 @@ module.exports = function(environment) {
}, },
// defaults for running travis-web // defaults for running travis-web
api_endpoint: 'https://api.travis-ci.org', apiEndpoint: 'https://api.travis-ci.org',
source_endpoint: 'https://github.com', source_endpoint: 'https://github.com',
pusher: { pusher: {
key: '5df8ac576dcccf4fd076', key: '5df8ac576dcccf4fd076',

View File

@ -166,22 +166,22 @@ class Travis::Web::App
def set_config(string, opts = {}) def set_config(string, opts = {})
# TODO: clean up # TODO: clean up
config = {} config = {}
config['api_endpoint'] = options[:api_endpoint] if options[:api_endpoint] config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint]
config['pages_endpoint'] = options[:pages_endpoint] if options[:pages_endpoint] config['pagesEndpoint'] = options[:pages_endpoint] if options[:pages_endpoint]
config['billing_endpoint'] = options[:billing_endpoint] if options[:billing_endpoint] config['billingEndpoint'] = options[:billing_endpoint] if options[:billing_endpoint]
config['source_endpoint'] = options[:source_endpoint] if options[:source_endpoint] config['sourceEndpoint'] = options[:source_endpoint] if options[:source_endpoint]
pusher = {} pusher = {}
pusher['key'] = options[:pusher_key] if options[:pusher_key] pusher['key'] = options[:pusher_key] if options[:pusher_key]
pusher['host'] = options[:pusher_host] if options[:pusher_host] pusher['host'] = options[:pusher_host] if options[:pusher_host]
pusher['path'] = options[:pusher_path] if options[:pusher_path] pusher['path'] = options[:pusher_path] if options[:pusher_path]
config['pusher'] = pusher config['pusher'] = pusher
config['ga_code'] = options[:ga_code] if options[:ga_code] config['gaCode'] = options[:ga_code] if options[:ga_code]
config['pro'] = options[:pro] if options[:pro] config['pro'] = options[:pro] if options[:pro]
config['enterprise'] = options[:enterprise] if options[:enterprise] config['enterprise'] = options[:enterprise] if options[:enterprise]
config['code_climate'] = options[:code_climate] if options[:code_climate] config['codeClimate'] = options[:code_climate] if options[:code_climate]
config['code_climate_url'] = options[:code_climate_url] if options[:code_climate_url] config['codeClimateUrl'] = options[:code_climate_url] if options[:code_climate_url]
regexp = %r(<meta name="travis/config/environment"\s+content="([^"]+)") regexp = %r(<meta name="travis/config/environment"\s+content="([^"]+)")
string.gsub!(regexp) do string.gsub!(regexp) do