Remove rake dependency
kikito opened this issue · 0 comments
Rake was introduced as a "quick and dirty" commodity - Lua missions was inspired by Ruby Koans, so it was easy to just copy the Koans' rakefile and start from there.
Much as I like ruby, I think requiring it just to work with some Lua files is a bit weird. Ideally, if you already have Lua, you shouldn't need anything else to work with the lua-missions (appart from git, if you are making a pr)
The current rakefile has the following tasks:
$ rake -T
rake git:add # add all the modifications to the git repository, including deletions
rake git:commit # Commit with a message
rake git:push # Push to origin
rake git:release # regenerate missions & push to the git repository
rake missions:delete # Delete the generated mission files
rake missions:gen # Generate the Missions from the changed source files
rake missions:regen # Generate the Missions from the source files from scratch
rake missions:run # Trying to execute the missions
rake missions:run_src # Execute the solved missions
- All the tasks in the
git
namespace (git:add
, etc) can be ignored - most of them can be replaced by 1 or 2 simple git commands. missions:delete
is only a "pre-task" used bymission:regen
missions:gen
is a nice-to-have, but isn't really needed (as long as you havemissions:regen
)missions:run
does literallycd missions; lua missions.lua
. Andmissions:run_src
does something similar. I am quite tempted to just ignore them. If not, creating a lua script which executes them is fairly trivial.
So I think only missions:regen
is needed. What I am thinking about is a lua script called script/generate.lua
, which does what missions:regen
currently does:
- Remove the missions folder and recreate it.
- For each file inside src:
- Replace
__(<anything>)
by__
- Delete the lines between
-- begin skip
and-- end skip
, both included
- Replace
This is troublesome for several reasons:
- Getting a list of files inside a folder isn't possible in vanilla Lua. And I really would want to avoid requiring luarocks and luafilesystem just for this.
- I am not sure Lua's patters are strong enough to allow easily replacing
__(<anything>)
. In the current rakefile this is done using regular expressions.
The CONTRIBUTING file would have to be updated too, before this issue is closed.