Skip to content

Commit bf0710c

Browse files
committed
Code updates for release, deployment scripts, etc
1 parent 78310a1 commit bf0710c

File tree

8 files changed

+215
-15
lines changed

8 files changed

+215
-15
lines changed

Gruntfile.js

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* NOTE: Alpaca uses Gulp for it's build process. Please take a look at the README.md file for instructions.
3+
*
4+
* This Grunt file provides official Alpaca version release and deployment assistance to the deploy.sh bash file.
5+
* It isn't needed for local Alpaca builds and should only be used by the Alpaca release manager.
6+
*/
7+
module.exports = function(grunt) {
8+
9+
var fs = require("fs");
10+
var path = require("path");
11+
12+
grunt.loadNpmTasks('grunt-jsdoc');
13+
grunt.loadNpmTasks('grunt-aws-s3');
14+
grunt.loadNpmTasks('grunt-invalidate-cloudfront');
15+
16+
// register one or more task lists (you should ALWAYS have a "default" task list)
17+
grunt.registerTask('publish_cdn', ['aws_s3:clean', 'aws_s3:publish', 'invalidate_cloudfront:production']);
18+
19+
var pkg = grunt.file.readJSON('package.json');
20+
var awsConfig = grunt.file.readJSON("../settings/__aws.json");
21+
22+
var name = "alpaca";
23+
24+
// config
25+
grunt.initConfig({
26+
27+
"jsdoc": {
28+
"dist": {
29+
"src": [
30+
"src/js/**/*.js",
31+
"README.md"
32+
],
33+
"options": {
34+
"destination": "./build/alpaca/jsdoc",
35+
"template": "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
36+
"configure": "jsdoc.conf.json"
37+
}
38+
}
39+
},
40+
41+
"aws_s3": {
42+
"options": {
43+
"accessKeyId": awsConfig.key,
44+
"secretAccessKey": awsConfig.secret,
45+
"region": awsConfig.region,
46+
"uploadConcurrency": 5,
47+
"downloadConcurrency": 5
48+
},
49+
"clean": {
50+
"options": {
51+
"bucket": awsConfig.bucket
52+
},
53+
"files": [{
54+
"dest": path.join(name, pkg.version),
55+
"action": "delete"
56+
}]
57+
},
58+
"publish": {
59+
"options": {
60+
"bucket": awsConfig.bucket
61+
},
62+
"files": [{
63+
"expand": true,
64+
"cwd": "dist/" + name,
65+
"src": ['**/*'],
66+
"dest": path.join(name, pkg.version)
67+
}]
68+
}
69+
},
70+
71+
"invalidate_cloudfront": {
72+
"options": {
73+
"key": awsConfig.key,
74+
"secret": awsConfig.secret,
75+
"distribution": awsConfig.cloudfrontDistributionIds[name]
76+
},
77+
"production": {
78+
"files": [{
79+
"expand": true,
80+
"cwd": "dist/" + name,
81+
"src": ["**/*"],
82+
"filter": "isFile",
83+
"dest": path.join(name, pkg.version)
84+
}]
85+
}
86+
}
87+
88+
});
89+
};

deploy.sh

+83-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,84 @@
1-
#!/bin/bash
1+
VERSION="$(node server/version)"
2+
BRANCH="$VERSION-release"
3+
ZIP="alpaca-$VERSION.zip"
24

3-
cd deployment
4-
ant -f deploy.xml -lib jsch-0.1.50.jar
5-
cd ..
5+
echo Deploying version $VERSION
6+
7+
8+
#
9+
# SETUP
10+
#
11+
12+
# switch to master branch
13+
# create a local branch <version>-release
14+
git checkout master
15+
git checkout -b $BRANCH
16+
17+
18+
19+
20+
#
21+
# STEP 1: BUILD ALPACA, WEB SITE JSDOCS AND DEPLOY TO CDN
22+
#
23+
24+
# build alpaca
25+
# build web site
26+
# copy to dist (for bower)
27+
gulp default site dist
28+
29+
# build jsdoc
30+
grunt jsdoc
31+
32+
# add the ./dist directory to the commit
33+
git add ./dist
34+
35+
# commit changes to local branch
36+
git commit -m "alpaca release build $VERSION"
37+
38+
39+
40+
41+
#
42+
# STEP 2: PUBLISH DISTRIBUTION FILES TO CDN
43+
#
44+
45+
# publish alpaca to CDN
46+
grunt publish_dist
47+
48+
49+
50+
#
51+
# STEP 3: PUBLISH WEB SITE
52+
#
53+
54+
rm build/$ZIP
55+
cd build/site
56+
zip -r ../$ZIP *
57+
cd ../..
58+
scp -i ~/keys/gitana.pem -r build/$ZIP [email protected]:/web/code/alpaca
59+
ssh -i ~/keys/gitana.pem [email protected] 'cd /web/code/alpaca; rm /web/code/alpaca/$VERSION; unzip /web/code/alpaca/$ZIP -d /web/code/alpaca/$VERSION'
60+
ssh -i ~/keys/gitana.pem [email protected] 'cd /web/code/alpaca; rm -r /web/code/alpaca/latest; unzip /web/code/alpaca/$ZIP -d /web/code/alpaca/latest'
61+
62+
63+
64+
65+
#
66+
# STEP 4: TAG REPO FOR BOWER
67+
#
68+
69+
# create a tag
70+
#git tag $VERSION
71+
72+
# push the tag
73+
#git push remote $BRANCH --tags
74+
75+
76+
77+
78+
#
79+
# TEARDOWN
80+
#
81+
82+
# delete local branch
83+
git checkout master
84+
git branch -D $BRANCH

gulpfile.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var paths = {
202202
};
203203

204204
gulp.task("clean", function() {
205-
return gulp.src("build", {read: false})
205+
return gulp.src(["build", "dist"], {read: false})
206206
.pipe(clean());
207207
});
208208

@@ -627,6 +627,10 @@ gulp.task("web", function(cb) {
627627
);
628628
});
629629

630+
gulp.task("dist", function() {
631+
return gulp.src("build/alpaca/**/*")
632+
.pipe(gulp.dest("dist/alpaca"));
633+
});
630634

631635

632636
gulp.task("bump", function(){

jsdoc.conf.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"tags" : {
3+
"allowUnknownTags" : true
4+
},
5+
"plugins" : ["plugins/markdown"],
6+
7+
"templates" : {
8+
"cleverLinks" : false,
9+
"monospaceLinks" : false,
10+
"dateFormat" : "ddd MMM Do YYYY",
11+
"outputSourceFiles" : true,
12+
"outputSourcePath" : true,
13+
"systemName" : "Alpaca Forms",
14+
"footer" : "",
15+
"copyright" : "Copyright © 2014 Gitana Software, Inc.",
16+
"navType" : "vertical",
17+
"theme" : "cerulean",
18+
"linenums" : true,
19+
"collapseSymbols" : false,
20+
"inverseNav" : false,
21+
"highlightTutorialCode" : true,
22+
"protocol": "fred://"
23+
},
24+
"markdown" : {
25+
"parser" : "gfm",
26+
"hardwrap" : true
27+
}
28+
}

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"run-sequence": "*",
4141
"through2": "*",
4242
"wd": "",
43-
"wrench": "*"
43+
"wrench": "*",
44+
45+
"grunt": "*",
46+
"grunt-aws-s3": "^0.9.4",
47+
"grunt-cloudfront": "^0.2.0",
48+
"grunt-invalidate-cloudfront": "^0.1.5",
49+
"grunt-jsdoc": "^0.6.1"
4450
}
4551
}

server/version.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var pkg = require("../package");
2+
console.log(pkg.version);

src/js/Alpaca.js

-8
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@
667667
},
668668

669669
/**
670-
* @private
671670
* Static counter for generating a unique ID.
672671
*/
673672
uniqueIdCounter: 0,
@@ -763,8 +762,6 @@
763762
},
764763

765764
/**
766-
* @private
767-
*
768765
* Alpaca Views.
769766
*/
770767
views: {},
@@ -1124,7 +1121,6 @@
11241121
},
11251122

11261123
/**
1127-
* @private
11281124
* Helper function to provide YAHOO later like capabilities.
11291125
*/
11301126
later: function(when, o, fn, data, periodic) {
@@ -1468,8 +1464,6 @@
14681464
},
14691465

14701466
/**
1471-
* @private
1472-
*
14731467
* Initial function for setting up field instance and executing callbacks if needed.
14741468
*
14751469
* @param {Object} el Container element.
@@ -1755,8 +1749,6 @@
17551749
},
17561750

17571751
/**
1758-
* @private
1759-
*
17601752
* Internal method for constructing a field instance.
17611753
*
17621754
* @param {Object} el The dom element to act as the container of the constructed field.

src/js/fields/advanced/StateField.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
* @param {Boolean} codeValue whether to hand back US holding codes (instead of names)
157157
* @param {Boolean} capitalize whether to capitalize the values handed back
158158
*
159-
* @type {Object} an object containing "keys" and "values", both of which are arrays.
159+
* @returns {Object} an object containing "keys" and "values", both of which are arrays.
160160
*/
161161
Alpaca.retrieveUSHoldings = (function()
162162
{

0 commit comments

Comments
 (0)