hhzl / LearnWords2

A word learning component (Leitner system) and word list conversion functions
MIT License
11 stars 2 forks source link

Add grunt task 'set_input_data_directory' #177

Closed hhzl closed 7 years ago

hhzl commented 7 years ago

The current variable INPUT_DIR is defined as

var INPUT_DIR = 'data',

Still use data as default directory but allow the following grunt command

grunt set_input_data_directory:mydata

to set

INPUT_DIR = 'mydata',
hhzl commented 7 years ago

Implemented https://github.com/hhzl/LearnWords2/blob/master/Grunt_config_object.js

path = require('path');

var p = {"INPUT_DIR" : 'data',
         "WEB_ROOT":  'public',
         "BUILD_DIR" : path.join('public','js'),
         "DIST_DIR" : 'dist'};

module.exports = p;

This needs to be replaced by a JSON object read from a file and

set_input_data_directory:mydata

has to replace the data part in that file.

hhzl commented 7 years ago

Moved to a YAML file https://github.com/hhzl/LearnWords2/blob/master/Grunt_parameters_ini.yml

---
# --------------------------------------------------------
# Define paths for the grunt task runner
# 7th February 2017
#
# This is a YAML file
# http://yaml.org/
#
# Main advantage over JSON is that it may have
# comments.
#
# https://www.json2yaml.com/convert-yaml-to-json
#
# The content is read with
# http://gruntjs.com/api/grunt.file#grunt.file.readyaml
# --------------------------------------------------------

# The LearnWords data is taken from

INPUT_DIR: data

# The directory for the GUI demo

WEB_ROOT: public
BUILD_DIR: public/js

# The distribution directory for the library LW.js

DIST_DIR: dist
hhzl commented 7 years ago

The YAML file may be edited, no longer a need for this task.