From 10c25a01f3410021bc68646f5173583eaf5aebe5 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Mon, 12 Nov 2018 20:55:52 -0500 Subject: [PATCH] Delete grunt sample We don't have a grunt + express sample in our docs anymore. --- .kokoro/appengine/node10/grunt.cfg | 13 --- .kokoro/appengine/node6/grunt.cfg | 13 --- .kokoro/appengine/node8/grunt.cfg | 13 --- appengine/grunt/.gitignore | 1 - appengine/grunt/.jshintrc | 21 ---- appengine/grunt/Gruntfile.js | 55 --------- appengine/grunt/README.md | 14 --- appengine/grunt/app.yaml | 15 --- appengine/grunt/package.json | 30 ----- appengine/grunt/src/app.js | 73 ------------ appengine/grunt/src/bin/www | 105 ------------------ .../grunt/src/public/stylesheets/style.css | 25 ----- appengine/grunt/src/routes/index.js | 27 ----- appengine/grunt/src/routes/users.js | 26 ----- appengine/grunt/src/views/error.pug | 6 - appengine/grunt/src/views/index.pug | 5 - appengine/grunt/src/views/layout.pug | 7 -- 17 files changed, 449 deletions(-) delete mode 100644 .kokoro/appengine/node10/grunt.cfg delete mode 100644 .kokoro/appengine/node6/grunt.cfg delete mode 100644 .kokoro/appengine/node8/grunt.cfg delete mode 100644 appengine/grunt/.gitignore delete mode 100644 appengine/grunt/.jshintrc delete mode 100644 appengine/grunt/Gruntfile.js delete mode 100644 appengine/grunt/README.md delete mode 100644 appengine/grunt/app.yaml delete mode 100644 appengine/grunt/package.json delete mode 100644 appengine/grunt/src/app.js delete mode 100755 appengine/grunt/src/bin/www delete mode 100644 appengine/grunt/src/public/stylesheets/style.css delete mode 100644 appengine/grunt/src/routes/index.js delete mode 100644 appengine/grunt/src/routes/users.js delete mode 100644 appengine/grunt/src/views/error.pug delete mode 100644 appengine/grunt/src/views/index.pug delete mode 100644 appengine/grunt/src/views/layout.pug diff --git a/.kokoro/appengine/node10/grunt.cfg b/.kokoro/appengine/node10/grunt.cfg deleted file mode 100644 index 129fb5826b..0000000000 --- a/.kokoro/appengine/node10/grunt.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Set the folder in which the tests are run -env_vars: { - key: "PROJECT" - value: "appengine/grunt" -} - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-docs-samples/.kokoro/build.sh" -} diff --git a/.kokoro/appengine/node6/grunt.cfg b/.kokoro/appengine/node6/grunt.cfg deleted file mode 100644 index 129fb5826b..0000000000 --- a/.kokoro/appengine/node6/grunt.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Set the folder in which the tests are run -env_vars: { - key: "PROJECT" - value: "appengine/grunt" -} - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-docs-samples/.kokoro/build.sh" -} diff --git a/.kokoro/appengine/node8/grunt.cfg b/.kokoro/appengine/node8/grunt.cfg deleted file mode 100644 index 129fb5826b..0000000000 --- a/.kokoro/appengine/node8/grunt.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Set the folder in which the tests are run -env_vars: { - key: "PROJECT" - value: "appengine/grunt" -} - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-docs-samples/.kokoro/build.sh" -} diff --git a/appengine/grunt/.gitignore b/appengine/grunt/.gitignore deleted file mode 100644 index 8178a2b481..0000000000 --- a/appengine/grunt/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/public/stylesheets/style.min.css \ No newline at end of file diff --git a/appengine/grunt/.jshintrc b/appengine/grunt/.jshintrc deleted file mode 100644 index feb092894f..0000000000 --- a/appengine/grunt/.jshintrc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "node": true, - "esnext": true, - "bitwise": true, - "camelcase": true, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "indent": 2, - "latedef": "nofunc", - "newcap": true, - "nonew": true, - "noarg": true, - "quotmark": "single", - "regexp": true, - "undef": true, - "unused": false, - "trailing": true, - "sub": true, - "maxlen": 80 -} diff --git a/appengine/grunt/Gruntfile.js b/appengine/grunt/Gruntfile.js deleted file mode 100644 index 6dfaa1d7db..0000000000 --- a/appengine/grunt/Gruntfile.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015-2016, 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'; - -module.exports = function (grunt) { - grunt.initConfig({ - jshint: { - files: ['Gruntfile.js', 'src/**/*.js'], - options: { - jshintrc: './.jshintrc', - globals: { - jQuery: true - } - } - }, - cssmin: { - minify: { - src: 'src/public/stylesheets/style.css', - dest: 'src/public/stylesheets/style.min.css' - } - }, - clean: ['src/public/stylesheets/style.min.css'], - watch: { - js: { - files: ['<%= jshint.files %>'], - tasks: ['jshint'] - }, - - css: { - files: ['<%= cssmin.minify.src %>'], - tasks: ['cssmin'] - } - } - }); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-clean'); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - - grunt.registerTask('build', ['jshint', 'cssmin']); - - grunt.registerTask('default', ['watch']); -}; diff --git a/appengine/grunt/README.md b/appengine/grunt/README.md deleted file mode 100644 index 4785d5f553..0000000000 --- a/appengine/grunt/README.md +++ /dev/null @@ -1,14 +0,0 @@ -## Grunt.js on Google App Engine - -> [Grunt][1]: The JavaScript Task Runner. - -Read the [Grunt.js + Express.js on App Engine Tutorial][2] for how to run and -deploy this sample app. - -You can also view the [live demo][3] and read the [Grunt.js documentation][4]. - - -[1]: http://gruntjs.com/ -[2]: https://cloud.google.com/nodejs/resources/tools/grunt -[3]: http://grunt-dot-nodejs-docs-samples.appspot.com -[4]: http://gruntjs.com/getting-started diff --git a/appengine/grunt/app.yaml b/appengine/grunt/app.yaml deleted file mode 100644 index 41e9fef5d7..0000000000 --- a/appengine/grunt/app.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2015-2016, 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. - -runtime: nodejs -env: flex diff --git a/appengine/grunt/package.json b/appengine/grunt/package.json deleted file mode 100644 index d1a2f8e9dc..0000000000 --- a/appengine/grunt/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "appengine-gruntjs", - "description": "An example of running Grunt.js on Google App Engine.", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=4.3.2" - }, - "scripts": { - "start": "node ./src/bin/www", - "postinstall": "grunt build" - }, - "dependencies": { - "body-parser": "1.18.2", - "cookie-parser": "1.4.3", - "debug": "3.1.0", - "express": "4.16.4", - "grunt": "1.0.2", - "grunt-cli": "1.2.0", - "grunt-contrib-clean": "1.1.0", - "grunt-contrib-cssmin": "2.2.1", - "grunt-contrib-jshint": "1.1.0", - "grunt-contrib-watch": "1.0.0", - "morgan": "1.9.0", - "pug": "2.0.0", - "serve-favicon": "2.4.5" - } -} diff --git a/appengine/grunt/src/app.js b/appengine/grunt/src/app.js deleted file mode 100644 index 258ba988fb..0000000000 --- a/appengine/grunt/src/app.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright 2016, 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'; - -const express = require('express'); -const path = require('path'); -const logger = require('morgan'); -const cookieParser = require('cookie-parser'); -const bodyParser = require('body-parser'); - -const routes = require('./routes/index'); -const users = require('./routes/users'); - -const app = express(); - -// view engine setup -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'pug'); - -app.use(logger('dev')); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); -app.use(cookieParser()); -app.use(express.static(path.join(__dirname, 'public'))); - -app.use('/', routes); -app.use('/users', users); - -// catch 404 and forward to error handler -app.use((req, res, next) => { - const err = new Error('Not Found'); - err.status = 404; - next(err); -}); - -// error handlers - -// development error handler -// will print stacktrace -if (app.get('env') === 'development') { - app.use((err, req, res) => { - res.status(err.status || 500); - res.render('error', { - message: err.message, - error: err - }); - }); -} - -// production error handler -// no stacktraces leaked to user -app.use((err, req, res) => { - res.status(err.status || 500); - res.render('error', { - message: err.message, - error: {} - }); -}); - -module.exports = app; diff --git a/appengine/grunt/src/bin/www b/appengine/grunt/src/bin/www deleted file mode 100755 index 5edc01b635..0000000000 --- a/appengine/grunt/src/bin/www +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env node - -/** - * Copyright 2016, 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'; - -// [START server] - -/** - * Module dependencies. - */ -const app = require('../app'); -const debug = require('debug')('express:server'); -const http = require('http'); - -/** - * Get port from environment and store in Express. - */ -const port = normalizePort(process.env.PORT || 8080); -app.set('port', port); - -/** - * Create HTTP server. - */ - -const server = http.createServer(app); - -/** - * Listen on provided port, on all network interfaces. - */ -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -// [END server] - -/** - * Normalize a port into a number, string, or false. - */ -function normalizePort(val) { - const port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - const bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(`${bind} requires elevated privileges`); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(`${bind} is already in use`); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ -function onListening() { - const addr = server.address(); - const bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/appengine/grunt/src/public/stylesheets/style.css b/appengine/grunt/src/public/stylesheets/style.css deleted file mode 100644 index 0366e2dbb2..0000000000 --- a/appengine/grunt/src/public/stylesheets/style.css +++ /dev/null @@ -1,25 +0,0 @@ -/** Copyright 2015-2016, 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. - */ - body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} - -h1 { - color: #0079ff; -} \ No newline at end of file diff --git a/appengine/grunt/src/routes/index.js b/appengine/grunt/src/routes/index.js deleted file mode 100644 index 234101e39e..0000000000 --- a/appengine/grunt/src/routes/index.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2016, 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'; - -const express = require('express'); -const router = express.Router(); - -router.get('/', (req, res) => { - res.render('index', { - title: 'Hello World! Express.js + Grunt.js on Google App Engine.' - }); -}); - -module.exports = router; diff --git a/appengine/grunt/src/routes/users.js b/appengine/grunt/src/routes/users.js deleted file mode 100644 index 6f58fbdcfa..0000000000 --- a/appengine/grunt/src/routes/users.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2016, 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'; - -const express = require('express'); -const router = express.Router(); - -/* GET users listing. */ -router.get('/', (req, res, next) => { - res.send('respond with a resource'); -}); - -module.exports = router; diff --git a/appengine/grunt/src/views/error.pug b/appengine/grunt/src/views/error.pug deleted file mode 100644 index 51ec12c6a2..0000000000 --- a/appengine/grunt/src/views/error.pug +++ /dev/null @@ -1,6 +0,0 @@ -extends layout - -block content - h1= message - h2= error.status - pre #{error.stack} diff --git a/appengine/grunt/src/views/index.pug b/appengine/grunt/src/views/index.pug deleted file mode 100644 index 3d63b9a044..0000000000 --- a/appengine/grunt/src/views/index.pug +++ /dev/null @@ -1,5 +0,0 @@ -extends layout - -block content - h1= title - p Welcome to #{title} diff --git a/appengine/grunt/src/views/layout.pug b/appengine/grunt/src/views/layout.pug deleted file mode 100644 index b12a293ab7..0000000000 --- a/appengine/grunt/src/views/layout.pug +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.min.css') - body - block content \ No newline at end of file