codebuild 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +10 -2
- data/docs/.gitignore +4 -0
- data/docs/CNAME +1 -0
- data/docs/Gemfile +3 -0
- data/docs/LICENSE +21 -0
- data/docs/README.md +25 -0
- data/docs/_config.yml +73 -0
- data/docs/_docs/contributing.md +99 -0
- data/docs/_docs/conventions.md +51 -0
- data/docs/_docs/deploy.md +69 -0
- data/docs/_docs/dsl.md +12 -0
- data/docs/_docs/dsl/project.md +80 -0
- data/docs/{dsl → _docs/dsl}/role.md +39 -1
- data/docs/_docs/dsl/schedule.md +29 -0
- data/docs/_docs/examples.md +12 -0
- data/docs/_docs/examples/ecs.md +94 -0
- data/docs/_docs/examples/jets.md +68 -0
- data/docs/_docs/examples/ruby.md +44 -0
- data/docs/_docs/github_oauth.md +51 -0
- data/docs/_docs/install.md +14 -0
- data/docs/_docs/next-steps.md +16 -0
- data/docs/_docs/settings.md +34 -0
- data/docs/_docs/start.md +46 -0
- data/docs/_docs/type-option.md +72 -0
- data/docs/_docs/variables.md +90 -0
- data/docs/_includes/commands.html +86 -0
- data/docs/_includes/content.html +25 -0
- data/docs/_includes/edit-on-github.html +9 -0
- data/docs/_includes/footer.html +41 -0
- data/docs/_includes/google_analytics.html +10 -0
- data/docs/_includes/head.html +45 -0
- data/docs/_includes/js.html +18 -0
- data/docs/_includes/nav.html +17 -0
- data/docs/_includes/prev_next.md +19 -0
- data/docs/_includes/reference.md +1 -0
- data/docs/_includes/subnav.html +38 -0
- data/docs/_includes/tutorials.md +38 -0
- data/docs/_layouts/default.html +12 -0
- data/docs/_reference/codebuild-completion.md +44 -0
- data/docs/_reference/codebuild-completion_script.md +25 -0
- data/docs/_reference/codebuild-delete.md +26 -0
- data/docs/_reference/codebuild-deploy.md +58 -0
- data/docs/_reference/codebuild-init.md +87 -0
- data/docs/_reference/codebuild-start.md +43 -0
- data/docs/_reference/codebuild-version.md +21 -0
- data/docs/_sass/_bootstrap-overrides.scss +40 -0
- data/docs/_sass/_contact.scss +49 -0
- data/docs/_sass/_cta.scss +37 -0
- data/docs/_sass/_download.scss +31 -0
- data/docs/_sass/_features.scss +47 -0
- data/docs/_sass/_footer.scss +49 -0
- data/docs/_sass/_global.scss +102 -0
- data/docs/_sass/_main.scss +364 -0
- data/docs/_sass/_masthead.scss +70 -0
- data/docs/_sass/_mixins.scss +79 -0
- data/docs/_sass/_navbar.scss +92 -0
- data/docs/_sass/_syntax.scss +65 -0
- data/docs/_sass/_table.scss +34 -0
- data/docs/_sass/_timeline.scss +207 -0
- data/docs/_sass/_variables.scss +24 -0
- data/docs/bin/web +8 -0
- data/docs/docs.md +22 -0
- data/docs/favicon.ico +0 -0
- data/docs/img/docs/codebuild-output.png +0 -0
- data/docs/img/logos/boltops-logo-full.png +0 -0
- data/docs/img/logos/boltops-logo.png +0 -0
- data/docs/img/logos/project-logo.png +0 -0
- data/docs/index.html +35 -0
- data/docs/js/nav.js +39 -0
- data/docs/js/new-age.js +38 -0
- data/docs/js/new-age.min.js +6 -0
- data/docs/new-age.scss +20 -0
- data/docs/quick-start.md +72 -0
- data/docs/reference.md +12 -0
- data/docs/support.md +22 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css +1339 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css +459 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.css +9320 -0
- data/docs/vendor/bootstrap/css/bootstrap.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css +6 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.js +3535 -0
- data/docs/vendor/bootstrap/js/bootstrap.min.js +7 -0
- data/docs/vendor/font-awesome/css/font-awesome.css +2337 -0
- data/docs/vendor/font-awesome/css/font-awesome.min.css +4 -0
- data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/docs/vendor/font-awesome/less/animated.less +34 -0
- data/docs/vendor/font-awesome/less/bordered-pulled.less +25 -0
- data/docs/vendor/font-awesome/less/core.less +12 -0
- data/docs/vendor/font-awesome/less/fixed-width.less +6 -0
- data/docs/vendor/font-awesome/less/font-awesome.less +18 -0
- data/docs/vendor/font-awesome/less/icons.less +789 -0
- data/docs/vendor/font-awesome/less/larger.less +13 -0
- data/docs/vendor/font-awesome/less/list.less +19 -0
- data/docs/vendor/font-awesome/less/mixins.less +60 -0
- data/docs/vendor/font-awesome/less/path.less +15 -0
- data/docs/vendor/font-awesome/less/rotated-flipped.less +20 -0
- data/docs/vendor/font-awesome/less/screen-reader.less +5 -0
- data/docs/vendor/font-awesome/less/stacked.less +20 -0
- data/docs/vendor/font-awesome/less/variables.less +799 -0
- data/docs/vendor/font-awesome/scss/_animated.scss +34 -0
- data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +25 -0
- data/docs/vendor/font-awesome/scss/_core.scss +12 -0
- data/docs/vendor/font-awesome/scss/_fixed-width.scss +6 -0
- data/docs/vendor/font-awesome/scss/_icons.scss +789 -0
- data/docs/vendor/font-awesome/scss/_larger.scss +13 -0
- data/docs/vendor/font-awesome/scss/_list.scss +19 -0
- data/docs/vendor/font-awesome/scss/_mixins.scss +60 -0
- data/docs/vendor/font-awesome/scss/_path.scss +15 -0
- data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +20 -0
- data/docs/vendor/font-awesome/scss/_screen-reader.scss +5 -0
- data/docs/vendor/font-awesome/scss/_stacked.scss +20 -0
- data/docs/vendor/font-awesome/scss/_variables.scss +799 -0
- data/docs/vendor/font-awesome/scss/font-awesome.scss +18 -0
- data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +59 -0
- data/docs/vendor/jquery-easing/jquery.easing.js +166 -0
- data/docs/vendor/jquery-easing/jquery.easing.min.js +1 -0
- data/docs/vendor/jquery/jquery.js +10253 -0
- data/docs/vendor/jquery/jquery.min.js +4 -0
- data/docs/vendor/simple-line-icons/css/simple-line-icons.css +778 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +200 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
- data/docs/vendor/simple-line-icons/less/simple-line-icons.less +982 -0
- data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +979 -0
- data/docs/vendor/tether/tether.js +1811 -0
- data/docs/vendor/tether/tether.min.js +1 -0
- data/exe/cb +1 -1
- data/exe/codebuild +1 -1
- data/lib/codebuild.rb +0 -1
- data/lib/codebuild/aws_services/helpers.rb +1 -1
- data/lib/codebuild/cli.rb +2 -1
- data/lib/codebuild/core.rb +2 -2
- data/lib/codebuild/dsl/project.rb +3 -3
- data/lib/codebuild/help/init.md +38 -2
- data/lib/codebuild/help/start.md +7 -1
- data/lib/codebuild/init.rb +19 -9
- data/lib/codebuild/project.rb +3 -2
- data/lib/codebuild/role.rb +2 -0
- data/lib/codebuild/schedule.rb +5 -0
- data/lib/codebuild/setting.rb +2 -3
- data/lib/codebuild/stack.rb +25 -0
- data/lib/codebuild/start.rb +22 -3
- data/lib/codebuild/variables.rb +17 -0
- data/lib/codebuild/version.rb +1 -1
- data/lib/template/{.codebuild → project}/buildspec.yml +7 -7
- data/lib/template/{.codebuild → project}/project.rb.tt +8 -0
- data/lib/template/{.codebuild → project}/role.rb +0 -0
- data/lib/template/project/schedule.rb +3 -0
- data/lib/template/top/settings.yml +9 -0
- data/lib/template/top/variables/base.rb +1 -0
- data/lib/template/top/variables/development.rb +1 -0
- data/lib/template/top/variables/production.rb +1 -0
- metadata +150 -11
- data/docs/dsl/project.md +0 -46
- data/docs/dsl/schedule.md +0 -12
- data/docs/github_oauth.md +0 -39
- data/docs/type.md +0 -39
- data/lib/template/.codebuild/settings.yml +0 -13
@@ -0,0 +1 @@
|
|
1
|
+
!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(t,e,o){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t){var e=t.getBoundingClientRect(),o={};for(var i in e)o[i]=e[i];if(t.ownerDocument!==document){var r=t.ownerDocument.defaultView.frameElement;if(r){var s=n(r);o.top+=s.top,o.bottom+=s.top,o.left+=s.left,o.right+=s.left}}return o}function r(t){var e=getComputedStyle(t)||{},o=e.position,i=[];if("fixed"===o)return[t];for(var n=t;(n=n.parentNode)&&n&&1===n.nodeType;){var r=void 0;try{r=getComputedStyle(n)}catch(s){}if("undefined"==typeof r||null===r)return i.push(n),i;var a=r,f=a.overflow,l=a.overflowX,h=a.overflowY;/(auto|scroll)/.test(f+h+l)&&("absolute"!==o||["relative","absolute","fixed"].indexOf(r.position)>=0)&&i.push(n)}return i.push(t.ownerDocument.body),t.ownerDocument!==document&&i.push(t.ownerDocument.defaultView),i}function s(){A&&document.body.removeChild(A),A=null}function a(t){var e=void 0;t===document?(e=document,t=document.documentElement):e=t.ownerDocument;var o=e.documentElement,i=n(t),r=P();return i.top-=r.top,i.left-=r.left,"undefined"==typeof i.width&&(i.width=document.body.scrollWidth-i.left-i.right),"undefined"==typeof i.height&&(i.height=document.body.scrollHeight-i.top-i.bottom),i.top=i.top-o.clientTop,i.left=i.left-o.clientLeft,i.right=e.body.clientWidth-i.width-i.left,i.bottom=e.body.clientHeight-i.height-i.top,i}function f(t){return t.offsetParent||document.documentElement}function l(){if(M)return M;var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");h(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e);var o=t.offsetWidth;e.style.overflow="scroll";var i=t.offsetWidth;o===i&&(i=e.clientWidth),document.body.removeChild(e);var n=o-i;return M={width:n,height:n}}function h(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=[];return Array.prototype.push.apply(e,arguments),e.slice(1).forEach(function(e){if(e)for(var o in e)({}).hasOwnProperty.call(e,o)&&(t[o]=e[o])}),t}function d(t,e){if("undefined"!=typeof t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.remove(e)});else{var o=new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi"),i=c(t).replace(o," ");g(t,i)}}function p(t,e){if("undefined"!=typeof t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.add(e)});else{d(t,e);var o=c(t)+(" "+e);g(t,o)}}function u(t,e){if("undefined"!=typeof t.classList)return t.classList.contains(e);var o=c(t);return new RegExp("(^| )"+e+"( |$)","gi").test(o)}function c(t){return t.className instanceof t.ownerDocument.defaultView.SVGAnimatedString?t.className.baseVal:t.className}function g(t,e){t.setAttribute("class",e)}function m(t,e,o){o.forEach(function(o){e.indexOf(o)===-1&&u(t,o)&&d(t,o)}),e.forEach(function(e){u(t,e)||p(t,e)})}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function y(t,e){var o=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return t+o>=e&&e>=t-o}function b(){return"undefined"!=typeof performance&&"undefined"!=typeof performance.now?performance.now():+new Date}function w(){for(var t={top:0,left:0},e=arguments.length,o=Array(e),i=0;i<e;i++)o[i]=arguments[i];return o.forEach(function(e){var o=e.top,i=e.left;"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof i&&(i=parseFloat(i,10)),t.top+=o,t.left+=i}),t}function C(t,e){return"string"==typeof t.left&&t.left.indexOf("%")!==-1&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&t.top.indexOf("%")!==-1&&(t.top=parseFloat(t.top,10)/100*e.height),t}function O(t,e){return"scrollParent"===e?e=t.scrollParents[0]:"window"===e&&(e=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),e===document&&(e=e.documentElement),"undefined"!=typeof e.nodeType&&!function(){var t=e,o=a(e),i=o,n=getComputedStyle(e);if(e=[i.left,i.top,o.width+i.left,o.height+i.top],t.ownerDocument!==document){var r=t.ownerDocument.defaultView;e[0]+=r.pageXOffset,e[1]+=r.pageYOffset,e[2]+=r.pageXOffset,e[3]+=r.pageYOffset}G.forEach(function(t,o){t=t[0].toUpperCase()+t.substr(1),"Top"===t||"Left"===t?e[o]+=parseFloat(n["border"+t+"Width"]):e[o]-=parseFloat(n["border"+t+"Width"])})}(),e}var E=function(){function t(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}(),x=void 0;"undefined"==typeof x&&(x={modules:[]});var A=null,T=function(){var t=0;return function(){return++t}}(),S={},P=function(){var t=A;t&&document.body.contains(t)||(t=document.createElement("div"),t.setAttribute("data-tether-id",T()),h(t.style,{top:0,left:0,position:"absolute"}),document.body.appendChild(t),A=t);var e=t.getAttribute("data-tether-id");return"undefined"==typeof S[e]&&(S[e]=n(t),k(function(){delete S[e]})),S[e]},M=null,W=[],k=function(t){W.push(t)},_=function(){for(var t=void 0;t=W.pop();)t()},B=function(){function t(){i(this,t)}return E(t,[{key:"on",value:function(t,e,o){var i=!(arguments.length<=3||void 0===arguments[3])&&arguments[3];"undefined"==typeof this.bindings&&(this.bindings={}),"undefined"==typeof this.bindings[t]&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})}},{key:"once",value:function(t,e,o){this.on(t,e,o,!0)}},{key:"off",value:function(t,e){if("undefined"!=typeof this.bindings&&"undefined"!=typeof this.bindings[t])if("undefined"==typeof e)delete this.bindings[t];else for(var o=0;o<this.bindings[t].length;)this.bindings[t][o].handler===e?this.bindings[t].splice(o,1):++o}},{key:"trigger",value:function(t){if("undefined"!=typeof this.bindings&&this.bindings[t]){for(var e=0,o=arguments.length,i=Array(o>1?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];for(;e<this.bindings[t].length;){var r=this.bindings[t][e],s=r.handler,a=r.ctx,f=r.once,l=a;"undefined"==typeof l&&(l=this),s.apply(l,i),f?this.bindings[t].splice(e,1):++e}}}}]),t}();x.Utils={getActualBoundingClientRect:n,getScrollParents:r,getBounds:a,getOffsetParent:f,extend:h,addClass:p,removeClass:d,hasClass:u,updateClasses:m,defer:k,flush:_,uniqueId:T,Evented:B,getScrollBarSize:l,removeUtilElements:s};var z=function(){function t(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(f){n=!0,r=f}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw r}}return o}return function(e,o){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),E=function(){function t(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}(),j=function(t,e,o){for(var i=!0;i;){var n=t,r=e,s=o;i=!1,null===n&&(n=Function.prototype);var a=Object.getOwnPropertyDescriptor(n,r);if(void 0!==a){if("value"in a)return a.value;var f=a.get;if(void 0===f)return;return f.call(s)}var l=Object.getPrototypeOf(n);if(null===l)return;t=l,e=r,o=s,i=!0,a=l=void 0}};if("undefined"==typeof x)throw new Error("You must include the utils.js file before tether.js");var Y=x.Utils,r=Y.getScrollParents,a=Y.getBounds,f=Y.getOffsetParent,h=Y.extend,p=Y.addClass,d=Y.removeClass,m=Y.updateClasses,k=Y.defer,_=Y.flush,l=Y.getScrollBarSize,s=Y.removeUtilElements,L=function(){if("undefined"==typeof document)return"";for(var t=document.createElement("div"),e=["transform","WebkitTransform","OTransform","MozTransform","msTransform"],o=0;o<e.length;++o){var i=e[o];if(void 0!==t.style[i])return i}}(),D=[],X=function(){D.forEach(function(t){t.position(!1)}),_()};!function(){var t=null,e=null,o=null,i=function n(){return"undefined"!=typeof e&&e>16?(e=Math.min(e-16,250),void(o=setTimeout(n,250))):void("undefined"!=typeof t&&b()-t<10||(null!=o&&(clearTimeout(o),o=null),t=b(),X(),e=b()-t))};"undefined"!=typeof window&&"undefined"!=typeof window.addEventListener&&["resize","scroll","touchmove"].forEach(function(t){window.addEventListener(t,i)})}();var F={center:"center",left:"right",right:"left"},H={middle:"middle",top:"bottom",bottom:"top"},N={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},U=function(t,e){var o=t.left,i=t.top;return"auto"===o&&(o=F[e.left]),"auto"===i&&(i=H[e.top]),{left:o,top:i}},V=function(t){var e=t.left,o=t.top;return"undefined"!=typeof N[t.left]&&(e=N[t.left]),"undefined"!=typeof N[t.top]&&(o=N[t.top]),{left:e,top:o}},R=function(t){var e=t.split(" "),o=z(e,2),i=o[0],n=o[1];return{top:i,left:n}},q=R,I=function(t){function e(t){var o=this;i(this,e),j(Object.getPrototypeOf(e.prototype),"constructor",this).call(this),this.position=this.position.bind(this),D.push(this),this.history=[],this.setOptions(t,!1),x.modules.forEach(function(t){"undefined"!=typeof t.initialize&&t.initialize.call(o)}),this.position()}return v(e,t),E(e,[{key:"getClass",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e=this.options.classes;return"undefined"!=typeof e&&e[t]?this.options.classes[t]:this.options.classPrefix?this.options.classPrefix+"-"+t:t}},{key:"setOptions",value:function(t){var e=this,o=arguments.length<=1||void 0===arguments[1]||arguments[1],i={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"};this.options=h(i,t);var n=this.options,s=n.element,a=n.target,f=n.targetModifier;if(this.element=s,this.target=a,this.targetModifier=f,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),["element","target"].forEach(function(t){if("undefined"==typeof e[t])throw new Error("Tether Error: Both element and target must be defined");"undefined"!=typeof e[t].jquery?e[t]=e[t][0]:"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))}),p(this.element,this.getClass("element")),this.options.addTargetClasses!==!1&&p(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");this.targetAttachment=q(this.options.targetAttachment),this.attachment=q(this.options.attachment),this.offset=R(this.options.offset),this.targetOffset=R(this.options.targetOffset),"undefined"!=typeof this.scrollParents&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParents=[this.target]:this.scrollParents=r(this.target),this.options.enabled!==!1&&this.enable(o)}},{key:"getTargetBounds",value:function(){if("undefined"==typeof this.targetModifier)return a(this.target);if("visible"===this.targetModifier){if(this.target===document.body)return{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth};var t=a(this.target),e={height:t.height,width:t.width,top:t.top,left:t.left};return e.height=Math.min(e.height,t.height-(pageYOffset-t.top)),e.height=Math.min(e.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),e.height=Math.min(innerHeight,e.height),e.height-=2,e.width=Math.min(e.width,t.width-(pageXOffset-t.left)),e.width=Math.min(e.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),e.width=Math.min(innerWidth,e.width),e.width-=2,e.top<pageYOffset&&(e.top=pageYOffset),e.left<pageXOffset&&(e.left=pageXOffset),e}if("scroll-handle"===this.targetModifier){var t=void 0,o=this.target;o===document.body?(o=document.documentElement,t={left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):t=a(o);var i=getComputedStyle(o),n=o.scrollWidth>o.clientWidth||[i.overflow,i.overflowX].indexOf("scroll")>=0||this.target!==document.body,r=0;n&&(r=15);var s=t.height-parseFloat(i.borderTopWidth)-parseFloat(i.borderBottomWidth)-r,e={width:15,height:.975*s*(s/o.scrollHeight),left:t.left+t.width-parseFloat(i.borderLeftWidth)-15},f=0;s<408&&this.target===document.body&&(f=-11e-5*Math.pow(s,2)-.00727*s+22.58),this.target!==document.body&&(e.height=Math.max(e.height,24));var l=this.target.scrollTop/(o.scrollHeight-s);return e.top=l*(s-e.height-f)+t.top+parseFloat(i.borderTopWidth),this.target===document.body&&(e.height=Math.max(e.height,24)),e}}},{key:"clearCache",value:function(){this._cache={}}},{key:"cache",value:function(t,e){return"undefined"==typeof this._cache&&(this._cache={}),"undefined"==typeof this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]}},{key:"enable",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]||arguments[0];this.options.addTargetClasses!==!1&&p(this.target,this.getClass("enabled")),p(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParents.forEach(function(e){e!==t.target.ownerDocument&&e.addEventListener("scroll",t.position)}),e&&this.position()}},{key:"disable",value:function(){var t=this;d(this.target,this.getClass("enabled")),d(this.element,this.getClass("enabled")),this.enabled=!1,"undefined"!=typeof this.scrollParents&&this.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.position)})}},{key:"destroy",value:function(){var t=this;this.disable(),D.forEach(function(e,o){e===t&&D.splice(o,1)}),0===D.length&&s()}},{key:"updateAttachClasses",value:function(t,e){var o=this;t=t||this.attachment,e=e||this.targetAttachment;var i=["left","top","bottom","right","middle","center"];"undefined"!=typeof this._addAttachClasses&&this._addAttachClasses.length&&this._addAttachClasses.splice(0,this._addAttachClasses.length),"undefined"==typeof this._addAttachClasses&&(this._addAttachClasses=[]);var n=this._addAttachClasses;t.top&&n.push(this.getClass("element-attached")+"-"+t.top),t.left&&n.push(this.getClass("element-attached")+"-"+t.left),e.top&&n.push(this.getClass("target-attached")+"-"+e.top),e.left&&n.push(this.getClass("target-attached")+"-"+e.left);var r=[];i.forEach(function(t){r.push(o.getClass("element-attached")+"-"+t),r.push(o.getClass("target-attached")+"-"+t)}),k(function(){"undefined"!=typeof o._addAttachClasses&&(m(o.element,o._addAttachClasses,r),o.options.addTargetClasses!==!1&&m(o.target,o._addAttachClasses,r),delete o._addAttachClasses)})}},{key:"position",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]||arguments[0];if(this.enabled){this.clearCache();var o=U(this.targetAttachment,this.attachment);this.updateAttachClasses(this.attachment,o);var i=this.cache("element-bounds",function(){return a(t.element)}),n=i.width,r=i.height;if(0===n&&0===r&&"undefined"!=typeof this.lastSize){var s=this.lastSize;n=s.width,r=s.height}else this.lastSize={width:n,height:r};var h=this.cache("target-bounds",function(){return t.getTargetBounds()}),d=h,p=C(V(this.attachment),{width:n,height:r}),u=C(V(o),d),c=C(this.offset,{width:n,height:r}),g=C(this.targetOffset,d);p=w(p,c),u=w(u,g);for(var m=h.left+u.left-p.left,v=h.top+u.top-p.top,y=0;y<x.modules.length;++y){var b=x.modules[y],O=b.position.call(this,{left:m,top:v,targetAttachment:o,targetPos:h,elementPos:i,offset:p,targetOffset:u,manualOffset:c,manualTargetOffset:g,scrollbarSize:S,attachment:this.attachment});if(O===!1)return!1;"undefined"!=typeof O&&"object"==typeof O&&(v=O.top,m=O.left)}var E={page:{top:v,left:m},viewport:{top:v-pageYOffset,bottom:pageYOffset-v-r+innerHeight,left:m-pageXOffset,right:pageXOffset-m-n+innerWidth}},A=this.target.ownerDocument,T=A.defaultView,S=void 0;return T.innerHeight>A.documentElement.clientHeight&&(S=this.cache("scrollbar-size",l),E.viewport.bottom-=S.height),T.innerWidth>A.documentElement.clientWidth&&(S=this.cache("scrollbar-size",l),E.viewport.right-=S.width),["","static"].indexOf(A.body.style.position)!==-1&&["","static"].indexOf(A.body.parentElement.style.position)!==-1||(E.page.bottom=A.body.scrollHeight-v-r,E.page.right=A.body.scrollWidth-m-n),"undefined"!=typeof this.options.optimizations&&this.options.optimizations.moveElement!==!1&&"undefined"==typeof this.targetModifier&&!function(){var e=t.cache("target-offsetparent",function(){return f(t.target)}),o=t.cache("target-offsetparent-bounds",function(){return a(e)}),i=getComputedStyle(e),n=o,r={};if(["Top","Left","Bottom","Right"].forEach(function(t){r[t.toLowerCase()]=parseFloat(i["border"+t+"Width"])}),o.right=A.body.scrollWidth-o.left-n.width+r.right,o.bottom=A.body.scrollHeight-o.top-n.height+r.bottom,E.page.top>=o.top+r.top&&E.page.bottom>=o.bottom&&E.page.left>=o.left+r.left&&E.page.right>=o.right){var s=e.scrollTop,l=e.scrollLeft;E.offset={top:E.page.top-o.top+s-r.top,left:E.page.left-o.left+l-r.left}}}(),this.move(E),this.history.unshift(E),this.history.length>3&&this.history.pop(),e&&_(),!0}}},{key:"move",value:function(t){var e=this;if("undefined"!=typeof this.element.parentNode){var o={};for(var i in t){o[i]={};for(var n in t[i]){for(var r=!1,s=0;s<this.history.length;++s){var a=this.history[s];if("undefined"!=typeof a[i]&&!y(a[i][n],t[i][n])){r=!0;break}}r||(o[i][n]=!0)}}var l={top:"",left:"",right:"",bottom:""},d=function(t,o){var i="undefined"!=typeof e.options.optimizations,n=i?e.options.optimizations.gpu:null;if(n!==!1){var r=void 0,s=void 0;if(t.top?(l.top=0,r=o.top):(l.bottom=0,r=-o.bottom),t.left?(l.left=0,s=o.left):(l.right=0,s=-o.right),window.matchMedia){var a=window.matchMedia("only screen and (min-resolution: 1.3dppx)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3)").matches;a||(s=Math.round(s),r=Math.round(r))}l[L]="translateX("+s+"px) translateY("+r+"px)","msTransform"!==L&&(l[L]+=" translateZ(0)")}else t.top?l.top=o.top+"px":l.bottom=o.bottom+"px",t.left?l.left=o.left+"px":l.right=o.right+"px"},p=!1;if((o.page.top||o.page.bottom)&&(o.page.left||o.page.right)?(l.position="absolute",d(o.page,t.page)):(o.viewport.top||o.viewport.bottom)&&(o.viewport.left||o.viewport.right)?(l.position="fixed",d(o.viewport,t.viewport)):"undefined"!=typeof o.offset&&o.offset.top&&o.offset.left?!function(){l.position="absolute";var i=e.cache("target-offsetparent",function(){return f(e.target)});f(e.element)!==i&&k(function(){e.element.parentNode.removeChild(e.element),i.appendChild(e.element)}),d(o.offset,t.offset),p=!0}():(l.position="absolute",d({top:!0,left:!0},t.page)),!p)if(this.options.bodyElement)this.options.bodyElement.appendChild(this.element);else{for(var u=!0,c=this.element.parentNode;c&&1===c.nodeType&&"BODY"!==c.tagName;){if("static"!==getComputedStyle(c).position){u=!1;break}c=c.parentNode}u||(this.element.parentNode.removeChild(this.element),this.element.ownerDocument.body.appendChild(this.element))}var g={},m=!1;for(var n in l){var v=l[n],b=this.element.style[n];b!==v&&(m=!0,g[n]=v)}m&&k(function(){h(e.element.style,g),e.trigger("repositioned")})}}}]),e}(B);I.modules=[],x.position=X;var $=h(I,x),z=function(){function t(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(f){n=!0,r=f}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw r}}return o}return function(e,o){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Y=x.Utils,a=Y.getBounds,h=Y.extend,m=Y.updateClasses,k=Y.defer,G=["left","top","right","bottom"];x.modules.push({position:function(t){var e=this,o=t.top,i=t.left,n=t.targetAttachment;if(!this.options.constraints)return!0;var r=this.cache("element-bounds",function(){return a(e.element)}),s=r.height,f=r.width;if(0===f&&0===s&&"undefined"!=typeof this.lastSize){var l=this.lastSize;f=l.width,s=l.height}var d=this.cache("target-bounds",function(){return e.getTargetBounds()}),p=d.height,u=d.width,c=[this.getClass("pinned"),this.getClass("out-of-bounds")];this.options.constraints.forEach(function(t){var e=t.outOfBoundsClass,o=t.pinnedClass;e&&c.push(e),o&&c.push(o)}),c.forEach(function(t){["left","top","right","bottom"].forEach(function(e){c.push(t+"-"+e)})});var g=[],v=h({},n),y=h({},this.attachment);return this.options.constraints.forEach(function(t){var r=t.to,a=t.attachment,l=t.pin;"undefined"==typeof a&&(a="");var h=void 0,d=void 0;if(a.indexOf(" ")>=0){var c=a.split(" "),m=z(c,2);d=m[0],h=m[1]}else h=d=a;var b=O(e,r);"target"!==d&&"both"!==d||(o<b[1]&&"top"===v.top&&(o+=p,v.top="bottom"),o+s>b[3]&&"bottom"===v.top&&(o-=p,v.top="top")),"together"===d&&("top"===v.top&&("bottom"===y.top&&o<b[1]?(o+=p,v.top="bottom",o+=s,y.top="top"):"top"===y.top&&o+s>b[3]&&o-(s-p)>=b[1]&&(o-=s-p,v.top="bottom",y.top="bottom")),"bottom"===v.top&&("top"===y.top&&o+s>b[3]?(o-=p,v.top="top",o-=s,y.top="bottom"):"bottom"===y.top&&o<b[1]&&o+(2*s-p)<=b[3]&&(o+=s-p,v.top="top",y.top="top")),"middle"===v.top&&(o+s>b[3]&&"top"===y.top?(o-=s,y.top="bottom"):o<b[1]&&"bottom"===y.top&&(o+=s,y.top="top"))),"target"!==h&&"both"!==h||(i<b[0]&&"left"===v.left&&(i+=u,v.left="right"),i+f>b[2]&&"right"===v.left&&(i-=u,v.left="left")),"together"===h&&(i<b[0]&&"left"===v.left?"right"===y.left?(i+=u,v.left="right",i+=f,y.left="left"):"left"===y.left&&(i+=u,v.left="right",i-=f,y.left="right"):i+f>b[2]&&"right"===v.left?"left"===y.left?(i-=u,v.left="left",i-=f,y.left="right"):"right"===y.left&&(i-=u,v.left="left",i+=f,y.left="left"):"center"===v.left&&(i+f>b[2]&&"left"===y.left?(i-=f,y.left="right"):i<b[0]&&"right"===y.left&&(i+=f,y.left="left"))),"element"!==d&&"both"!==d||(o<b[1]&&"bottom"===y.top&&(o+=s,y.top="top"),o+s>b[3]&&"top"===y.top&&(o-=s,y.top="bottom")),"element"!==h&&"both"!==h||(i<b[0]&&("right"===y.left?(i+=f,y.left="left"):"center"===y.left&&(i+=f/2,y.left="left")),i+f>b[2]&&("left"===y.left?(i-=f,y.left="right"):"center"===y.left&&(i-=f/2,y.left="right"))),"string"==typeof l?l=l.split(",").map(function(t){return t.trim()}):l===!0&&(l=["top","left","right","bottom"]),l=l||[];var w=[],C=[];o<b[1]&&(l.indexOf("top")>=0?(o=b[1],w.push("top")):C.push("top")),o+s>b[3]&&(l.indexOf("bottom")>=0?(o=b[3]-s,w.push("bottom")):C.push("bottom")),i<b[0]&&(l.indexOf("left")>=0?(i=b[0],w.push("left")):C.push("left")),i+f>b[2]&&(l.indexOf("right")>=0?(i=b[2]-f,w.push("right")):C.push("right")),w.length&&!function(){var t=void 0;t="undefined"!=typeof e.options.pinnedClass?e.options.pinnedClass:e.getClass("pinned"),g.push(t),w.forEach(function(e){g.push(t+"-"+e)})}(),C.length&&!function(){var t=void 0;t="undefined"!=typeof e.options.outOfBoundsClass?e.options.outOfBoundsClass:e.getClass("out-of-bounds"),g.push(t),C.forEach(function(e){g.push(t+"-"+e)})}(),(w.indexOf("left")>=0||w.indexOf("right")>=0)&&(y.left=v.left=!1),(w.indexOf("top")>=0||w.indexOf("bottom")>=0)&&(y.top=v.top=!1),v.top===n.top&&v.left===n.left&&y.top===e.attachment.top&&y.left===e.attachment.left||(e.updateAttachClasses(y,v),e.trigger("update",{attachment:y,targetAttachment:v}))}),k(function(){e.options.addTargetClasses!==!1&&m(e.target,g,c),m(e.element,g,c)}),{top:o,left:i}}});var Y=x.Utils,a=Y.getBounds,m=Y.updateClasses,k=Y.defer;x.modules.push({position:function(t){var e=this,o=t.top,i=t.left,n=this.cache("element-bounds",function(){return a(e.element)}),r=n.height,s=n.width,f=this.getTargetBounds(),l=o+r,h=i+s,d=[];o<=f.bottom&&l>=f.top&&["left","right"].forEach(function(t){var e=f[t];e!==i&&e!==h||d.push(t)}),i<=f.right&&h>=f.left&&["top","bottom"].forEach(function(t){var e=f[t];e!==o&&e!==l||d.push(t)});var p=[],u=[],c=["left","top","right","bottom"];return p.push(this.getClass("abutted")),c.forEach(function(t){p.push(e.getClass("abutted")+"-"+t)}),d.length&&u.push(this.getClass("abutted")),d.forEach(function(t){u.push(e.getClass("abutted")+"-"+t)}),k(function(){e.options.addTargetClasses!==!1&&m(e.target,u,p),m(e.element,u,p)}),!0}});var z=function(){function t(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(f){n=!0,r=f}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw r}}return o}return function(e,o){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();return x.modules.push({position:function(t){var e=t.top,o=t.left;if(this.options.shift){var i=this.options.shift;"function"==typeof this.options.shift&&(i=this.options.shift.call(this,{top:e,left:o}));var n=void 0,r=void 0;if("string"==typeof i){i=i.split(" "),i[1]=i[1]||i[0];var s=i,a=z(s,2);n=a[0],r=a[1],n=parseFloat(n,10),r=parseFloat(r,10)}else n=i.top,r=i.left;return e+=n,o+=r,{top:e,left:o}}}}),$});
|
data/exe/cb
CHANGED
data/exe/codebuild
CHANGED
data/lib/codebuild.rb
CHANGED
@@ -43,7 +43,7 @@ module Codebuild::AwsServices
|
|
43
43
|
# myapp-ci-deploy-development-2
|
44
44
|
#
|
45
45
|
def inferred_stack_name(project_name)
|
46
|
-
items = [project_name,
|
46
|
+
items = [project_name, @options[:type], Codebuild.env_extra, "cb"]
|
47
47
|
items.insert(3, Codebuild.env) if Codebuild.settings.dig(:stack_naming, :append_env)
|
48
48
|
items.reject(&:blank?).compact.join("-")
|
49
49
|
end
|
data/lib/codebuild/cli.rb
CHANGED
@@ -8,7 +8,7 @@ module Codebuild
|
|
8
8
|
Init.cli_options.each do |args|
|
9
9
|
option(*args)
|
10
10
|
end
|
11
|
-
register(Init, "init", "init", "Set up initial
|
11
|
+
register(Init, "init", "init", "Set up initial .codebuild files.")
|
12
12
|
|
13
13
|
common_options = Proc.new do
|
14
14
|
option :type, desc: "folder to use within .codebuild folder for different build types"
|
@@ -35,6 +35,7 @@ module Codebuild
|
|
35
35
|
long_desc Help.text(:start)
|
36
36
|
option :source_version, default: "master", desc: "git branch"
|
37
37
|
option :branch, aliases: "b", default: "master", desc: "git branch"
|
38
|
+
option :env_vars, type: :array, desc: "env var overrides. IE: KEY1=VALUE1 KEY2=VALUE2"
|
38
39
|
common_options.call
|
39
40
|
def start(project_name=nil)
|
40
41
|
Start.new(options.merge(project_name: project_name)).run
|
data/lib/codebuild/core.rb
CHANGED
@@ -45,9 +45,9 @@ module Codebuild
|
|
45
45
|
memoize :settings
|
46
46
|
|
47
47
|
def check_codebuild_project!
|
48
|
-
check_path = "#{Codebuild.root}/.codebuild
|
48
|
+
check_path = "#{Codebuild.root}/.codebuild"
|
49
49
|
unless File.exist?(check_path)
|
50
|
-
puts "ERROR: No
|
50
|
+
puts "ERROR: No .codebuild folder found. Are you sure you are in a project with codebuild setup?".color(:red)
|
51
51
|
puts "Current directory: #{Dir.pwd}"
|
52
52
|
puts "If you want to set up codebuild for this prjoect, please create a settings file via: codebuild init"
|
53
53
|
exit 1 unless ENV['TEST']
|
@@ -83,9 +83,9 @@ module Codebuild::Dsl
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def environment_variables(vars)
|
86
|
-
@
|
87
|
-
@mapped_env_vars =
|
88
|
-
k = k.to_s
|
86
|
+
# Storing @mapped_env_vars as instance variable for later usage in linux_environment
|
87
|
+
@mapped_env_vars = vars.map { |k,v|
|
88
|
+
k, v = k.to_s, v.to_s
|
89
89
|
if v =~ /^ssm:/
|
90
90
|
{ type: "PARAMETER_STORE", name: k, value: v.sub('ssm:','') }
|
91
91
|
else
|
data/lib/codebuild/help/init.md
CHANGED
@@ -1,7 +1,43 @@
|
|
1
1
|
## Examples
|
2
2
|
|
3
3
|
cb init # infers the name from the parent folder
|
4
|
-
cb init
|
4
|
+
cb init my-project # set the name
|
5
|
+
|
6
|
+
## Type Option
|
7
|
+
|
8
|
+
The type option is useful to generate subfolder under .codebuild that contain another codebuild project. Example:
|
9
|
+
|
10
|
+
cb init --type unit
|
11
|
+
|
12
|
+
Thi generates the cb files under the `.codebuild/unit` folder.
|
13
|
+
|
14
|
+
.codebuild
|
15
|
+
└── unit
|
16
|
+
├── buildspec.yml
|
17
|
+
├── project.rb
|
18
|
+
├── role.rb
|
19
|
+
└── schedule.rb
|
20
|
+
|
21
|
+
To tell the codebuild tool to use these files, you specify the `--type` option as a part of the other commands. Examples:
|
22
|
+
|
23
|
+
cb deploy --type unit
|
24
|
+
cb start --type unit
|
25
|
+
|
26
|
+
## Structure
|
27
|
+
|
28
|
+
So if you need multiple CodeBuild projects that perform different tasks but are both related to the same code repo, you might have a structure like this:
|
29
|
+
|
30
|
+
.codebuild
|
31
|
+
├── deploy
|
32
|
+
│ ├── buildspec.yml
|
33
|
+
│ ├── project.rb
|
34
|
+
│ ├── role.rb
|
35
|
+
│ └── schedule.rb
|
36
|
+
└── unit
|
37
|
+
├── buildspec.yml
|
38
|
+
├── project.rb
|
39
|
+
├── role.rb
|
40
|
+
└── schedule.rb
|
5
41
|
|
6
42
|
## Custom Templates
|
7
43
|
|
@@ -11,7 +47,7 @@ If you would like the `cb init` command to use your own custom templates, you ca
|
|
11
47
|
|
12
48
|
This will clone the repo on GitHub into the `~/.codebuild/templates/tongueroo/codebuild-custom-template` and use that as an additional template source. The default `--template-mode=additive` mode means that if there's a file in `tongueroo/codebuild-custom-template` that exists it will use that in place of the default template files.
|
13
49
|
|
14
|
-
If you do not want to use any of the original default template files within the
|
50
|
+
If you do not want to use any of the original default template files within the codebuild gem at all, you can use the `--template-mode=replace` mode. Replace mode will only use templates from the provided `--template` option. Example:
|
15
51
|
|
16
52
|
cb init --template=tongueroo/codebuild-custom-template --template-mode=replace
|
17
53
|
|
data/lib/codebuild/help/start.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
|
1
|
+
# Examples
|
2
2
|
|
3
3
|
cb start # infers the name from the parent folder
|
4
4
|
cb start stack-name # looks up project via CloudFormation stack
|
5
5
|
cb start demo-project # looks up project via codebuild project name
|
6
6
|
|
7
|
+
## Overriding Env Variables at Runtime
|
8
|
+
|
9
|
+
You can override env variables at runtime with `--env-vars`. Examples:
|
10
|
+
|
11
|
+
cb start --type vpc --env-vars K1=v1 K2=v2
|
12
|
+
cb start --type vpc --env-vars K1=v1 K2=ssm:v2 # support for PARAMETER_STORE
|
data/lib/codebuild/init.rb
CHANGED
@@ -3,10 +3,12 @@ module Codebuild
|
|
3
3
|
# Ugly, this is how I can get the options from to match with this Thor::Group
|
4
4
|
def self.cli_options
|
5
5
|
[
|
6
|
-
[:
|
7
|
-
[:
|
8
|
-
[:template, desc: "Custom template to use
|
9
|
-
[:template_mode, desc: "Template mode: replace or additive
|
6
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
7
|
+
[:name, desc: "CodeBuild project name"],
|
8
|
+
[:template, desc: "Custom template to use"],
|
9
|
+
[:template_mode, desc: "Template mode: replace or additive"],
|
10
|
+
[:type, desc: "Type option creates a subfolder under .codebuild"],
|
11
|
+
[:variables, type: :boolean, default: true, desc: "Create variables starter files"],
|
10
12
|
]
|
11
13
|
end
|
12
14
|
cli_options.each { |o| class_option(*o) }
|
@@ -26,17 +28,25 @@ module Codebuild
|
|
26
28
|
override_source_paths(custom_template)
|
27
29
|
else # additive: modify on top of default template
|
28
30
|
default_template = File.expand_path("../../template", __FILE__)
|
31
|
+
puts "default_template: #{default_template}"
|
29
32
|
override_source_paths([custom_template, default_template])
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
36
|
+
def copy_top_level
|
37
|
+
puts "Initialize codebuild top-level folder"
|
38
|
+
dest = ".codebuild"
|
39
|
+
excludes = %w[.git]
|
40
|
+
excludes << %w[variables] unless @options[:variables]
|
41
|
+
pattern = Regexp.new(excludes.join('|'))
|
42
|
+
directory "top", dest, exclude_pattern: pattern
|
43
|
+
end
|
44
|
+
|
33
45
|
def copy_project
|
34
46
|
puts "Initialize codebuild project in .codebuild"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
directory ".", exclude_pattern: /.git/
|
39
|
-
end
|
47
|
+
dest = ".codebuild"
|
48
|
+
dest = "#{dest}/#{@options[:type]}" if @options[:type]
|
49
|
+
directory "project", dest, exclude_pattern: /.git/
|
40
50
|
end
|
41
51
|
|
42
52
|
private
|
data/lib/codebuild/project.rb
CHANGED
@@ -4,6 +4,7 @@ module Codebuild
|
|
4
4
|
class Project
|
5
5
|
include Dsl::Project
|
6
6
|
include Evaluate
|
7
|
+
include Variables
|
7
8
|
|
8
9
|
attr_reader :project_name, :full_project_name, :project_path
|
9
10
|
def initialize(options={})
|
@@ -11,8 +12,7 @@ module Codebuild
|
|
11
12
|
@project_name = options[:project_name]
|
12
13
|
@full_project_name = options[:full_project_name] # includes -development at the end
|
13
14
|
@project_path = options[:project_path] || get_project_path
|
14
|
-
#
|
15
|
-
@properties = default_properties
|
15
|
+
@properties = default_properties # defaults make project.rb simpler
|
16
16
|
end
|
17
17
|
|
18
18
|
def exist?
|
@@ -20,6 +20,7 @@ module Codebuild
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def run
|
23
|
+
load_variables
|
23
24
|
evaluate(@project_path)
|
24
25
|
resource = {
|
25
26
|
code_build: {
|
data/lib/codebuild/role.rb
CHANGED
@@ -4,6 +4,7 @@ module Codebuild
|
|
4
4
|
class Role
|
5
5
|
include Codebuild::Dsl::Role
|
6
6
|
include Evaluate
|
7
|
+
include Variables
|
7
8
|
|
8
9
|
def initialize(options={})
|
9
10
|
@options = options
|
@@ -13,6 +14,7 @@ module Codebuild
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def run
|
17
|
+
load_variables
|
16
18
|
evaluate(@role_path) if File.exist?(@role_path)
|
17
19
|
@properties[:policies] = [{
|
18
20
|
policy_name: "CodeBuildAccess",
|
data/lib/codebuild/schedule.rb
CHANGED
@@ -2,6 +2,7 @@ module Codebuild
|
|
2
2
|
class Schedule
|
3
3
|
include Codebuild::Dsl::Schedule
|
4
4
|
include Evaluate
|
5
|
+
include Variables
|
5
6
|
|
6
7
|
def initialize(options={})
|
7
8
|
@options = options
|
@@ -13,9 +14,13 @@ module Codebuild
|
|
13
14
|
def run
|
14
15
|
return unless File.exist?(@schedule_path)
|
15
16
|
|
17
|
+
old_properties = @properties.clone
|
18
|
+
load_variables
|
16
19
|
evaluate(@schedule_path)
|
20
|
+
|
17
21
|
@properties[:schedule_expression] = @schedule_expression if @schedule_expression
|
18
22
|
set_rule_event! if @rule_event_props
|
23
|
+
return if old_properties == @properties # empty schedule.rb file
|
19
24
|
|
20
25
|
resource = {
|
21
26
|
events_rule: {
|
data/lib/codebuild/setting.rb
CHANGED
@@ -11,9 +11,8 @@ module Codebuild
|
|
11
11
|
# data contains the settings.yml config. The order or precedence for settings
|
12
12
|
# is the project ufo/settings.yml and then the ~/.codebuild/settings.yml.
|
13
13
|
def data
|
14
|
-
if @check_codebuild_project
|
15
|
-
|
16
|
-
end
|
14
|
+
Codebuild.check_codebuild_project! if @check_codebuild_project
|
15
|
+
return {} unless File.exist?(project_settings_path)
|
17
16
|
|
18
17
|
# project based settings files
|
19
18
|
project = load_file(project_settings_path)
|
data/lib/codebuild/stack.rb
CHANGED
@@ -45,6 +45,15 @@ module Codebuild
|
|
45
45
|
return if @options[:noop]
|
46
46
|
puts "Deploying stack #{@stack_name.color(:green)} with CodeBuild project #{@full_project_name.color(:green)}"
|
47
47
|
|
48
|
+
@stack = find_stack(@stack_name)
|
49
|
+
if @stack && rollback_complete?(@stack)
|
50
|
+
puts "Existing stack in ROLLBACK_COMPLETE state. Deleting stack before continuing."
|
51
|
+
cfn.delete_stack(stack_name: @stack_name)
|
52
|
+
status.wait
|
53
|
+
status.reset
|
54
|
+
@stack = nil # at this point stack has been deleted
|
55
|
+
end
|
56
|
+
|
48
57
|
begin
|
49
58
|
perform
|
50
59
|
url_info
|
@@ -73,5 +82,21 @@ module Codebuild
|
|
73
82
|
def status
|
74
83
|
@status ||= Cfn::Status.new(@stack_name)
|
75
84
|
end
|
85
|
+
|
86
|
+
def rollback_complete?(stack)
|
87
|
+
stack.stack_status == 'ROLLBACK_COMPLETE'
|
88
|
+
end
|
89
|
+
|
90
|
+
def find_stack(stack_name)
|
91
|
+
resp = cfn.describe_stacks(stack_name: stack_name)
|
92
|
+
resp.stacks.first
|
93
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
94
|
+
# example: Stack with id demo-web does not exist
|
95
|
+
if e.message =~ /Stack with/ && e.message =~ /does not exist/
|
96
|
+
nil
|
97
|
+
else
|
98
|
+
raise
|
99
|
+
end
|
100
|
+
end
|
76
101
|
end
|
77
102
|
end
|
data/lib/codebuild/start.rb
CHANGED
@@ -10,16 +10,35 @@ module Codebuild
|
|
10
10
|
|
11
11
|
def run
|
12
12
|
source_version = @options[:branch] || @options[:source_version] || 'master'
|
13
|
-
|
13
|
+
params = {
|
14
14
|
project_name: project_name,
|
15
15
|
source_version: source_version
|
16
|
-
|
16
|
+
}
|
17
|
+
params[:environment_variables_override] = environment_variables_override if @options[:env_vars]
|
18
|
+
resp = codebuild.start_build(params)
|
17
19
|
puts "Build started for project: #{project_name}"
|
18
20
|
puts "Please check the CodeBuild console for the status."
|
19
21
|
puts "Codebuild Log Url:"
|
20
22
|
puts codebuild_log_url(resp.build.id)
|
21
23
|
end
|
22
24
|
|
25
|
+
def environment_variables_override
|
26
|
+
@options[:env_vars].map do |s|
|
27
|
+
k, v = s.split('=')
|
28
|
+
ssm = false
|
29
|
+
if /^ssm:(.*)/.match(v)
|
30
|
+
v = $1
|
31
|
+
ssm = true
|
32
|
+
end
|
33
|
+
|
34
|
+
{
|
35
|
+
name: k,
|
36
|
+
value: v,
|
37
|
+
type: ssm ? "PARAMETER_STORE" : "PLAINTEXT"
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
23
42
|
def project_name
|
24
43
|
if project_exists?(@full_project_name)
|
25
44
|
@full_project_name
|
@@ -30,7 +49,7 @@ module Codebuild
|
|
30
49
|
end
|
31
50
|
resource.physical_resource_id # codebuild project name
|
32
51
|
else
|
33
|
-
puts "ERROR: Unable to find the codebuild project with
|
52
|
+
puts "ERROR: Unable to find the codebuild project with either full_project_name: #{@full_project_name} or project_name: #{@project_name}".color(:red)
|
34
53
|
exit 1
|
35
54
|
end
|
36
55
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Codebuild
|
2
|
+
module Variables
|
3
|
+
def load_variables
|
4
|
+
load_variables_file("base")
|
5
|
+
load_variables_file(Codebuild.env)
|
6
|
+
# Then load type scope variables, so they take higher precedence
|
7
|
+
load_variables_file("base", @options[:type])
|
8
|
+
load_variables_file(Codebuild.env, @options[:type])
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_variables_file(filename, type=nil)
|
12
|
+
items = ["#{Codebuild.root}/.codebuild", type, "variables/#{filename}.rb"].compact
|
13
|
+
path = items.join('/')
|
14
|
+
instance_eval(IO.read(path), path) if File.exist?(path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/codebuild/version.rb
CHANGED
@@ -6,13 +6,13 @@ version: 0.2
|
|
6
6
|
phases:
|
7
7
|
install:
|
8
8
|
commands:
|
9
|
-
- uname -a
|
10
|
-
- pwd
|
11
|
-
- ls
|
12
|
-
- env | sort
|
13
|
-
- ls /etc/*release*
|
14
|
-
- cat /etc/*release*
|
15
|
-
- whoami
|
9
|
+
# - uname -a
|
10
|
+
# - pwd
|
11
|
+
# - ls
|
12
|
+
# - env | sort
|
13
|
+
# - ls /etc/*release*
|
14
|
+
# - cat /etc/*release*
|
15
|
+
# - whoami
|
16
16
|
# - bundle
|
17
17
|
build:
|
18
18
|
commands:
|
@@ -16,6 +16,14 @@ environment_variables(
|
|
16
16
|
# Uncomment to enable github webhook, the GitHub oauth token needs admin:repo_hook permissions
|
17
17
|
# Refer to https://github.com/tongueroo/codebuild/blob/master/readme/github_oauth.md
|
18
18
|
# triggers(webhook: true)
|
19
|
+
# Another example:
|
20
|
+
# Docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projecttriggers.html
|
21
|
+
# {type: "EVENT", pattern: "PUSH"} is required
|
22
|
+
# Also, note the extra brackets: [[]] is actually the proper format. I know weird.
|
23
|
+
# triggers(
|
24
|
+
# webhook: true,
|
25
|
+
# filter_groups: [[{type: "HEAD_REF", pattern: "my-branch"}, {type: "EVENT", pattern: "PUSH"}]]
|
26
|
+
# )
|
19
27
|
|
20
28
|
# Shorthand to enable all local cache modes
|
21
29
|
# local_cache(true)
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
@myvar = "base-value"
|
@@ -0,0 +1 @@
|
|
1
|
+
@myvar = "development-value"
|