From c5c58bcaad1dea8f4834c21c434a6d2f9bb353ff Mon Sep 17 00:00:00 2001 From: Dong Ma Date: Wed, 28 Sep 2016 23:23:34 -0700 Subject: [PATCH] Seperate OpenStack class from index.js This commit to seperate OpenStack class from index.js to new file Change-Id: If433040fce752e0033eb61139fd8daa9c6dbb669 --- src/index.js | 24 +------------------- src/openstack.js | 22 ++++++++++++++++++ test/unit/{indexTest.js => openstackTest.js} | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 src/openstack.js rename test/unit/{indexTest.js => openstackTest.js} (94%) diff --git a/src/index.js b/src/index.js index a5404a3..8890a82 100644 --- a/src/index.js +++ b/src/index.js @@ -1,26 +1,4 @@ export {default as Keystone} from './keystone'; export {default as Glance} from './glance'; export {default as Neutron} from './neutron'; - -export default class OpenStack { - /** - * Create wrapper class that takes clouds.yaml instance - * - * @param {{}} cloudConfig The configuration object for a specific cloud. - */ - constructor(cloudConfig) { - // Sanity checks. - if (!cloudConfig) { - throw new Error('A configuration is required.'); - } - // Clone the config, so that this instance is immutable - // at runtime (no modifying the config after the fact). - cloudConfig = Object.assign({}, cloudConfig); - - this.cloudConfig = cloudConfig; - } - getConfig() { - // Returns the config instance - return this.cloudConfig; - } -} +export {default as OpenStack} from './openstack'; diff --git a/src/openstack.js b/src/openstack.js new file mode 100644 index 0000000..8cbf5e0 --- /dev/null +++ b/src/openstack.js @@ -0,0 +1,22 @@ +export default class OpenStack { + /** + * Create wrapper class that takes clouds.yaml instance + * + * @param {{}} cloudConfig The configuration object for a specific cloud. + */ + constructor(cloudConfig) { + // Sanity checks. + if (!cloudConfig) { + throw new Error('A configuration is required.'); + } + // Clone the config, so that this instance is immutable + // at runtime (no modifying the config after the fact). + cloudConfig = Object.assign({}, cloudConfig); + + this.cloudConfig = cloudConfig; + } + getConfig() { + // Returns the config instance + return this.cloudConfig; + } +} diff --git a/test/unit/indexTest.js b/test/unit/openstackTest.js similarity index 94% rename from test/unit/indexTest.js rename to test/unit/openstackTest.js index 829e46e..5a4b886 100644 --- a/test/unit/indexTest.js +++ b/test/unit/openstackTest.js @@ -1,4 +1,4 @@ -import OpenStack from "../../src/index"; +import OpenStack from "../../src/openstack"; import * as mockData from './helpers/data/openstack'; const FetchMock = require('fetch-mock');