Awesome
Mumukit
Micro framework for quickly implement Mumuki runners
TL;DR
The best way to start using mumukit
is with mumukit-bootstrap, and reading our online documentation in develop.mumuki.io
Installing
You usually add mumukit to an empty project. First you need to add it to your Gemfile:
gem 'mumukit'
or, if you want latest version:
gem 'mumukit', github: 'mumuki/mumukit', branch: 'master'
And then bundle install
Ruby Version
mumukit
works with Ruby 2.0-2.3
Getting started
Seed
The easiest way of getting started is by using using the seed/seed.sh
script.
- Clone this project in a clean directory:
git clone https://github.com/mumuki/mumukit
- Go to
seed
directory:cd mumukit/seed
- Run the script:
./seed.sh
- Follow instructions.
Hooks
mumukit
is a framework where nearly everything is a hook - a class you must implement following some naming and method conventions.
In order to implement a Mumuki Runner with mumukit
, you need zero or more of the following:
query_hook
: lets runner to run queries like in a native consoleversion_hook
: lets runner to specify a versionfeedback_hook
: lets runner to generate explanations of compiler/interpreter toolsexpectations_hook
: lets runner to execute expectationsvalidation_hook
: lets runner to validate request in order to detect malicious code
Components
In addition, mumukit
provides some components to make implementation of hooks easier:
Mumukit::IsolatedEnvironment
Mumukit::Cookie
Mumukit::Metatest
Mumukit::Explainer
Templates
Also, mumukit
provides templates that implement some specialized use cases hooks:
Mumukit::Hook
: the base hook. It lets to read environment variables and translationsMumukit::Templates::FileHook
: allows to implementtest_hooks
andquery_hooks
that interact with external command line tools using files and command line argumentsMumukit::Templates::MulangExpectationsHook
: allows to implementexpectation_hooks
that rely on mulang tool
Extensions
Finally, mumukit
templates provides the following extensions - features that can be activated in some hooks
:
Mumukit::Hook
stateful_through
: lets to handle cookies. Useful inquery_hooks
.
Mumukit::Templates::FileHook
:line_number_offset
: lets you specify line number offset, so that line numbers reported by compilers and interpreters matches content.structured
: lets to process JSON output from external commandsmashup
: lets to generate source code filesisolated
: lets to run commands within docker or in native environmentMumukit::Templates::MulangExpectationsHook
include_smells
: lets to include in the result smells produced by mulang
Server extensions
If you need to serve assets, you can include the Mumukit::Server::WithAssets
mixin which enables cross origin requests and provides get_asset
and get_local_asset
methods