strider
Version:
Brilliant continuous deployment platform
116 lines (104 loc) • 702 kB
JavaScript
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){
"use strict";function AccountController(e,c){e.user=user,e.providers=providers,e.accounts=setupAccounts(e.user);var s=c.location.hash;s&&$('a[href="'+s+'"]').tab("show"),e.deleteAccount=function(c){if(c.unsaved){var s=e.accounts[c.provider].indexOf(c);return e.accounts[c.provider].splice(s,1),s=e.user.accounts.indexOf(c),e.user.accounts.splice(s,1),void e.success("Account removed")}$.ajax("/api/account/"+c.provider+"/"+c.id,{type:"DELETE",success:function(){var s=e.accounts[c.provider].indexOf(c);e.accounts[c.provider].splice(s,1),s=e.user.accounts.indexOf(c),e.user.accounts.splice(s,1),e.success("Account removed",!0)},error:function(c){e.error(c&&c.responseText?c.responseText:"Failed to remove account",!0)}})},e.addAccount=function(c){var s=0;e.accounts[c]||(e.accounts[c]=[]);for(var a=0;a<e.accounts[c].length;a++){var o=parseInt(e.accounts[c][a].id,10);o>=s&&(s=o+1)}var n={id:s,provider:c,title:c+" "+s,last_updated:new Date,config:{},cache:[],unsaved:!0};e.accounts[c].push(n),e.user.accounts.push(n)},e.saveAccount=function(c,s,a){$.ajax("/api/account/"+c+"/"+s.id,{type:"PUT",data:JSON.stringify(s),contentType:"application/json",error:function(){e.error("Unable to save account",!0)},success:function(){delete s.unsaved,a(),e.success("Account saved",!0)}})},e.changePassword=function(){$.ajax("/api/account/password",{data:{password:e.password},dataType:"json",error:function(){e.error("Unable to change password",!0)},success:function(){e.password="",e.confirm_password="",e.success("Password changed",!0)},type:"POST"})},e.changeEmail=function(){$.ajax("/api/account/email",{data:{email:e.user.email},dataType:"json",error:function(c){var s=$.parseJSON(c.responseText);e.error("Failed to change email: "+s.errors[0].message,!0)},success:function(){e.success("Email successfully changed",!0)},type:"POST"})},e.changeJobsQuantityOnPage=function(){$.ajax("/api/account/jobsQuantityOnPage",{type:"POST",data:{quantity:e.user.jobsQuantityOnPage},dataType:"json",error:function(c){var s=$.parseJSON(c.responseText);e.error("Failed to change jobs quantity on build page: "+s.errors[0].message,!0)},success:function(){e.success("Jobs quantity on build page successfully changed",!0)}})}}function setupAccounts(e){var c={};if(!e.accounts||!e.accounts.length)return c;for(var s=0;s<e.accounts.length;s++)c[e.accounts[s].provider]||(c[e.accounts[s].provider]=[]),c[e.accounts[s].provider].push(e.accounts[s]);return c}var $=require("jquery"),user=global.user||{},providers=global.providers||{};module.exports=AccountController;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"jquery":67}],2:[function(require,module,exports){
"use strict";function JobController(o,t,n){var r=n.id.split("-")[1];o.$watch('user.jobplugins["'+r+'"]',function(t){o.config=t})}module.exports=JobController;
},{}],3:[function(require,module,exports){
"use strict";function ProviderController(n,o,c){var t=c.id.split("-")[2];n.$watch("account.config",function(o){n.config=o}),n.save=function(){n.saving=!0,n.saveAccount(t,n.account,function(){n.saving=!1})}}module.exports=ProviderController;
},{}],4:[function(require,module,exports){
"use strict";var angular=require("angular"),AccountController=require("./controllers/account"),ProviderController=require("./controllers/provider"),JobController=require("./controllers/job"),interpolate=require("../utils/interpolate"),app=angular.module("account",["alerts"]).config(["$interpolateProvider",interpolate]).controller("AccountController",["$scope","$window",AccountController]).controller("Account.ProviderController",["$scope","$element","$attrs",ProviderController]).controller("Account.JobController",["$scope","$element","$attrs",JobController]);module.exports=app;
},{"../utils/interpolate":38,"./controllers/account":1,"./controllers/job":2,"./controllers/provider":3,"angular":57}],5:[function(require,module,exports){
"use strict";module.exports=function(e,s){e.message=null,e.error=function(t,o){e.message={text:s.trustAsHtml(t),type:"error",showing:!0},o&&e.$root.$digest()},e.info=function(t,o){e.message={text:s.trustAsHtml(t),type:"info",showing:!0},o&&e.$root.$digest()};var t=null,o=null;e.success=function(n,u,i){t&&(clearTimeout(t),t=null),o&&(clearTimeout(o),o=null),e.message={text:s.trustAsHtml("<strong>Done.</strong> "+n),type:"success",showing:!0},i||(t=setTimeout(function(){e.clearMessage(),e.$digest()},5e3)),u&&e.$root.$digest()},e.clearMessage=function(){o&&clearTimeout(o),e.message&&(e.message.showing=!1),o=setTimeout(function(){o=null,e.message=null,e.$digest()},1e3)}};
},{}],6:[function(require,module,exports){
"use strict";var angular=require("angular"),AlertsController=require("./controllers/alerts"),app=angular.module("alerts",[]).controller("AlertsController",["$scope","$sce",AlertsController]);module.exports=app;
},{"./controllers/alerts":5,"angular":57}],7:[function(require,module,exports){
"use strict";var AU=require("ansi_up"),ansi_up=new AU.default,stripAnsi=require("strip-ansi");module.exports=function(){return function(r,e){if(!r)return"";if(r.length>1e5)return r;var n=/^[^\n]*\r[^\n]/.test(r);return r=r.replace(/^[^\n\r]*\u001b\[2K/gm,"").replace(/\u001b\[K[^\n\r]*/g,"").replace(/[^\n]*\r([^\n])/g,"$1").replace(/^[^\n]*\u001b\[0G/gm,""),n&&(r="\r"+r),e?stripAnsi(r):ansi_up.ansi_to_html(r)}};
},{"ansi_up":59,"strip-ansi":115}],8:[function(require,module,exports){
"use strict";var angular=require("angular"),ansi=require("./filters/ansi");angular.module("ansi",[]).filter("ansi",ansi);
},{"./filters/ansi":7,"angular":57}],9:[function(require,module,exports){
(function (global){
"use strict";require("bootstrap");var $=require("jquery"),_=require("lodash"),angular=require("angular"),$navbar=$(".navbar");require("angular-route"),$navbar.find("li").removeClass("active"),$navbar.find('a[href="'+global.location.pathname+'"]').parent().addClass("active"),$("#layout-header").hide(),$("#invite-box").height($("#signup-box").height()),require("ui-bootstrap"),require("ui-codemirror"),require("./account"),require("./config"),require("./plugin-manager"),require("./job-status"),require("./dashboard"),require("./projects"),require("./alerts"),require("./ansi"),require("./moment");var app=angular.module("app",["config","account","plugin-manager","job-status","dashboard","projects"]);global.app=app,global.$=$,global.angular=angular,global._=_;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./account":4,"./alerts":6,"./ansi":8,"./config":19,"./dashboard":21,"./job-status":25,"./moment":30,"./plugin-manager":34,"./projects":37,"angular":57,"angular-route":55,"bootstrap":52,"jquery":67,"lodash":68,"ui-bootstrap":46,"ui-codemirror":47}],10:[function(require,module,exports){
(function (global){
"use strict";function BranchesController(r){r.branchName="",r.branches=branches,r.allBranches=allBranches,r.remove=function(e){confirm("Are you sure you want to remove "+e.name+"?")&&(e.loading=!0,r.clearMessage(),$.ajax({url:"/"+r.project.name+"/branches/",type:"DELETE",data:{name:e.name},success:function(){remove(r.branches,e),r.success(e.name+" is no longer a configured branch.",!0)},error:function(n,a,s){if(e.loading=!1,n&&n.responseText){var c=$.parseJSON(n.responseText);r.error("Error deleting branch: "+c.errors[0],!0)}else r.error("Error deleting branch: "+s,!0)}}))},r.add=function(){var e={name:r.branchName};$.ajax({url:"/"+r.project.name+"/branches/",type:"POST",data:e,dataType:"json",success:function(e){r.branchName="",e.created&&r.branches.push(e.branch),r.success(e.message,!0,!e.created)},error:function(e,n,a){if(e&&e.responseText){var s=$.parseJSON(e.responseText);r.error("Error adding branch: "+s.errors[0],!0)}else r.error("Error adding branch: "+a,!0)}})},r.changeBranchOrder=function(e){r.branches=e,$.ajax({url:"/"+r.project.name+"/branches/",type:"PUT",data:JSON.stringify({branches:e}),contentType:"application/json",dataType:"json",success:function(e){r.success(e.message,!0,!1)},error:function(e,n,a){if(e&&e.responseText){var s=$.parseJSON(e.responseText);r.error("Error changing order of branch: "+s.errors[0],!0)}else r.error("Error changing order of branch: "+a,!0)}})},r.clone=function(e){var n=prompt("Enter name of the clone",e.name);if(n){var a={name:e.name,cloneName:n};$.ajax({url:"/"+r.project.name+"/branches/",type:"POST",data:a,dataType:"json",success:function(e){r.branchName="",e.created&&r.branches.push(e.branch),r.success(e.message,!0,!e.created)},error:function(e,n,a){if(e&&e.responseText){var s=$.parseJSON(e.responseText);r.error("Error cloning branch: "+s.errors[0],!0)}else r.error("Error cloning branch: "+a,!0)}})}}}function remove(r,e){r.splice(r.indexOf(e),1)}var $=require("jquery"),branches=global.branches||[],allBranches=global.allBranches||[];module.exports=BranchesController;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"jquery":67}],11:[function(require,module,exports){
(function (global){
"use strict";function CollaboratorsController(r){r.new_email="",r.new_access=0,r.collaborators=global.collaborators||[],r.remove=function(e){confirm("Are you sure you want to remove "+e.email+"?")&&(e.loading=!0,r.clearMessage(),$.ajax({url:"/"+r.project.name+"/collaborators/",type:"DELETE",data:{email:e.email},success:function(){remove(r.collaborators,e),r.success(e.email+" is no longer a collaborator on this project.",!0)},error:function(o,a,s){if(e.loading=!1,o&&o.responseText){var l=$.parseJSON(o.responseText);r.error("Error deleting collaborator: "+l.errors[0],!0)}else r.error("Error deleting collaborator: "+s,!0)}}))},r.add=function(){var e={email:r.new_email,access:r.new_access||0,gravatar:r.gravatar(r.new_email),owner:!1};$.ajax({url:"/"+r.project.name+"/collaborators/",type:"POST",data:e,dataType:"json",success:function(o){r.new_access=0,r.new_email="",o.created&&r.collaborators.push(e),r.success(o.message,!0,!o.created)},error:function(e,o,a){if(e&&e.responseText){var s=$.parseJSON(e.responseText);r.error("Error adding collaborator: "+s.errors[0],!0)}else r.error("Error adding collaborator: "+a,!0)}})}}function remove(r,e){r.splice(r.indexOf(e),1)}var $=require("jquery");module.exports=CollaboratorsController;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"jquery":67}],12:[function(require,module,exports){
(function (global){
"use strict";function ConfigController(n){function r(r){$(".tab-pane.active, .nav-tabs > li.active").removeClass("active"),$("#"+r).addClass("active"),n.selectedTab=r}function e(r){var e=_.find(n.branches,{name:r});e&&(n.branch=e),global.sessionStorage.setItem("branchName",n.branch.name),o("tab-branch-settings",n.branch)}function o(n,e){_.isString(n)||(n=e&&"master"===e.name?"tab-project":"tab-basic"),$("#"+n+"-tab-handle").tab("show"),r(n),$("a[href='#"+n+"']").tab("show")}function a(){var r=n.branch.plugins;n.configured[n.branch.name]={};for(var e=0;e<r.length;e++)n.configured[n.branch.name][r[e].id]=!0;t()}function t(){for(var r=n.branch.plugins,e=n.branch,o=n.project,a=[],t=0;t<r.length;t++)a.push({id:r[t].id,enabled:r[t].enabled,showStatus:r[t].showStatus});saveProjectConfig({plugin_order:a},e,o,function(r){if(r)return n.error("Error saving plugin order on branch "+e.name+": "+r,!0);n.success("Plugin order on branch "+e.name+" saved.",!0)})}function i(r){var e;if(n.configured[r.name]={},n.configs[r.name]={},n.runnerConfigs[r.name]={},n.disabled_plugins[r.name]=[],!r.mirror_master){e=r.plugins;for(var o=0;o<e.length;o++)n.configured[r.name][e[o].id]=!0,n.configs[r.name][e[o].id]=e[o]}for(var a in n.plugins)n.configured[r.name][a]||(n.configs[r.name][a]={id:a,enabled:!0,config:{}},n.disabled_plugins[r.name].push(n.configs[r.name][a]));r.mirror_master||(n.runnerConfigs[r.name][r.runner.id]=r.runner.config);for(var t in n.runners)(r.mirror_master||t!==r.runner.id)&&(n.runnerConfigs[r.name][t]={})}n.project=project,n.plugins=plugins,n.runners=runners,n.userIsCreator=userIsCreator,n.userConfigs=userConfigs,n.statusBlocks=statusBlocks,n.configured={},n.branch=n.project.branches[0],n.branches=branches,n.disabled_plugins={},n.configs={},n.runnerConfigs={},n.api_root="/"+n.project.name+"/api/",n.page="config",n.finishedRepeat=function(){$("[data-toggle=tab]").on("shown",function(n){var r=$(n.target).attr("href");$(r).find("[ui-codemirror]").trigger("refresh")})},$(function(){({init:function(){var n=this;$('a[data-toggle="tab"]').on("show",function(n){var e=$(n.target).attr("href").replace("#",""),o=global.location.pathname.split("/").slice(0,4).join("/"),a=global.history.state;r(e),a&&a.tabName===e||global.history.pushState({tabName:e},global.document.title,o+"/"+e)}),global.onpopstate=function(){n.route()},this.route()},route:function(){var n=global.location.pathname.split("/");"config"===n.slice(0,4)[3]&&this.routeConfigPage(n)},routeConfigPage:function(r){var a=global.sessionStorage.getItem("branchName");a?e(a):global.sessionStorage.removeItem("branchName");var t,i=r[r.length-1];5===r.length&&i.length&&(t=i,o(t,n.branch))}}).init()}),n.switchToBranch=e,$("[data-toggle=tab]").on("shown",function(n){var r=$(n.target).attr("href");$(r).find("[ui-codemirror]").trigger("refresh")}),n.switchToTab=o,n.refreshBranches=function(){throw new Error("Not implemented")},n.setEnabled=function(r,e){n.configs[n.branch.name][r].enabled=e,t()},n.savePluginOrder=t,n.switchToMaster=function(){for(var r=0;r<n.project.branches.length;r++)if("master"===n.project.branches[r].name)return void(n.branch=n.project.branches[r])},n.clearCache=function(){n.clearingCache=!0,$.ajax("/"+n.project.name+"/cache",{type:"DELETE",success:function(){n.clearingCache=!1,n.success("Cleared the cache",!0)},error:function(){n.clearingCache=!1,n.error("Failed to clear the cache",!0)}})},n.$watch("branch.isCustomizable",function(){o("tab-branch-settings",n.branch)}),n.toggleBranch=function(){if(n.branch.mirror_master){n.branch.mirror_master=!1,n.branch.isCustomizable=!0;for(var r,e=n.branch.name,o=0;o<n.project.branches.length;o++)if("master"===n.project.branches[o].name){r=n.project.branches[o];break}n.branch=$.extend(!0,n.branch,r),n.branch.name=e,i(n.branch)}n.saveGeneralBranch(!0)},n.mirrorMaster=function(){n.branch.mirror_master=!0,n.branch.isCustomizable=!1,delete n.branch.really_mirror_master,n.saveGeneralBranch(!0)},n.setRunner=function(r){var e=n.runnerConfigs[r];n.branch.runner.id=r,n.branch.runner.config=e,n.saveRunner(r,e)},n.reorderPlugins=function(r){n.branch.plugins=r,t()},n.enablePlugin=function(r,e,o){removeDragEl(o.target),n.branch.plugins.splice(e,0,r),_.find(n.branch.plugins,{id:r.id}).enabled=!0;var t=n.disabled_plugins[n.branch.name];t.splice(_.indexOf(_.map(t,"id"),r.id),1),a()},n.disablePlugin=function(r,e,o){removeDragEl(o.target),n.disabled_plugins[n.branch.name].splice(e,0,r);var t=n.branch.plugins;t.splice(_.indexOf(_.map(t,"id"),r.id),1),a()},n.setImgStyle=function(r){var e,o=r.id,a=n.plugins,t=a[o];if(t){var i=t.icon;i&&(e="url('/ext/"+o+"/"+i+"')")}r.imgStyle={"background-image":e}},n.saveGeneralBranch=function(r){var e=n.branch,o=n.project,a={active:e.active,privkey:e.privkey,pubkey:e.pubkey,envKeys:e.envKeys,mirror_master:e.mirror_master,deploy_on_green:e.deploy_on_green,deploy_on_pull_request:e.deploy_on_pull_request,runner:e.runner};r&&(a.plugins=e.plugins),saveProjectConfig(a,e,o,function(r){if(r)return n.error("Error saving general config for branch "+e.name+": "+r,!0);n.success("General config for branch "+e.name+" saved.",!0)})},n.generateKeyPair=function(){bootbox.confirm("Really generate a new keypair? This could break things if you have plugins that use the current ones.",function(r){r&&$.ajax("/"+n.project.name+"/keygen/?branch="+encodeURIComponent(n.branch.name),{type:"POST",success:function(r){n.branch.privkey=r.privkey,n.branch.pubkey=r.pubkey,n.success("Generated new ssh keypair",!0)}})})},function(){n.project.branches.forEach(function(n){i(n)})}(),n.gravatar=function(n){return n?"https://secure.gravatar.com/avatar/"+md5(n.toLowerCase())+"?d=identicon":""},n.saveRunner=function(r,e){$.ajax({url:"/"+n.project.name+"/config/branch/runner/id/?branch="+encodeURIComponent(n.branch.name),data:JSON.stringify({id:r,config:e}),contentType:"application/json",type:"PUT",success:function(){n.success("Saved runner config.",!0)},error:function(e){e&&e.responseText&&n.error("Error setting runner id to "+r)}})},n.runnerConfig=function(r,e,o){2===arguments.length&&(o=e,e=r,r=n.branch);var a=n.branch.runner.id;if(arguments.length<2)return n.runnerConfigs[a];$.ajax({url:"/"+n.project.name+"/config/branch/runner/?branch="+encodeURIComponent(n.branch.name),type:"PUT",contentType:"application/json",data:JSON.stringify(e),success:function(r){n.success("Runner config saved."),n.runnerConfigs[a]=r.config,o(null,r.config),n.$root.$digest()},error:function(r,e,a){if(r&&r.responseText){var t=$.parseJSON(r.responseText);n.error("Error saving runner config: "+t.errors[0])}else n.error("Error saving runner config: "+a);o(),n.$root.$digest()}})},n.providerConfig=function(r,e){if(0===arguments.length)return n.project.provider.config;$.ajax({url:"/"+n.project.name+"/provider/",type:"POST",contentType:"application/json",data:JSON.stringify(r),success:function(){n.success("Provider config saved."),e&&e(),n.$root.$digest()},error:function(r,o,a){r&&r.responseText?n.error("Error saving provider config: "+r.responseText):n.error("Error saving provider config: "+a),e&&e(),n.$root.$digest()}})},n.pluginConfig=function(r,e,o,a){if(3===arguments.length&&(a=o,o=e,e=n.branch),1===arguments.length&&(e=n.branch),!e.mirror_master){var t=n.configs[e.name][r];if(arguments.length<3)return t.config;if(null===t)throw console.error("pluginConfig called for a plugin that's not configured. "+r,!0),new Error("Plugin not configured: "+r);$.ajax({url:"/"+n.project.name+"/config/branch/"+r+"/?branch="+encodeURIComponent(e.name),type:"PUT",contentType:"application/json",data:JSON.stringify(o),success:function(o){n.success("Config for "+r+" on branch "+e.name+" saved."),n.configs[e.name][r].config=o,a(null,o),n.$root.$digest()},error:function(o,t,i){if(o&&o.responseText){var c=$.parseJSON(o.responseText);n.error("Error saving "+r+" config on branch "+e.name+": "+c.errors[0])}else n.error("Error saving "+r+" config on branch "+e.name+": "+i);a(),n.$root.$digest()}})}},n.deleteProject=function(){$.ajax({url:"/"+n.project.name+"/",type:"DELETE",success:function(){global.location="/"},error:function(){n.deleting=!1,n.error("failed to remove project",!0)}})},n.startTest=function(r){$.ajax({url:"/"+n.project.name+"/start",data:{branch:n.branch.name,type:"TEST_ONLY",page:"config"},type:"POST",success:function(){global.location="/"+n.project.name+"/"},error:function(e){if(e&&e.responseText){var o=$.parseJSON(e.responseText);n.error("Error starting test job for "+r+" on branch "+n.branch.name+": "+o.errors[0])}}})},n.startDeploy=function(r){$.ajax({url:"/"+n.project.name+"/start",data:{branch:n.branch.name,type:"TEST_AND_DEPLOY",page:"config"},type:"POST",success:function(){global.location="/"+n.project.name+"/"},error:function(e){if(e&&e.responseText){var o=$.parseJSON(e.responseText);n.error("Error starting deploy job for "+r+" on branch "+n.branch.name+": "+o.errors[0])}}})},n.saveProject=function(){$.ajax({url:"/"+n.project.name+"/config",type:"PUT",data:JSON.stringify({public:n.project.public}),contentType:"application/json",success:function(){n.success("General config saved.",!0)},error:function(r,e,o){r&&r.responseText?n.error("Error saving general config: "+r.responseText,!0):n.error("Error saving general config: "+o,!0)}})},n.post=post}function removeDragEl(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function saveProjectConfig(n,r,e,o){$.ajax({url:"/"+e.name+"/config/branch/?branch="+encodeURIComponent(r.name),type:"PUT",data:JSON.stringify(n),contentType:"application/json",success:function(n){o(void 0,n)},error:function(n,r,e){o(n&&n.responseText||e)}})}var $=require("jquery"),_=require("lodash"),md5=require("md5"),bootbox=require("bootbox"),post=require("../../utils/post"),branches=global.branches||[],project=global.project||{},plugins=global.plugins||{},runners=global.runners||{},userIsCreator=global.userIsCreator||!1,userConfigs=global.userConfigs||{},statusBlocks=global.statusBlocks||{};module.exports=ConfigController;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../../utils/post":43,"bootbox":51,"jquery":67,"lodash":68,"md5":69}],13:[function(require,module,exports){
(function (global){
"use strict";function DeactivateController(e){e.active=e.panelData.deactivate,e.loading=!1,e.toggleActive=function(){e.active=!e.active;var r={url:e.repo.url,active:e.active};$.ajax({url:"/api/repo",type:"POST",data:r,dataType:"json",success:function(){e.success(e.active?"Activated":"Deactivated"),e.$root.$digest()},error:function(r,t,o){if(r&&r.responseText){var a=$.parseJSON(r.responseText);e.error("Error settings active state: "+a.errors[0])}else e.error("Error settings active state: "+o);e.active=!e.active,e.$root.$digest()}})},e.confirmDeleteProject=function(){bootbox.confirm("<h2>Really Delete Project Data?</h2><p>This will remove all configuration and history for this project. You can always re-add it on the /projects page</p>","Just kidding","Yes, really",function(r){r&&$.ajax({url:"/api/repo",type:"DELETE",data:{url:e.repo.url},success:function(){e.success("Project removed."),e.$root.$digest(),setTimeout(function(){global.location="/"},500)},error:function(r,t,o){if(r&&r.responseText){var a=$.parseJSON(r.responseText);e.error("Error deleting project: "+a.errors[0])}else e.error("Error deleting project: "+o);e.$root.$digest()}})})}}var $=require("jquery"),bootbox=require("bootbox");module.exports=DeactivateController;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"bootbox":51,"jquery":67}],14:[function(require,module,exports){
"use strict";function GithubController(o){o.removeWebhooks=function(){bootbox.confirm('<h2>Really remove the github webhooks?</h2> <p>If you only want to temporarily disable build on commit, go to the "Deactivate" tab',"Just kidding","Yes, really",function(e){e&&(o.info("Deleting webhooks..."),$.ajax("/api/github/webhooks/unset",{data:{url:o.repo.url},dataType:"json",error:function(){o.error("Error removing webhooks."),o.$root.$digest()},success:function(){o.success("Webhooks removed."),o.$root.$digest()},type:"POST"}))})}}var $=require("jquery"),bootbox=require("bootbox");module.exports=GithubController;
},{"bootbox":51,"jquery":67}],15:[function(require,module,exports){
"use strict";function HerokuController(e){e.heroku=e.panelData.heroku,e.deploy_on_green=!e.repo.prod_deploy_target||e.repo.prod_deploy_target.deploy_on_green,e.status=e.heroku?"configured":"unconfigured",e.heroku_apps=["@@new@@"],e.which_app="@@new@@",e.apikey="",e.goBack=function(){e.status="unconfigured"},e.checkApi=function(){e.loading=!0,$.ajax("/api/heroku/account_integration",{data:{api_key:e.apikey},dataType:"json",error:function(){e.error("Heroku API key invalid"),e.loading=!1,e.$root.$digest()},success:function(o){e.success("Heroku connected"),e.apikey=o.api_key,e.heroku_apps=o.heroku_apps,e.which_app="@@new@@",e.account_id=o.account_id,e.status="have-api",e.loading=!1,e.$root.$digest()},type:"POST"})},e.herokuSelect=function(){var o=e.which_app;"@@new@@"===o&&(o=e.new_app_name),e.loading=!0,$.ajax("/api/heroku/delivery_integration",{data:{account_id:e.account_id,gh_repo_url:e.repo.url,app_name:o},dataType:"json",error:function(o){var r=$.parseJSON(o.responseText);e.error("Error: "+r.errors[0]),e.loading=!1,e.$root.$digest()},success:function(){e.success("Heroku continuous deployment integration complete."),e.deploy_on_green=!0,e.which_app="@@new@@",e.new_app_name="",e.heroku={app:o},e.status="configured",e.loading=!1,e.$root.$digest()},type:"POST"})},e.toggleDeploy=function(){e.deploy_on_green=!e.deploy_on_green,e.loading=!0,$.ajax("/api/heroku/config",{data:{url:e.repo.url,deploy_on_green:e.deploy_on_green},error:function(){e.error("Error toggling deploy on green."),e.deploy_on_green=!e.deploy_on_green,e.loading=!1,e.$root.$digest()},success:function(){e.success("Deploy on Green "+(e.deploy_on_green?"enabled":"disabled")),e.loading=!1,e.$root.$digest()},type:"POST"})},e.removeHeroku=function(){$.ajax("/api/heroku/config",{data:{url:e.repo.url,unset_heroku:1},error:function(){e.error("Error removing Heroku config."),e.loading=!1,e.$root.$digest()},success:function(){e.success("Removed Heroku config."),e.status="unconfigured",e.loading=!1,e.$root.$digest()},type:"POST"})}}var $=require("jquery");module.exports=HerokuController;
},{"jquery":67}],16:[function(require,module,exports){
"use strict";function JobController(n,i){var o=i.attr("id").split("-").slice(1).join("-");n.saving=!1,n.$watch('userConfigs["'+o+'"]',function(i){n.userConfig=i}),n.$watch('configs[branch.name]["'+o+'"].config',function(i){n.config=i}),n.save=function(){n.saving=!0,n.pluginConfig(o,n.config,function(){n.saving=!1})}}module.exports=JobController;
},{}],17:[function(require,module,exports){
"use strict";function ProviderController(o){o.config=o.providerConfig(),o.saving=!1,o.save=function(){o.saving=!0,o.providerConfig(o.config,function(){o.saving=!1})}}module.exports=ProviderController;
},{}],18:[function(require,module,exports){
"use strict";function RunnerController(n,i){var o=i.attr("id").split("-").slice(1).join("-");n.saving=!1,n.$watch('runnerConfigs[branch.name]["'+o+'"]',function(i){n.config=i}),n.save=function(){n.saving=!0,n.runnerConfig(n.config,function(){n.saving=!1})}}module.exports=RunnerController;
},{}],19:[function(require,module,exports){
"use strict";var angular=require("angular"),RunnerController=require("./controllers/runner"),ProviderController=require("./controllers/provider"),JobController=require("./controllers/job"),ConfigController=require("./controllers/config"),BranchesController=require("./controllers/branches"),CollaboratorsController=require("./controllers/collaborators"),DeactivateController=require("./controllers/deactivate"),HerokuController=require("./controllers/heroku"),GithubController=require("./controllers/github"),interpolate=require("../utils/interpolate"),ngSortableDirective=require("../utils/ng-sortable-directive"),app=angular.module("config",["ui.bootstrap","ui.codemirror","alerts","moment"]).config(["$interpolateProvider",interpolate]).controller("Config",["$scope",ConfigController]).controller("Config.RunnerController",["$scope","$element",RunnerController]).controller("Config.ProviderController",["$scope",ProviderController]).controller("Config.JobController",["$scope","$element",JobController]).controller("BranchesCtrl",["$scope",BranchesController]).controller("CollaboratorsCtrl",["$scope",CollaboratorsController]).controller("DeactivateCtrl",["$scope",DeactivateController]).controller("HerokuController",["$scope",HerokuController]).controller("GithubCtrl",["$scope",GithubController]).directive("ngSortable",["$parse",ngSortableDirective]).directive("repeatEnd",function(){return function(r,e,o){r.$last&&r.$parent.finishedRepeat&&r.$parent.finishedRepeat(o)}});module.exports=app;
},{"../utils/interpolate":38,"../utils/ng-sortable-directive":41,"./controllers/branches":10,"./controllers/collaborators":11,"./controllers/config":12,"./controllers/deactivate":13,"./controllers/github":14,"./controllers/heroku":15,"./controllers/job":16,"./controllers/provider":17,"./controllers/runner":18,"angular":57}],20:[function(require,module,exports){
(function (global){
"use strict";function determineTargetBranch(e){return e.ref?e.ref.branch:"master"}function cleanJob(e){delete e.phases,delete e.std,delete e.stdout,delete e.stderr,delete e.stdmerged,delete e.plugin_data}function Dashboard(e,t){JobMonitor.call(this,e,t.$digest.bind(t)),this.scope=t,this.scope.loadingJobs=!1,this.scope.jobs=global.jobs}var $=require("jquery"),_=require("lodash"),io=require("socket.io-client"),JobMonitor=require("../../utils/job-monitor"),statusClasses=require("../../utils/status-classes");module.exports=function(e){var t=io.connect();new Dashboard(t,e),e.statusClasses=statusClasses,e.providers=global.providers,e.phases=["environment","prepare","test","deploy","cleanup"],$("#dashboard").show(),e.startDeploy=function(e){$(".tooltip").hide();var o=determineTargetBranch(e);t.emit("deploy",e.project.name,o)},e.startTest=function(e){$(".tooltip").hide();var o=determineTargetBranch(e);t.emit("test",e.project.name,o)},e.cancelJob=function(e){t.emit("cancel",e)}},_.extend(Dashboard.prototype,JobMonitor.prototype,{job:function(e,t){for(var o=this.scope.jobs[t],s=0;s<o.length;s++)if(o[s]._id===e)return o[s]},addJob:function(e,t){for(var o=this.scope.jobs[t],s=-1,r=0;r<o.length;r++)if(o[r].project.name===e.project.name){s=r;break}if(-1!==s){var a=o.splice(s,1)[0];e.project.prev=a.project.prev}e.phases&&cleanJob(e),e.phase="environment",o.unshift(e)}}),Dashboard.prototype.statuses["phase.done"]=function(e){this.phase=e.next};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../../utils/job-monitor":40,"../../utils/status-classes":45,"jquery":67,"lodash":68,"socket.io-client":71}],21:[function(require,module,exports){
"use strict";var angular=require("angular"),interpolate=require("../utils/interpolate"),DashboardController=require("./controllers/dashboard"),app=angular.module("dashboard",["moment"]).config(["$interpolateProvider",interpolate]).controller("Dashboard",["$scope",DashboardController]);module.exports=app;
},{"../utils/interpolate":38,"./controllers/dashboard":20,"angular":57}],22:[function(require,module,exports){
"use strict";module.exports=function(t,e){var l={controller:"JobCtrl",templateUrl:"build-tpl.html"},o={"/":l,"/job/latest":l,"/job/:id":l};Object.keys(o).forEach(function(t){e.when(t,o[t])}),t.html5Mode(!0)};
},{}],23:[function(require,module,exports){
(function (global){
"use strict";function BuildPage(e,o,t,s,a,n){JobDataMonitor.call(this,e,t),this.scope=s,this.project=o,this.jobs={},this.jobs[n._id]=n}function setFavicon(e){$('link[rel*="icon"]').attr("href","/images/icons/favicon-"+e+".png")}function animateFav(){function e(){setFavicon("running"+(o?"-alt":"")),o=!o}var o=!1;return setInterval(e,500)}function updateFavicon(e){"running"===e?null===runtime&&(runtime=animateFav()):(null!==runtime&&(clearInterval(runtime),runtime=null),setFavicon(e))}function buildSwitcher(e){function o(o){var t,s={40:1,38:-1}[o.keyCode],a=e.job._id;if(s){for(var n=0;n<e.jobs.length;n++)if(e.jobs[n]._id===a){t=n;break}if(-1===t)return console.log("Failed to find job."),global.location=global.location;t+=s,t<0||t>=e.jobs.length||(o.preventDefault(),e.selectJob(e.jobs[t]._id),e.$root.$digest())}}global.document.addEventListener("keydown",o)}var _=require("lodash"),bootbox=require("bootbox"),$=require("jquery"),io=require("socket.io-client"),JobDataMonitor=require("../../utils/job-data-monitor"),PHASES=require("../../utils/phases"),SKELS=require("../../utils/skels"),statusClasses=require("../../utils/status-classes"),outputConsole,runtime=null,job=global.job;module.exports=function(e,o,t,s){function a(t){if(global.location.pathname.match(/\/config$/))return void(global.location=global.location);if(n=o.current.params,n.id||(n.id=e.jobs[0]._id),o.current=c,l!==n.id||t){l=n.id;if(!p.get(l,function(o,t,s){t.phases.environment&&(t.phases.environment.collapsed=!0),t.phases.prepare&&(t.phases.prepare.collapsed=!0),t.phases.cleanup&&(t.phases.cleanup.collapsed=!0),e.job=t,e.job.phases.test.commands.length&&(e.job.phases.environment.collapsed=!0,e.job.phases.prepare.collapsed=!0,e.job.phases.cleanup.collapsed=!0),s||e.$digest()}))for(var s=0;s<e.jobs.length;s++)if(e.jobs[s]._id===l){e.job=e.jobs[s];break}}}var n=o.current?o.current.params:{},i=global.project,l=n.id||global.job&&global.job._id,r=io.connect(),c=o.current,p=new BuildPage(r,i.name,e.$digest.bind(e),e,global.jobs,global.job);outputConsole=global.document.querySelector(".console-output"),e.statusClasses=statusClasses,e.phases=["environment","prepare","test","deploy","cleanup"],e.project=i,e.jobs=global.jobs,e.job=global.job,e.canAdminProject=global.canAdminProject,e.showStatus=global.showStatus,e.job&&e.job.phases.test.commands.length&&(job.phases.environment&&(job.phases.environment.collapsed=!0),job.phases.prepare&&(job.phases.prepare.collapsed=!0),job.phases.cleanup&&(job.phases.cleanup.collapsed=!0)),e.toggleErrorDetails=function(){e.showErrorDetails=!e.showErrorDetails},e.clearCache=function(){e.clearingCache=!0,$.ajax("/"+e.project.name+"/cache/"+e.job.ref.branch,{type:"DELETE",success:function(){e.clearingCache=!1,e.$digest()},error:function(){e.clearingCache=!1,e.$digest(),bootbox.alert("Failed to clear the cache")}})},e.$on("$locationChangeSuccess",a),a(!0),e.triggers={commit:{icon:"code-fork",title:"Commit"},manual:{icon:"hand-o-right",title:"Manual"},plugin:{icon:"puzzle-piece",title:"Plugin"},api:{icon:"cloud",title:"Cloud"}},e.page="build",e.selectJob=function(e){t.path("/job/"+e).replace()},e.$watch("job.status",function(e){updateFavicon(e)}),buildSwitcher(e),e.$watch("job.std.merged_latest",function(e){var o=s("ansi");$(".job-output").last().append(o(e)),outputConsole.scrollTop=outputConsole.scrollHeight,setTimeout(function(){outputConsole.scrollTop=outputConsole.scrollHeight},10)}),e.startDeploy=function(o){$(".tooltip").hide(),r.emit("deploy",i.name,o&&o.ref.branch),e.job={project:e.job.project,status:"submitted"}},e.startTest=function(o){$(".tooltip").hide(),r.emit("test",i.name,o&&o.ref.branch),e.job={project:e.job.project,status:"submitted"}},e.restartJob=function(e){r.emit("restart",e)},e.cancelJob=function(e){r.emit("cancel",e)}},_.extend(BuildPage.prototype,JobDataMonitor.prototype,{emits:{getUnknown:"build:job"},job:function(e){return this.jobs[e]},addJob:function(e){if((e.project.name||e.project)===this.project){this.jobs[e._id]=e;for(var o=-1,t=0;t<this.scope.jobs.length;t++)if(this.scope.jobs[t]._id===e._id){o=t;break}if(-1!==o&&this.scope.jobs.splice(o,1),e.phase||(e.phase="environment"),e.std||(e.std={out:"",err:"",merged:""}),e.phases)e.phases.test.commands.length&&(e.phases.environment&&(e.phases.environment.collapsed=!0),e.phases.prepare&&(e.phases.prepare.collapsed=!0),e.phases.cleanup&&(e.phases.cleanup.collapsed=!0));else{for(e.phases={},t=0;t<PHASES.length;t++)e.phases[PHASES[t]]=_.cloneDeep(SKELS.phase);e.phases[e.phase].started=new Date}this.scope.jobs.unshift(e),this.scope.job=e}},get:function(e,o){if(this.jobs[e])return o(null,this.jobs[e],!0),!0;var t=this;this.sock.emit("build:job",e,function(s){t.jobs[e]=s,o(null,s)})}});
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../../utils/job-data-monitor":39,"../../utils/phases":42,"../../utils/skels":44,"../../utils/status-classes":45,"bootbox":51,"jquery":67,"lodash":68,"socket.io-client":71}],24:[function(require,module,exports){
"use strict";module.exports=function(){return{restrict:"A",scope:{},link:function(t,n,a){t.$parent.$watch('job.plugin_data["'+a.pluginStatus+'"]',function(n){t.data=n}),t.$parent.$watch('showStatus[job.ref.branch]["'+a.pluginStatus+'"]',function(n){t.show=n}),t.$parent.$watch("job",function(n){t.job=n})}}};
},{}],25:[function(require,module,exports){
"use strict";var angular=require("angular"),routes=require("./configs/routes.js"),pluginStatus=require("./directives/plugin-status"),JobController=require("./controllers/job"),interpolate=require("../utils/interpolate"),app=angular.module("job-status",["moment","ansi","ngRoute"]).config(["$interpolateProvider",interpolate]).config(["$locationProvider","$routeProvider",routes]).controller("JobCtrl",["$scope","$route","$location","$filter",JobController]).directive("pluginStatus",pluginStatus);module.exports=app;
},{"../utils/interpolate":38,"./configs/routes.js":22,"./controllers/job":23,"./directives/plugin-status":24,"angular":57}],26:[function(require,module,exports){
"use strict";module.exports=function(){return{restrict:"A",link:function(t,n,r){var i=r.rawHtml;t.$watch(i,function(t){n[0].innerHTML=t||""})}}};
},{}],27:[function(require,module,exports){
"use strict";function since(t,e){function i(){var t=(new Date).getTime();textDuration(t-n,e,!0)}var n=new Date(t).getTime();return i(),setInterval(i,500)}var $=require("jquery"),textDuration=require("../utils/text-duration");module.exports=function(){return{restrict:"E",link:function(t,e,i){if(void 0!==i.since&&!i.duration){var n=since(i.since,e);return $(e).tooltip({title:"Started "+new Date(i.since).toLocaleString()}),i.$observe("since",function(){$(e).tooltip({title:"Started "+new Date(i.since).toLocaleString()}),clearInterval(n),n=since(i.since,e)}),t.$on("$destroy",function(){clearInterval(n)})}var o;if(void 0!==i.datetime&&(o=new Date(i.datetime),$(e).tooltip({title:o.toLocaleString()})),void 0!==i.duration)return i.$observe("duration",function(){textDuration(i.duration,e)}),textDuration(i.duration,e);i.$observe("datetime",function(){o=new Date(i.datetime),$(e).tooltip({title:o.toLocaleString()}),$(e).text($.timeago(o))}),$(e).text($.timeago(o)),setTimeout(function(){$(e).timeago()},0)}}};
},{"../utils/text-duration":31,"jquery":67}],28:[function(require,module,exports){
"use strict";var $=require("jquery");module.exports=function(){return{restrict:"A",link:function(t,o,i){"tooltip"===i.toggle&&(setTimeout(function(){$(o).tooltip()},0),i.$observe("title",function(){$(o).tooltip()}),t.$on("$destroy",function(){$(".tooltip").hide(),$(o).tooltip("hide")}))}}};
},{"jquery":67}],29:[function(require,module,exports){
"use strict";module.exports=function(){return function(r,t){if(!r&&0!==parseInt(r))return"";var e=Math.pow(10,t||1);return parseInt(parseFloat(r)*e,10)/e+"%"}};
},{}],30:[function(require,module,exports){
"use strict";var $=require("jquery"),angular=require("angular"),time=require("./directives/time"),toggle=require("./directives/toggle"),rawHtml=require("./directives/raw-html"),percentage=require("./filters/percentage");require("timeago"),$.timeago.settings.strings.hour="an hour",$.timeago.settings.strings.hours="%d hours",$.timeago.settings.localeTitle=!0;var app=angular.module("moment",[]).directive("time",time).directive("toggle",toggle).directive("rawHtml",rawHtml).filter("percentage",percentage);module.exports=app;
},{"./directives/raw-html":26,"./directives/time":27,"./directives/toggle":28,"./filters/percentage":29,"angular":57,"jquery":67,"timeago":53}],31:[function(require,module,exports){
"use strict";var $=require("jquery"),time_units=[{ms:36e5,cls:"hours",suffix:"h"},{ms:6e4,cls:"minutes",suffix:"m"},{ms:1e3,cls:"seconds",suffix:"s"},{ms:0,cls:"miliseconds",suffix:"ms"}];module.exports=function(s,i,t){if(!s)return $(i).text("");for(var e="",m=0;m<time_units.length;m++)if(!(s<time_units[m].ms)){e=time_units[m].cls;var u=""+s;time_units[m].ms&&(u=t?parseInt(s/time_units[m].ms):parseInt(s/time_units[m].ms*10)/10),u+=time_units[m].suffix;break}$(i).addClass(e).text(u)};
},{"jquery":67}],32:[function(require,module,exports){
(function (global){
"use strict";var plugins=global.plugins||[];module.exports=function(){this.busy=!1,this.hasUpgrades=function(){for(var t in plugins){if(plugins[t].outdated)return!0}return!1}(),this.upgradeAll=function(){this.busy=!0;var t=0,s=[];for(var i in plugins){var n=plugins[i];n.outdated&&s.push(n)}var u=function(i){if(i<s.length){s[i].controller.upgrade(function(n){if(n)return global.alert("Batch upgrade aborted due to error:\n"+n.message);++t,u(i+1),t===s.length&&(this.busy=!1,this.hasUpgrades=!1)}.bind(this))}}.bind(this);u(0)},this.uninstall=function(t){this.busy=!0,t.uninstall(function(s){s&&global.alert(s.message),plugins[t.id].installed=!1,delete plugins[t.id].outdated,this.busy=!1}.bind(this))},this.install=function(t){this.busy=!0,t.install(function(t){t&&global.alert(t.message),this.busy=!1}.bind(this))},this.upgrade=function(t){this.busy=!0,t.upgrade(function(t){t&&global.alert(t.message),this.busy=!1}.bind(this))}};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],33:[function(require,module,exports){
(function (global){
"use strict";var plugins=global.plugins||{};module.exports=function(i,t){function s(t){i.head("/").success(function(){t()}).error(function(){s(t)})}this.idle=!0,this.status="idle",this.loadPlugin=function(i){this.id=i,this.plugin=plugins[i],this.plugin.controller=this;for(var t in this.plugin)this[t]=this.plugin[t];this.pluginLoaded=!0},this.upgrade=function(i){this.perform("upgrade",function(t){if(t)return i(t);this.installed=!0,this.outdated=!1,this.installedVersion=this.latestVersion,i()}.bind(this))},this.install=function(i){this.perform("install",function(t){if(t)return i(t);this.installed=!0,this.installedVersion=this.latestVersion,i()}.bind(this))},this.uninstall=function(i){this.perform("uninstall",function(t){if(t)return i(t);this.installed=!1,this.installedVersion="no",i()}.bind(this))},this.perform=function(n,l){return this.status="Installing "+this.id,this.idle=!1,i.put("/admin/plugins",{action:n,id:this.id}).success(function(){this.status="Restarting",t(function(){s(function(){this.status="Done",this.idle=!0,l()}.bind(this))}.bind(this),2e3)}.bind(this)).error(function(i){this.idle=!0,l(new Error(i))}.bind(this))}};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],34:[function(require,module,exports){
"use strict";var angular=require("angular"),PluginController=require("./controllers/plugin"),PluginTableController=require("./controllers/plugin-table"),interpolate=require("../utils/interpolate"),app=angular.module("plugin-manager",[]).config(["$interpolateProvider",interpolate]).controller("PluginController",["$http","$timeout",PluginController]).controller("PluginTableController",PluginTableController);module.exports=app;
},{"../utils/interpolate":38,"./controllers/plugin":33,"./controllers/plugin-table":32,"angular":57}],35:[function(require,module,exports){
(function (global){
"use strict";function validName(e){return!!e.match(/[\w-]+\/[\w-]+/)}var $=require("jquery");module.exports=function(e,r){var a=r.id.split("-")[1];e.config={},e.projects=global.manualProjects[a]||[],e.remove=function(r){r.really_remove="removing",$.ajax("/"+r.name+"/",{type:"DELETE",success:function(){e.projects.splice(e.projects.indexOf(r),1),e.success("Project removed",!0)},error:function(){e.error("Failed to remove project",!0)}})},e.create=function(){var r=e.display_name.toLowerCase();validName(r)&&$.ajax("/"+r+"/",{type:"PUT",contentType:"application/json",data:JSON.stringify({display_name:e.display_name,display_url:e.display_url,public:e.public,provider:{id:a,config:e.config}}),success:function(){e.projects.push({display_name:e.display_name,name:e.display_name.replace(/ /g,"-").toLowerCase(),display_url:e.display_url,provider:{id:a,config:e.config}}),e.config={},e.display_name="",e.display_url="",e.success("Created project!",!0)},error:function(){e.error("failed to create project",!0)}})}};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"jquery":67}],36:[function(require,module,exports){
(function (global){
"use strict";var $=require("jquery");module.exports=function(e){setTimeout(function(){"#manual"===global.location.hash&&$('a[href="#manual-setup"]').tab("show")},200),e.accounts=global.accounts,e.repos=global.repos,e.providers=global.providers,e.projectsPage=!0,e.toggleAdd=function(e){e.adding="pick-type"},e.toggleAddCancel=function(e){e.adding=!1},e.toggleRemove=function(e){e.really_remove=!0},e.toggleRemoveCancel=function(e){e.really_remove=!1},e.removeProject=function(r,o,t){o.really_remove="removing",o.adding=!1,$.ajax("/"+o.project.name+"/",{type:"DELETE",success:function(){o.project=null,o.really_remove=!1,t.configured--,e.$digest()},error:function(r,t,n){o.really_remove=!1,r&&r.responseText?e.error("Error removing project for repo "+o.name+": "+r.responseText,!0):e.error("Error removing project for repo "+o.name+": "+n,!0)}})},e.setupProject=function(r,o,t,n){o.lastError="",$.ajax("/"+o.name+"/",{type:"PUT",contentType:"application/json",data:JSON.stringify({display_name:o.display_name||o.name,display_url:o.display_url,project_type:t,provider:{id:r.provider,account:r.id,repo_id:o.id,config:o.config}}),success:function(r){o.project=r.project,o.adding="done",n.configured++,e.$digest()},error:function(r,t,n){var a=void 0;a=r&&r.responseText?"Error creating project for repo "+o.name+": "+r.responseText:"Error creating project for repo "+o.name+": "+n,e.error(a,!0),o.lastError=a,o.adding=""}})},e.startTest=function(r){$.ajax("/"+r.project.name+"/start",{type:"POST",success:function(){r.adding=!1,e.success("Test started for "+r.project.name+'. <a href="/'+r.project.name+'/">Click to watch it run</a>',!0,!0)},error:function(o,t,n){o&&o.responseText?e.error("Error starting test for project "+r.project.name+": "+o.responseText,!0):e.error("Error starting test for project "+r.project.name+": "+n,!0)}})}};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"jquery":67}],37:[function(require,module,exports){
"use strict";var angular=require("angular"),interpolate=require("../utils/interpolate"),ManualController=require("./controllers/manual"),ProjectsController=require("./controllers/projects"),app=angular.module("projects",["alerts","moment","ui.bootstrap.buttons"]).config(["$interpolateProvider",interpolate]).controller("ManualController",["$scope","$attrs",ManualController]).controller("ProjectsController",["$scope",ProjectsController]);module.exports=app;
},{"../utils/interpolate":38,"./controllers/manual":35,"./controllers/projects":36,"angular":57}],38:[function(require,module,exports){
"use strict";module.exports=function(t){t.startSymbol("[["),t.endSymbol("]]")};
},{}],39:[function(require,module,exports){
"use strict";function JobDataMonitor(){JobMonitor.apply(this,arguments)}function ensureCommand(e){var t=e.commands[e.commands.length-1];return t&&void 0===t.finished||(t=_.extend({},SKELS.command),e.commands.push(t)),t}var _=require("lodash"),JobMonitor=require("./job-monitor"),SKELS=require("./skels");_.extend(JobDataMonitor.prototype,JobMonitor.prototype,{}),JobDataMonitor.prototype.statuses=_.extend({},JobMonitor.prototype.statuses,{"phase.done":function(e){this.phases[e.phase].finished=e.time,this.phases[e.phase].duration=e.elapsed,this.phases[e.phase].exitCode=e.code,-1!==["prepare","environment","cleanup"].indexOf(e.phase)&&(this.phases[e.phase].collapsed=!0),"test"===e.phase&&(this.test_status=e.code),"deploy"===e.phase&&(this.deploy_status=e.code),e.next&&this.phases[e.next]&&(this.phase=e.next,this.phases[e.next].started=e.time)},"command.comment":function(e){var t=this.phases[this.phase],s=_.extend({},SKELS.command);s.command=e.comment,s.comment=!0,s.plugin=e.plugin,s.finished=e.time,t.commands.push(s)},"command.start":function(e){var t=this.phases[this.phase],s=_.extend({},SKELS.command,e);s.started=e.time,t.commands.push(s)},"command.done":function(e){var t=this.phases[this.phase],s=t.commands[t.commands.length-1];s.finished=e.time,s.duration=e.elapsed,s.exitCode=e.exitCode,s.merged=s._merged},stdout:function(e){var t=ensureCommand(this.phases[this.phase]);t.out+=e,t._merged+=e,this.std.out+=e,this.std.merged+=e,this.std.merged_latest=e},stderr:function(e){var t=ensureCommand(this.phases[this.phase]);t.err+=e,t._merged+=e,this.std.err+=e,this.std.merged+=e,this.std.merged_latest=e}}),module.exports=JobDataMonitor;
},{"./job-monitor":40,"./skels":44,"lodash":68}],40:[function(require,module,exports){
"use strict";function JobMonitor(t,n){this.sock=t,this.changed=n,this.waiting={},this.listen()}var _=require("lodash"),PHASES=require("./phases");JobMonitor.prototype={emits:{getUnknown:"dashboard:unknown"},events:{"job.new":function(t,n){this.addJob(t[0],n),this.changed()},"job.done":function(t,n){this.addJob(t[0],n),this.changed()}},job:function(){throw new Error("You must override this")},addJob:function(){throw new Error("You must implement")},listen:function(){var t;for(var n in this.events)t=this.events[n],"string"==typeof t&&(t=this[t]),this.sock.on(n,t.bind(this));for(var i in this.statuses)this.sock.on("job.status."+i,this.update.bind(this,i))},update:function(t,n,i,s){var e=n.shift(),o=this.job(e,i),a=this.statuses[t];if(!o)return this.unknown(e,t,n,i);a&&("string"==typeof a?o.status=a:a.apply(o,n),s||this.changed())},unknown:function(t,n,i,s){if(i=[t].concat(i),this.waiting[t])return this.waiting[t].push([n,i,s]);this.waiting[t]=[[n,i,s]],this.sock.emit(this.emits.getUnknown,t,this.gotUnknown.bind(this))},gotUnknown:function(t){if(!this.waiting[t._id])return console.warn("Got unknownjob:response but wan't waiting for it..."