diff --git a/.gitignore b/.gitignore index 750b6a2cb4..21243cd7ef 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ npm-debug.log coverage/ test/encrypted/nodejs-docs-samples.json +dump.rdb \ No newline at end of file diff --git a/.jshintignore b/.jshintignore index 089bd1f5ef..a78f0306a8 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,3 +1,4 @@ +appengine/bower/public/bower_components/** appengine/kraken/public/components/** appengine/sails/config/** appengine/sails/tasks/** diff --git a/appengine/bower/.bowerrc b/appengine/bower/.bowerrc new file mode 100644 index 0000000000..9c9ea40600 --- /dev/null +++ b/appengine/bower/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "public/bower_components" +} \ No newline at end of file diff --git a/appengine/bower/.gitignore b/appengine/bower/.gitignore new file mode 100644 index 0000000000..d7fe2b2edf --- /dev/null +++ b/appengine/bower/.gitignore @@ -0,0 +1 @@ +public/bower_components/ \ No newline at end of file diff --git a/appengine/bower/README.md b/appengine/bower/README.md new file mode 100644 index 0000000000..5db00803c3 --- /dev/null +++ b/appengine/bower/README.md @@ -0,0 +1,9 @@ +## Bower on Google App Engine + +> [Bower][1]: A package manager for the web. + +Read the [Bower + Express.js on App Engine Tutorial][2] for how to run and +deploy this sample app. + +[1]: http://bower.io/ +[2]: https://cloud.google.com/nodejs/resources/tools/bower diff --git a/appengine/bower/app.yaml b/appengine/bower/app.yaml new file mode 100644 index 0000000000..70563937a1 --- /dev/null +++ b/appengine/bower/app.yaml @@ -0,0 +1,17 @@ +# Copyright 2015, Google, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# [START app_yaml] +runtime: nodejs +vm: true +# [END app_yaml] diff --git a/appengine/bower/bower.json b/appengine/bower/bower.json new file mode 100644 index 0000000000..2a48a523f7 --- /dev/null +++ b/appengine/bower/bower.json @@ -0,0 +1,6 @@ +{ + "name": "appengine-bower", + "dependencies": { + "jquery": "~2.1.4" + } +} diff --git a/appengine/bower/package.json b/appengine/bower/package.json new file mode 100644 index 0000000000..76bcd4e7a0 --- /dev/null +++ b/appengine/bower/package.json @@ -0,0 +1,20 @@ +{ + "name": "appengine-bower", + "description": "An example of running Bower on Google App Engine.", + "version": "0.0.1", + "private": true, + "license": "Apache Version 2.0", + "engines": { + "node": "~4.2" + }, + "scripts": { + "start": "node server.js", + "postinstall": "bower install --config.interactive=false", + "deploy": "gcloud preview app deploy app.yaml" + }, + "dependencies": { + "bower": "^1.6.5", + "express": "^4.13.3", + "jade": "^1.11.0" + } +} diff --git a/appengine/bower/server.js b/appengine/bower/server.js new file mode 100644 index 0000000000..d5d167b08e --- /dev/null +++ b/appengine/bower/server.js @@ -0,0 +1,38 @@ +// Copyright 2015, Google, Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +var express = require('express'); + +var app = express(); + +// Setup view engine +app.set('view engine', 'jade'); + +app.use(express.static(__dirname + '/public')); + +app.get('/', function(req, res) { + res.render('index'); +}); + +var server = app.listen( + process.env.PORT || 8080, + '0.0.0.0', + function () { + var address = server.address().address; + var port = server.address().port; + console.log('App listening at http://%s:%s', address, port); + console.log('Press Ctrl+C to quit.'); + } +); diff --git a/appengine/bower/views/index.jade b/appengine/bower/views/index.jade new file mode 100644 index 0000000000..90be1eddde --- /dev/null +++ b/appengine/bower/views/index.jade @@ -0,0 +1,26 @@ +// Copyright 2015, Google, Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +doctype html +html + head + title= title + script(type='text/javascript', src='bower_components/jquery/dist/jquery.min.js') + body + h1 Hello World! + p Express.js + Bower on Google App Engine. + hr + p Using , installed via Bower. + script(type='text/javascript'). + $('#module-name').text('jquery') + diff --git a/test/appengine/all.test.js b/test/appengine/all.test.js index 7f27e3e2e3..11d4119a96 100644 --- a/test/appengine/all.test.js +++ b/test/appengine/all.test.js @@ -25,6 +25,12 @@ function getPath(dir) { } var sampleTests = [ + { + dir: 'bower', + cmd: 'node', + args: ['server.js'], + msg: 'Using jquery, installed via Bower.' + }, { dir: 'express', deploy: true,