Skip to content

Commit

Permalink
Added development dependency installation and updated README.md to co…
Browse files Browse the repository at this point in the history
…ver development dependency installation and the spec generator
  • Loading branch information
ryanplusplus committed Sep 7, 2024
1 parent 2df17be commit 0a7151b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ Exercism exercises in Lua

## Setup dev environment for contributing

Install Lua, Luarocks, and the Busted testing framework according to the
[installation instructions][1] for your platform.
Install Lua and Luarocks according to the [installation instructions][1] for your platform.
Then, install all additional development dependencies with:

```shell
$ ./bin/install-dev-dependencies
```

To contribute a patch you will need a GitHub account and you will need to fork
the *exercism/lua* repo to your account.
Expand Down Expand Up @@ -42,6 +46,20 @@ Rename *bob.lua* to *example.lua*, and add the exercise to the [lua/config.json]

0 directories, 2 files

Optionally, you can generate the spec from the upstream canonical data.
To use the spec generator, create a file called `spec_generator.lua` in the `.meta/` directory of the exercise.
This file should be a Lua module returning a table with two fields:
- `module_name` - A string containing the name of the Lua variable to which the module under test will be bound
- `generate_test` - A function that returns a string representation of a test given the corresponding case from the canonical data.

To use the test generator, run:

```shell
$ ./bin/generate-spec <exercise name>
```

This will use `curl` to fetch the canonical data from the upstream repository, generate the spec file, and format it.

## Contributing Guide

Please be familiar with the [contributing guide][6] in the docs repository.
Expand All @@ -52,7 +70,6 @@ This describes some great ways to get involved. In particular, please read the

Pleases see the [Useful Lua Resources][8] page.


## Lua icon
The Lua icon is inspired by the [Lua logo][9], which was designed by Alexandre Nakonechnyj.

Expand Down
5 changes: 5 additions & 0 deletions bin/install-dev-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

luarocks install --server=https://luarocks.org/dev --only-deps dev-dependencies-git-0.rockspec
19 changes: 19 additions & 0 deletions dev-dependencies-git-0.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package = 'dev-dependencies'
version = 'git-0'
source = {
url = 'https://github.com/exercism/lua'
}
description = {
summary = 'Development dependencies for the Exercism Lua track.',
homepage = 'https://github.com/exercism/lua/'
}
dependencies = {
'lua >= 5.3',
'busted >= 2.2.0-1',
'dkjson ~> 2.8-1',
'luaformatter'
}
build = {
type = 'builtin',
modules = {}
}

0 comments on commit 0a7151b

Please sign in to comment.