Skip to content

Commit

Permalink
Code updates for release, deployment scripts, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
uzquiano committed Nov 25, 2014
1 parent 78310a1 commit bf0710c
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 15 deletions.
89 changes: 89 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* NOTE: Alpaca uses Gulp for it's build process. Please take a look at the README.md file for instructions.
*
* This Grunt file provides official Alpaca version release and deployment assistance to the deploy.sh bash file.
* It isn't needed for local Alpaca builds and should only be used by the Alpaca release manager.
*/
module.exports = function(grunt) {

var fs = require("fs");
var path = require("path");

grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-invalidate-cloudfront');

// register one or more task lists (you should ALWAYS have a "default" task list)
grunt.registerTask('publish_cdn', ['aws_s3:clean', 'aws_s3:publish', 'invalidate_cloudfront:production']);

var pkg = grunt.file.readJSON('package.json');
var awsConfig = grunt.file.readJSON("../settings/__aws.json");

var name = "alpaca";

// config
grunt.initConfig({

"jsdoc": {
"dist": {
"src": [
"src/js/**/*.js",
"README.md"
],
"options": {
"destination": "./build/alpaca/jsdoc",
"template": "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
"configure": "jsdoc.conf.json"
}
}
},

"aws_s3": {
"options": {
"accessKeyId": awsConfig.key,
"secretAccessKey": awsConfig.secret,
"region": awsConfig.region,
"uploadConcurrency": 5,
"downloadConcurrency": 5
},
"clean": {
"options": {
"bucket": awsConfig.bucket
},
"files": [{
"dest": path.join(name, pkg.version),
"action": "delete"
}]
},
"publish": {
"options": {
"bucket": awsConfig.bucket
},
"files": [{
"expand": true,
"cwd": "dist/" + name,
"src": ['**/*'],
"dest": path.join(name, pkg.version)
}]
}
},

"invalidate_cloudfront": {
"options": {
"key": awsConfig.key,
"secret": awsConfig.secret,
"distribution": awsConfig.cloudfrontDistributionIds[name]
},
"production": {
"files": [{
"expand": true,
"cwd": "dist/" + name,
"src": ["**/*"],
"filter": "isFile",
"dest": path.join(name, pkg.version)
}]
}
}

});
};
87 changes: 83 additions & 4 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
#!/bin/bash
VERSION="$(node server/version)"
BRANCH="$VERSION-release"
ZIP="alpaca-$VERSION.zip"

cd deployment
ant -f deploy.xml -lib jsch-0.1.50.jar
cd ..
echo Deploying version $VERSION


#
# SETUP
#

# switch to master branch
# create a local branch <version>-release
git checkout master
git checkout -b $BRANCH




#
# STEP 1: BUILD ALPACA, WEB SITE JSDOCS AND DEPLOY TO CDN
#

# build alpaca
# build web site
# copy to dist (for bower)
gulp default site dist

# build jsdoc
grunt jsdoc

# add the ./dist directory to the commit
git add ./dist

# commit changes to local branch
git commit -m "alpaca release build $VERSION"




#
# STEP 2: PUBLISH DISTRIBUTION FILES TO CDN
#

# publish alpaca to CDN
grunt publish_dist



#
# STEP 3: PUBLISH WEB SITE
#

rm build/$ZIP
cd build/site
zip -r ../$ZIP *
cd ../..
scp -i ~/keys/gitana.pem -r build/$ZIP ec2-user@alpacajs.org:/web/code/alpaca
ssh -i ~/keys/gitana.pem ec2-user@alpacajs.org 'cd /web/code/alpaca; rm /web/code/alpaca/$VERSION; unzip /web/code/alpaca/$ZIP -d /web/code/alpaca/$VERSION'
ssh -i ~/keys/gitana.pem ec2-user@alpacajs.org 'cd /web/code/alpaca; rm -r /web/code/alpaca/latest; unzip /web/code/alpaca/$ZIP -d /web/code/alpaca/latest'




#
# STEP 4: TAG REPO FOR BOWER
#

# create a tag
#git tag $VERSION

# push the tag
#git push remote $BRANCH --tags




#
# TEARDOWN
#

# delete local branch
git checkout master
git branch -D $BRANCH
6 changes: 5 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ var paths = {
};

gulp.task("clean", function() {
return gulp.src("build", {read: false})
return gulp.src(["build", "dist"], {read: false})
.pipe(clean());
});

Expand Down Expand Up @@ -627,6 +627,10 @@ gulp.task("web", function(cb) {
);
});

gulp.task("dist", function() {
return gulp.src("build/alpaca/**/*")
.pipe(gulp.dest("dist/alpaca"));
});


gulp.task("bump", function(){
Expand Down
28 changes: 28 additions & 0 deletions jsdoc.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tags" : {
"allowUnknownTags" : true
},
"plugins" : ["plugins/markdown"],

"templates" : {
"cleverLinks" : false,
"monospaceLinks" : false,
"dateFormat" : "ddd MMM Do YYYY",
"outputSourceFiles" : true,
"outputSourcePath" : true,
"systemName" : "Alpaca Forms",
"footer" : "",
"copyright" : "Copyright © 2014 Gitana Software, Inc.",
"navType" : "vertical",
"theme" : "cerulean",
"linenums" : true,
"collapseSymbols" : false,
"inverseNav" : false,
"highlightTutorialCode" : true,
"protocol": "fred://"
},
"markdown" : {
"parser" : "gfm",
"hardwrap" : true
}
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"run-sequence": "*",
"through2": "*",
"wd": "",
"wrench": "*"
"wrench": "*",

"grunt": "*",
"grunt-aws-s3": "^0.9.4",
"grunt-cloudfront": "^0.2.0",
"grunt-invalidate-cloudfront": "^0.1.5",
"grunt-jsdoc": "^0.6.1"
}
}
2 changes: 2 additions & 0 deletions server/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var pkg = require("../package");
console.log(pkg.version);
8 changes: 0 additions & 8 deletions src/js/Alpaca.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@
},

/**
* @private
* Static counter for generating a unique ID.
*/
uniqueIdCounter: 0,
Expand Down Expand Up @@ -763,8 +762,6 @@
},

/**
* @private
*
* Alpaca Views.
*/
views: {},
Expand Down Expand Up @@ -1124,7 +1121,6 @@
},

/**
* @private
* Helper function to provide YAHOO later like capabilities.
*/
later: function(when, o, fn, data, periodic) {
Expand Down Expand Up @@ -1468,8 +1464,6 @@
},

/**
* @private
*
* Initial function for setting up field instance and executing callbacks if needed.
*
* @param {Object} el Container element.
Expand Down Expand Up @@ -1755,8 +1749,6 @@
},

/**
* @private
*
* Internal method for constructing a field instance.
*
* @param {Object} el The dom element to act as the container of the constructed field.
Expand Down
2 changes: 1 addition & 1 deletion src/js/fields/advanced/StateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
* @param {Boolean} codeValue whether to hand back US holding codes (instead of names)
* @param {Boolean} capitalize whether to capitalize the values handed back
*
* @type {Object} an object containing "keys" and "values", both of which are arrays.
* @returns {Object} an object containing "keys" and "values", both of which are arrays.
*/
Alpaca.retrieveUSHoldings = (function()
{
Expand Down

0 comments on commit bf0710c

Please sign in to comment.