Package: maruval
maruvalVersion 1.0.5Command line utilities formarugotocontentmaruval: validate marugoto datamarufind: a utility to find folders with particular contentsmarupretty: pretty-print a JSON file or all files in a directoryInstalling dependenciesmaruvalis predominantly written Python, so your machine needs Python and the Python package managerpipfor installation. You should already have Python.To check if you havepip, typewhich pipinto your command line. If this returns a path topip, you can proceed toInstalling maruval.Otherwise, to installpip, run the following command:curlhttps://bootstrap.pypa.io/get-pip.py-oget-pip.py&&pythonget-pip.py&&rmget-pip.pyNowwhich pipshould show a path to apipexecutable.InstallingmaruvalOnce you havePython,pip3/pip, and maybejq, run the following:pipinstallmaruval# or, from the git repo:gitclonehttps://github.com/uzh/marugoto-validator&&cdmarugoto-validator&&python.setup.pyinstallConfiguringmaruvalforAtomEach tool can be run from the command line, but perhaps more usefully, they can be run from within an Atom editing session.Run the following to configure Atom:python-mmaruval.atomThen, restart Atom and typemaruvalinto the command palette to see the available commands.ConfiguringmaruprettyIf you want to usemarupretty, the JSON pretty printer, you'll need to have thejqutility installed. Use the following command to do this:# note: requires sudosudopython-mmaruval.jq# or, get it at https://stedolan.github.io/jq/ and save it as `jq` your PATH...Command line usageBelow describes how to use each of the three tools from the command line.maruval: validate contentThe main tool,maruval, checks for syntax and content errors in your JSON data. Use it on the command line like this:maruval-f-nw<path-to-content>Optional arguments:-f/--fail-firstwill stopmaruvalafter first error-nw/--no-warningswill suppress warning messagesExample output (on some purposely broken data):danny@thinkpad:~/marugoto/content$maruvalPlantationLives/Validating content at PlantationLives/868 JSON files found.====================================================================================================Problem #1 -- Syntax error in PlantationLives/chapter2/2.2.10/page.json----------------------------------------------------------------------------------------------------Expecting property name enclosed in double quotes: line 5 column 26 (char 94)====================================================================================================Problem #2 -- Content error in PlantationLives/chapter3/2.3.2/imageComponent1.json----------------------------------------------------------------------------------------------------'cannot be string' is not of type 'integer'Failed validating 'type' in schema['properties']['numberOfColumns']:{'type': 'integer'}On instance['numberOfColumns']:'cannot be string'====================================================================================================Problem #3 -- Syntax error in PlantationLives/chapter3/2.3.5/imageComponent1.json----------------------------------------------------------------------------------------------------Expecting ',' delimiter: line 10 column 3 (char 144)====================================================================================================All done. 3 errors found. 865 files OK.marufind: find particular content directoriesThis utility takes two required arguments: the first is a comma-separated list of JSON file types; the second is the path to the dataset.The default mode of the tool is to show directories that contain all the listed JSON file types. You can use the-anyor-onlyflags to match directories containing any of the listed types, or only the listed types. The optional-notflag will invert the results.# show directories containing both a videoComponent and textExercise filemarufindvideoComponent,textExercise<path-to-content># show the oppositemarufind-notvideoComponent,textExercise<path-to-content># show directories containing any of these filesmarufind-anyvideoComponent,textExercise<path-to-content># show directories not containing any of these filesmarufind-not-anyvideoComponent,textExercise<path-to-content># show directories containing only page, mail and dialog filesmarufind-onlypage,mail,dialog<path-to-content># invert this --- directories containing more than these filesmarufind-not-onlypage,mail,dialog<path-to-content>marupretty: bash utility to tidy up a file or content directory, requiresjqThis utility will format all files in the given directory, so you don't have to worry too much about whitespace and so on when modifying JSON files by hand.marupretty<path-to-content>Getting helpThe following commands can be used to get more information about the usage of the tools:maruval--help
marufind--help