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

Subfolders to Dependencies #115

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified default-prefs.json
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions lib/cli/input/eval.js → lib/cli/input/eval/eval.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const inquirer = require('inquirer');
const PromptGenerator = require('../../utils/PromptGenerator');
const preferenceManager = require('../../utils/preference-manager');
const PromptGenerator = require('@utils/PromptGenerator');
const preferenceManager = require('@utils/preference-manager');
const path = require('path');

const defaultPrefPath = path.join(__dirname, '../../../default-prefs.json');
const defaultPrefPath = path.join(__dirname, '../../../../default-prefs.json');
const defaultPrefs = JSON.parse(require('fs').readFileSync(defaultPrefPath, 'utf8'));

const { supportedLanguages } = defaultPrefs;
Expand Down
5 changes: 5 additions & 0 deletions lib/cli/input/eval/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@input/eval",
"main": "eval.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/cli/input/init.js → lib/cli/input/init/init.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const inquirer = require('inquirer');
const PromptGenerator = require('../../utils/PromptGenerator');
const PromptGenerator = require('@utils/PromptGenerator');

const getLengthValidator = invalidMessage => (value) => {
if (value.length) {
Expand Down
5 changes: 5 additions & 0 deletions lib/cli/input/init/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@input/init",
"main": "init.js",
"version": "0.0.0"
}
5 changes: 5 additions & 0 deletions lib/cli/input/prefs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@input/prefs",
"main": "prefs.js",
"version": "0.0.0"
}
4 changes: 2 additions & 2 deletions lib/cli/input/prefs.js → lib/cli/input/prefs/prefs.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const inquirer = require('inquirer');
const validator = require('validator');
const path = require('path');
const PromptGenerator = require('../../utils/PromptGenerator');
const PromptGenerator = require('@utils/PromptGenerator');

const defaultPrefPath = path.join(__dirname, '../../../default-prefs.json');
const defaultPrefPath = path.join(__dirname, '../../../../default-prefs.json');
const defaultPrefs = JSON.parse(require('fs').readFileSync(defaultPrefPath, 'utf8'));

const { supportedLanguages } = defaultPrefs;
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/output/eval.js → lib/cli/output/eval/eval.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const chalk = require('chalk');
const { Spinner } = require('cli-spinner');
const Table = require('cli-table');

const spinner = new Spinner('Evaluating you submission, please wait...');
const spinner = new Spinner('Evaluating your submission, please wait...');

const startSpinner = () => {
spinner.setSpinnerString(0);
Expand All @@ -14,7 +14,7 @@ const stopSpinner = () => {
};

const onInvalidRequest = () => {
console.log(chalk.red('\nAccess Denied. Please try submitting again'));
console.log(chalk.red('\nAccess Denied. Please try submitting again.'));
};

const onSubmissionPending = () => {
Expand Down
5 changes: 5 additions & 0 deletions lib/cli/output/eval/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@output/eval",
"main": "eval.js",
"version": "0.0.0"
}
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/cli/output/exit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@output/exit",
"main": "exit.js",
"version": "0.0.0"
}
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/cli/output/init/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@output/init",
"main": "init.js",
"version": "0.0.0"
}
5 changes: 5 additions & 0 deletions lib/cli/output/prefs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@output/prefs",
"main": "prefs.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/cli/output/prefs.js → lib/cli/output/prefs/prefs.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const sendOutput = (event) => {
showPrefs(event.details);
break;
case 'invalid_lang':
console.log(chalk.red(`Please provide the a valid language. The supported languages are ${event.details.supportedLanguages}`));
console.log(chalk.red(`Please provide a valid language. The supported languages are ${event.details.supportedLanguages}`));
break;
case 'invalid_host':
console.log(chalk.red('Please provide a valid host'));
Expand Down
8 changes: 4 additions & 4 deletions lib/controller/eval.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const evalInput = require('../cli/input/eval');
const evalOutput = require('../cli/output/eval');
const evalModel = require('../model/eval');
const commandValidator = require('../utils/command-validator');
const evalInput = require('@input/eval');
const evalOutput = require('@output/eval');
const evalModel = require('@model/eval');
const commandValidator = require('@utils/command-validator');

const onEvalResult = (evalResult) => {
evalOutput.sendOutput(evalResult);
Expand Down
6 changes: 3 additions & 3 deletions lib/controller/exit.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const commandValidator = require('../utils/command-validator');
const exitOutput = require('../cli/output/exit');
const exitModel = require('../model/exit');
const commandValidator = require('@utils/command-validator');
const exitOutput = require('@output/exit');
const exitModel = require('@model/exit');

const onExit = async (args, options, logger) => {
const isValidSession = commandValidator.validateSession();
Expand Down
2 changes: 1 addition & 1 deletion lib/controller/index.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const program = require('caporal');
const preferenceManager = require('../utils/preference-manager');
const preferenceManager = require('@utils/preference-manager');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use the globals technique, then
global.__defaultPrefPath = path.join(__dirname, '../../../../default-prefs.json');
statement can be placed here and removed from every where else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good idea, sir. We can also read a json into the global scope.

const init = require('./init');
const exit = require('./exit');
Expand Down
6 changes: 3 additions & 3 deletions lib/controller/init.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const initInput = require('../cli/input/init');
const initOutput = require('../cli/output/init');
const initModel = require('../model/init');
const initInput = require('@input/init');
const initOutput = require('@output/init');
const initModel = require('@model/init');

const onInit = async (args, options, logger) => {
initOutput.sendOutput({
Expand Down
5 changes: 5 additions & 0 deletions lib/controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "controller",
"main": "index.js",
"version": "0.0.0"
}
6 changes: 3 additions & 3 deletions lib/controller/prefs.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const prefsInput = require('../cli/input/prefs');
const prefsOutput = require('../cli/output/prefs');
const prefsModel = require('../model/prefs');
const prefsInput = require('@input/prefs');
const prefsOutput = require('@output/prefs');
const prefsModel = require('@model/prefs');

const onPrefs = async (args, options, logger) => {
let changePrefEvent = await prefsInput.getInput(args, options);
Expand Down
2 changes: 1 addition & 1 deletion lib/model/eval.js → lib/model/eval/eval.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const io = require('socket.io-client');
const preferenceManager = require('../utils/preference-manager');
const preferenceManager = require('@utils/preference-manager');

const connectToSocket = () => {
const cliPrefs = preferenceManager.getPreference({ name: 'cliPrefs' });
Expand Down
5 changes: 5 additions & 0 deletions lib/model/eval/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@model/eval",
"main": "eval.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/model/exit.js → lib/model/exit/exit.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const preferenceManager = require('../utils/preference-manager');
const preferenceManager = require('@utils/preference-manager');

const logout = () => {
preferenceManager.deleteCredentials();
Expand Down
5 changes: 5 additions & 0 deletions lib/model/exit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@model/exit",
"main": "exit.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/model/init.js → lib/model/init/init.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const requestPromise = require('request-promise');
const preferenceManager = require('../utils/preference-manager');
const preferenceManager = require('@utils/preference-manager');

const fetchPrivateToken = async (host, username, password) => {
const options = {
Expand Down
5 changes: 5 additions & 0 deletions lib/model/init/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@model/init",
"main": "init.js",
"version": "0.0.0"
}
5 changes: 5 additions & 0 deletions lib/model/prefs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@model/prefs",
"main": "prefs.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/model/prefs.js → lib/model/prefs/prefs.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const preferenceManager = require('../utils/preference-manager');
const preferenceManager = require('@utils/preference-manager');

const eventForShowPref = (changePrefEvent) => {
const cliPrefs = preferenceManager.getPreference({ name: 'cliPrefs' });
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/utils/PromptGenerator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@utils/PromptGenerator",
"main": "PromptGenerator.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/utils/command-validator.js → ...ls/command-validator/command-validator.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const chalk = require('chalk');
const preferenceManager = require('./preference-manager');
const preferenceManager = require('@utils/preference-manager');

const maxMillisecodsDiff = 2 * 60 * 60 * 1000;

Expand Down
5 changes: 5 additions & 0 deletions lib/utils/command-validator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@utils/command-validator",
"main": "command-validator.js",
"version": "0.0.0"
}
5 changes: 5 additions & 0 deletions lib/utils/preference-manager/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@utils/preference-manager",
"main": "preference-manager.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion lib/utils/preference-manager.js → .../preference-manager/preference-manager.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const os = require('os');

const prefDirectory = `${os.homedir()}/.autolabjs`;

const defaultPrefPath = path.join(__dirname, '../../default-prefs.json');
const defaultPrefPath = path.join(__dirname, '../../../default-prefs.json');
const defaultPrefs = JSON.parse(require('fs').readFileSync(defaultPrefPath, 'utf8'));

const defaultLang = defaultPrefs.submission.language;
Expand Down
Loading