From aad0d531d8e271e92db6dad52aa5ce774700c5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20My=C5=9Bliwiec?= Date: Thu, 6 Dec 2018 19:39:03 +0100 Subject: [PATCH 1/3] Sync changes with upstream * Update docs * Remove redundant require of express library * Remove redundant require of express library --- README.md | 39 +++++++------------ .../cloud-memory-store/cloud-memory-store.js | 1 - src/services/cloud-storage/cloud-storage.js | 1 - 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index d71c07d..8cb7be5 100644 --- a/README.md +++ b/README.md @@ -2,39 +2,30 @@ Emulation engine for GCP -_clocal-gcp_ provides an easy-to-use test/mocking framework for developing Cloud applications. +clocal-gcp provides an easy-to-use test/mocking framework for developing Cloud applications. Currently features are under development. -# Overview +## 🚀 Install -_clocal-gcp_ spins up the following core Cloud APIs on your local machine: -* **Cloud Functions** at http://localhost:7574 -* **Cloud Data Store** at http://localhost:7569 -* **Cloud CDN** at http://localhost:7581 -* **Cloud ENDPOINTS** at http://localhost:7567 -* **Cloud Storage** at http://localhost:7572 - -## Developing +``` +$ git clone https://github.com/cloudlibz/clocal-gcp.git -Requirements \* +$ cd clocal-gcp -* NodeJS (^8.9.4) -* yarn (^1.6.0) +$ yarn -``` -1. git clone https://github.com/cloudlibz/clocal-gcp.git +$ yarn dev ``` -``` -2. cd clocal-gcp -``` -``` -3. yarn -``` +# 📚 Overview -``` -4. yarn dev -``` +_clocal-gcp_ spins up the following core Cloud APIs on your local machine: + +* **Cloud Functions** at http://localhost:7574 +* **Cloud Data Store** at http://localhost:7569 +* **Cloud CDN** at http://localhost:7581 +* **Cloud ENDPOINTS** at http://localhost:7567 +* **Cloud Storage** at http://localhost:7572 diff --git a/src/services/cloud-memory-store/cloud-memory-store.js b/src/services/cloud-memory-store/cloud-memory-store.js index de86464..5d1c937 100644 --- a/src/services/cloud-memory-store/cloud-memory-store.js +++ b/src/services/cloud-memory-store/cloud-memory-store.js @@ -3,7 +3,6 @@ const CloudLocal = require('./cloud-local'); const bodyParser = require('body-parser'); const MemoryStore = require('./memory-store'); -const express = require('express'); class CloudMemoryStore extends CloudLocal { init() { diff --git a/src/services/cloud-storage/cloud-storage.js b/src/services/cloud-storage/cloud-storage.js index abb3f6d..7e72b5e 100644 --- a/src/services/cloud-storage/cloud-storage.js +++ b/src/services/cloud-storage/cloud-storage.js @@ -5,7 +5,6 @@ const formidable = require('formidable'); const CloudLocal = require('./cloud-local'); const bodyParser = require('body-parser'); const Bucket = require('./bucket'); -const express = require('express'); class CloudStorage extends CloudLocal { init() { From 01d81a2b40062f2c7d5f8234918fa5c848c61f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20My=C5=9Bliwiec?= Date: Thu, 6 Dec 2018 19:40:25 +0100 Subject: [PATCH 2/3] Sync changes with upstream * Update docs * Remove redundant require of express library * Remove redundant require of express library From c43da5a5c5ef2e9844506d11fa81d232ea1c07e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20My=C5=9Bliwiec?= Date: Thu, 6 Dec 2018 19:56:32 +0100 Subject: [PATCH 3/3] Add dynamic command registration --- bin/clocal-gcp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/clocal-gcp b/bin/clocal-gcp index e5736df..1bfd383 100755 --- a/bin/clocal-gcp +++ b/bin/clocal-gcp @@ -2,13 +2,20 @@ 'use strict'; +const fs = require('fs'); +const path = require('path'); const program = require('commander'); -const commandsArray = require('../src/services/index').commands; +const commandsArray = []; +const commandNameList = []; +const commandsDirectory = path.join(__dirname, '../src/services/cli-commands'); -program.version('1.0.0').description('Clocal GCP'); +const directories = fs.readdirSync(commandsDirectory); +directories.forEach(dir => { + commandsArray.push(require(path.join(commandsDirectory, dir, '/cmd.js'))); +}); -const commandNameList = []; +program.version('1.0.0').description('Clocal GCP'); commandsArray.map(command => { commandNameList.push(command.commandName);