Skip to content
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
23 changes: 23 additions & 0 deletions apluslms_roman/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
from os import getcwd
from os.path import abspath, expanduser, expandvars
from sys import exit
import logging

from . import __version__
from. builder import Engine
from .backends.docker import DockerBackend
from .configuration import CourseConfigError, CourseConfig
from .validator import Validator

LOG_LEVELS = [logging.WARNING, logging.INFO, logging.DEBUG]

logger = logging.getLogger(__name__)

def main():
parser = argparse.ArgumentParser(description='Course material builder')
Expand All @@ -16,8 +21,15 @@ def main():

parser.add_argument('--version', action='store_true',
help='Print version info')
parser.add_argument("-v", "--verbose", dest="verbose_count",
action="count", default=0,
help="increases log verbosity for each occurence.")

args = parser.parse_args()
logging.basicConfig(
level=LOG_LEVELS[min(args.verbose_count, 2)],
#format='%(name)s (%(levelname)s): %(message)s'
)

if args.version:
print("Roman {}\n".format(__version__))
Expand Down Expand Up @@ -53,10 +65,21 @@ def main():
print("Invalid course config: {}".format(e))
exit(1)

# create validator (and validate config)
logging.info(" >> Validation step:")
validator = Validator(config)
# validation_result = validator.validate(location of the file here, "config", 1)
# if validation_result is False:
# logging.warning( "Validation unsuccessful. Terminating.")
# exit(0)
logging.info(" >> All files validated succesfully")


# build course
builder = engine.create_builder(config)
result = builder.build()
print(result)
logging.shutdown()
exit(result.code or 0)


Expand Down
68 changes: 68 additions & 0 deletions apluslms_roman/schemas/config_v1_0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
$schema: "http://json-schema.org/draft-04/schema"
#$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
title: Exercise schema
type: object
required:
- title
- description
- instructions
- view_type
- files
- container
optional:
- radar_info

definitions:
languageType:
type: string
enum:
- python
- scala
- javascript

additionalProperties: false
properties:
title:
description: The name of the exercise
type: string
description:
type: string
instructions:
type: string
view_type:
type: string
files:
type: array
items:
type: object
required:
- field
properties:
field:
type: string
name:
type: string
container:
type: object
properties:
image:
type: string
mount:
type: string
cmd:
type: string
radar_info:
type: object
required:
- tokenizer
properties:
tokenizer:
$ref: '#/definitions/languageType'
#enum:
# - python
# - scala
# - javascript
minimum_match_tokens:
type: number
minimum: 0
68 changes: 68 additions & 0 deletions apluslms_roman/schemas/config_v1_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
$schema: "http://json-schema.org/draft-04/schema"
#$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
title: Exercise schema
type: object
required:
- title
- description
- instructions
- view_type
- files
- container
optional:
- radar_info

definitions:
languageType:
type: string
enum:
- python
- scala
- javascript

additionalProperties: false
properties:
title:
description: The name of the exercise
type: string
description:
type: string
instructions:
type: string
view_type:
type: string
files:
type: array
items:
type: object
required:
- field
properties:
field:
type: string
name:
type: string
container:
type: object
properties:
image:
type: string
mount:
type: string
cmd:
type: string
radar_info:
type: object
required:
- tokenizer
properties:
tokenizer:
$ref: '#/definitions/languageType'
#enum:
# - python
# - scala
# - javascript
minimum_match_tokens:
type: number
minimum: 0
175 changes: 175 additions & 0 deletions apluslms_roman/schemas/index_v1_0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
$schema: "http://json-schema.org/draft-04/schema"
title: Index schema
type: object
definitions:
dateTime:
type: string
pattern: ^\d{4}\-\d{2}\-\d{2}(\s\d{2}\:\d{2})?$
configFormat:
type: string
pattern: \.(json|yaml|yml)$
statusEnum:
type: string
enum:
- ready
- unlisted
- enrollment
- enrollment_ext
- hidden
- maintenance
- nototal


required:
- categories
- end
- language
- modules
- name
- start
- static_dir

additionalProperties: false
properties:
categories:
type: object
description: Categories can be added freely
additionalProperties:
type: object
required:
- name
properties:
name:
type: string
status:
$ref: '#/definitions/statusEnum'
end:
$ref: '#/definitions/dateTime'
language:
type: string
enum:
- en
- fi
modules:
type: array
additionalItems: false
items:
type: object
required:
- children
- key
# muita pakollisia?
properties:
children:
type: array
additionalItems: false
items:
type: object
required:
- category
- key
#additionalProperties: false
properties:
category:
type: string
children:
type: array
additionalItems: false
items:
type: object
required:
- category
properties:
category:
type: string
children:
type: array
additionalItems: false
items:
type: object
required:
- category
- key
#additionalProperties: false
properties:
allow_assistant_grading:
type: boolean
category:
type: string
config:
$ref: '#/definitions/configFormat'
confirm_the_level:
type: boolean
difficulty:
type: string
key:
type: string
lti:
type: string
lti_context_id:
type: string
lti_resource_link_id:
type: string
max_group_size:
type: number
minimum: 0
max_points:
type: number
minimum: 0
max_submissions:
type: number
minimum: 0
min_group_size:
type: number
minimum: 0
points_to_pass:
type: number
minimum: 0
scale_points:
type: number
status:
$ref: '#/definitions/statusEnum'
title:
type: string
key:
type: string
name:
type: string
static_content:
type: string
use_wide_column:
type: boolean

key:
type: string
name:
type: string
static_content:
type: string
status:
$ref: '#/definitions/statusEnum'
use_wide_column:
type: boolean
close:
$ref: '#/definitions/dateTime'
key:
type: string
late_close:
$ref: '#/definitions/dateTime'
late_penalty:
type: number
minimum: 0.0
name:
type: string
open:
$ref: '#/definitions/dateTime'
status:
$ref: '#/definitions/statusEnum'

name:
type: string
start:
$ref: '#/definitions/dateTime'
static_dir:
type: string
Loading