Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha cleanup #2

Merged
merged 7 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
270 changes: 16 additions & 254 deletions README.md

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions cli/company.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
* @file company.js
* @copyright 2022 Mediumroast, Inc. All rights reserved.
* @license Apache-2.0
* @version 2.0.0
*/

// Import required modules
import { Auth, Companies, Interactions } from '../src/api/mrServer.js'
import { CLI } from '../src/helpers.js'
import { Utilities } from '../src/helpers.js'
import { CLIUtilities } from '../src/cli.js'
import { CompanyStandalone } from '../src/report/companies.js'

// Globals
const objectType = 'Companies'

// Construct the CLI object
const myCLI = new CLI (
const myCLI = new CLIUtilities (
'2.0',
'company',
'Command line interface for mediumroast.io Company objects.',
objectType
)

// Construct the Utilities object
const utils = new Utilities(objectType)

// Create the environmental settings
const myArgs = myCLI.parseCLIArgs()
const myConfig = myCLI.getConfig(myArgs.conf_file)
Expand Down Expand Up @@ -74,7 +79,7 @@ if (myArgs.report) {

if(myArgs.package) {
// Create the working directory
const [dir_success, dir_msg, dir_res] = myCLI.safeMakedir(baseDir + '/interactions')
const [dir_success, dir_msg, dir_res] = utils.safeMakedir(baseDir + '/interactions')

// If the directory creations was successful download the interaction
if(dir_success) {
Expand All @@ -88,7 +93,7 @@ if (myArgs.report) {
access points, but the tradeoff would be that caffeine would need to run on a
system with file system access to these objects.
*/
await myCLI.s3DownloadObjs(interactions, myEnv, baseDir + '/interactions')
await utils.s3DownloadObjs(interactions, myEnv, baseDir + '/interactions')
// Else error out and exit
} else {
console.error('ERROR (%d): ' + dir_msg, -1)
Expand All @@ -97,7 +102,7 @@ if (myArgs.report) {

}
// Create the document
const [report_success, report_stat, report_result] = await docController.makeDocx(fileName, myArgs.package)
const [report_success, report_stat, report_result] = await docController.makeDOCX(fileName, myArgs.package)

// Create the package and cleanup as needed
if (myArgs.package) {
Expand Down
264 changes: 0 additions & 264 deletions cli/doc_company.js

This file was deleted.

17 changes: 10 additions & 7 deletions cli/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@
* @file interactions.js
* @copyright 2022 Mediumroast, Inc. All rights reserved.
* @license Apache-2.0
* @version 2.0.0
*/

// Import required modules
import { Auth, Interactions, Companies } from '../src/api/mrServer.js'
import { CLI } from '../src/helpers.js'
import { CLIUtilities } from '../src/cli.js'
import { Utilities } from '../src/helpers.js'
import { InteractionStandalone } from '../src/report/interactions.js'

// Globals
const objectType = 'Interactions'

// Construct the CLI object
const myCLI = new CLI(
const myCLI = new CLIUtilities(
'2.0',
'interaction',
'Command line interface for mediumroast.io Interaction objects.',
objectType
)
const utils = new Utilities(objectType)

// Create the environmental settings
const myArgs = myCLI.parseCLIArgs()
Expand Down Expand Up @@ -68,7 +71,7 @@ if (myArgs.report) {

if(myArgs.package) {
// Create the working directory
const [dir_success, dir_msg, dir_res] = myCLI.safeMakedir(baseDir + '/interactions')
const [dir_success, dir_msg, dir_res] = utils.safeMakedir(baseDir + '/interactions')

// If the directory creations was successful download the interaction
if(dir_success) {
Expand All @@ -82,7 +85,7 @@ if (myArgs.report) {
access points, but the tradeoff would be that caffeine would need to run on a
system with file system access to these objects.
*/
await myCLI.s3DownloadObjs(int_results, myEnv, baseDir + '/interactions')
await utils.s3DownloadObjs(int_results, myEnv, baseDir + '/interactions')
// Else error out and exit
} else {
console.error('ERROR (%d): ' + dir_msg, -1)
Expand All @@ -91,17 +94,17 @@ if (myArgs.report) {

}
// Create the document
const [report_success, report_stat, report_result] = await docController.makeDocx(fileName, myArgs.package)
const [report_success, report_stat, report_result] = await docController.makeDOCX(fileName, myArgs.package)

// Create the package and cleanup as needed
if (myArgs.package) {
const [package_success, package_stat, package_result] = await myCLI.createZIPArchive(
const [package_success, package_stat, package_result] = await utils.createZIPArchive(
myEnv.outputDir + '/' + baseName + '.zip',
baseDir
)
if (package_success) {
console.log(package_stat)
myCLI.rmDir(baseDir)
utils.rmDir(baseDir)
process.exit(0)
} else {
console.error(package_stat, -1)
Expand Down
Loading