Skip to content

Commit d2cc69d

Browse files
author
Samson
committed
many changes
2 parents 057e633 + bcaeeb7 commit d2cc69d

6 files changed

Lines changed: 54 additions & 71 deletions

File tree

build/build.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,12 @@ if(program.environment === 'stage') {
6868
}
6969

7070
if(program.server) {
71-
server = program.server;
72-
}
73-
74-
if(program.environment === 'stage') {
75-
cloudfront = cloudfront_stage;
76-
log('Staging enviroment selected', types.label)
77-
78-
} else if (program.environment === 'production' ) {
79-
log('Production enviroment selected', types.label)
80-
cloudfront = cloudfront_production;
81-
82-
} else if(program.environment === 'vagrant') {
83-
var cloudfront = cloudfront_vagrant;
84-
log('Vagrant enviroment selected', types.label)
71+
log('Custom server url selected', types.label)
8572

86-
} else {
87-
log('Development enviroment selected', types.label)
73+
server = program.server;
8874
}
8975

9076

91-
9277
var version = Date.now();
9378
var outputFolder = 'output/version/' + version
9479
log('Starting build');

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8">
5-
<title>API Engine - Great apps start with great apis</title>
6-
<meta name="fragment" content="!">
4+
<meta charset="utf-8">
5+
<title>API Engine - Great apps start with great apis</title>
6+
<meta name="fragment" content="!">
77
<meta data-server-url="https://s.apiengine.io" />
8-
<base href="/repos/apiengine-client/" />
9-
<link rel="stylesheet" href="css/styles.css">
8+
<base href="/repos/apiengine-client/" />
9+
<link rel="stylesheet" href="css/styles.css">
1010
<script>
1111
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1212
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

js/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ require.config({
3737
// Actually kick off the application
3838

3939
require([
40-
'setup/setup'
40+
'setup/setup',
4141
'views/app',
4242
'vm',
43-
'router',
43+
'router'
4444
], function(Setup, AppView, Vm, Router){
4545
Setup.setup();
4646
var appView = Vm.create({}, 'AppView', AppView);

js/setup/logging.js

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,47 @@ define([
55
'libs/proxino/proxino',
66
'clicky'
77
], function ($, EventBus, Events, norefProxino, noclickyref){
8-
9-
// Clicky Tracking
10-
try{ clicky.init(66633495); }catch(e){}
8+
var setup = function () {
9+
// Clicky Tracking
10+
try{ clicky.init(66633495); }catch(e){}
1111

12-
// Google analytics
13-
EventBus.on('all', function (event) {
14-
ga('send', {
15-
hitType: 'event',
16-
eventCategory: 'app',
17-
eventAction: event
18-
})
19-
});
12+
// Google analytics
13+
EventBus.on('all', function (event) {
14+
ga('send', {
15+
hitType: 'event',
16+
eventCategory: 'app',
17+
eventAction: event
18+
})
19+
});
2020

21-
// Proxino Error tracking
22-
Proxino.key = "QI-BctdhtytsUUJERc5HfA";
23-
Proxino.track_errors();
21+
// Proxino Error tracking
22+
Proxino.key = "QI-BctdhtytsUUJERc5HfA";
23+
Proxino.track_errors();
2424

25-
// Server Error Failures
25+
// Server Error Failures
2626

27-
$("body").ajaxError(function(ev, res, req) {
28-
if(res.status >= 500 && res.status <= 600) {
29-
var responseJSON = xhr.responseText;
30-
try {
31-
responseJSON = JSON.parse(xhr.responseText);
32-
} catch (e) {}
33-
34-
var error = new ErrorModel();
35-
error.save({
36-
"page": window.location.href,
37-
"context": req.type + ' ' + req.url,
38-
"code": res.status,
39-
"error": "Internal API error",
40-
"payload": {
41-
sent : req.data,
42-
received : responseJSON
43-
}
44-
}, {});
45-
}
46-
});
27+
$("body").ajaxError(function(ev, res, req) {
28+
if(res.status >= 500 && res.status <= 600) {
29+
var responseJSON = xhr.responseText;
30+
try {
31+
responseJSON = JSON.parse(xhr.responseText);
32+
} catch (e) {}
4733

34+
var error = new ErrorModel();
35+
error.save({
36+
"page": window.location.href,
37+
"context": req.type + ' ' + req.url,
38+
"code": res.status,
39+
"error": "Internal API error",
40+
"payload": {
41+
sent : req.data,
42+
received : responseJSON
43+
}
44+
}, {});
45+
}
46+
});
47+
};
48+
return {
49+
setup: setup
50+
}
4851
})

js/setup/setup.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
define([
22
'setup/logging'
33
], function (Logging){
4-
Logging.setup();
5-
4+
var setup = function () {
5+
Logging.setup();
6+
}
7+
return {
8+
setup: setup
9+
}
610

711
});

js/views/app.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,9 @@ define([
2424
var that = this;
2525

2626
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
27-
// Move these server url declarations all to custom url data attribute
2827
if(options.url.indexOf('proxino') === -1) {
29-
if($('[data-server-url]').length > 0) {
30-
options.url = $('[data-server-url]').attr('data-server-url');
31-
} else if (window.location.host === 'apiengine.io') {
32-
options.url = 'https://x.apiengine.io' + options.url;
33-
34-
} else {
35-
options.url = 'https://s.apiengine.io' + options.url;
36-
}
28+
options.url = $('[data-server-url]').attr('data-server-url') + options.url;
3729
}
38-
3930
});
4031

4132
},

0 commit comments

Comments
 (0)