Skip to content

Commit

Permalink
Various changes, preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Feb 23, 2016
1 parent ee4f485 commit 3d76cf5
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 35 deletions.
9 changes: 8 additions & 1 deletion Howlfile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ Tasks:Task "license" (function(_, _, file, dest)
local handle = fs.open(File(dest), "w")
handle.write(contents)
handle.close()

end):Maps("wild:*.un.lua", "wild:*.lua")
:Description "Append a license to a file"

Tasks:Task "licenses" {}
:Requires { "build/bsrocks.lua", "build/bsrocks.min.lua" }
:Description "Generate licensed files"

Tasks:Task "build" {"clean", "licenses"} :Description "Main build task"
Tasks:Task "cleanup" (function()
fs.delete(File "build/bsrocks.un.lua")
fs.delete(File "build/bsrocks.min.un.lua")
end):Description "Destory unlicensed files"


Tasks:Task "build" {"clean", "licenses", "cleanup"} :Description "Main build task"
Tasks:Default "build"
66 changes: 37 additions & 29 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
# Blue Shiny rocks

Blue Shiny Rocks, or BSRocks for short serves two purposes:
- Emulation of the Lua 5.1 environment
- Lightweight implementation of [LuaRocks](https://luarocks.org/)

Most functionality of Lua 5.1 is implemented, with the following caveats:
- The [debug library](http://www.lua.org/manual/5.1/manual.html#5.9) is only partially implemented.
- `debug.traceback` does not accept threads
- `debug.getinfo` only accepts a numeric value
- `.getmetatable`, `.setmetatable`, `.getfenv` and `.setfenv` are just their normal versions
- Everything else is not implemented
- `string.gmatch` will infinitely loop on the `*` pattern (e.g. `\n*`)
- `os` library is only partially implemented

The LuaRocks implementation is very minimal:
- Currently only supports downloading GitHub repositories
- Only pure Lua libraries are supported

## Patchspec
The LuaRocks library also downloads "patchspec"s. These define modifications
required for a library to work in CC. The next big stage of this project is to
write ports and patches for key libraries:
- [LuaFileSystem](https://keplerproject.github.io/luafilesystem/)
- [Penlight](https://github.com/stevedonovan/Penlight)

The ultimate aim is to be able to run most pure Lua libraries with minimal, or no
patching. The repository for custom Lua ports and patchspecs is on a
[separate branch](https://github.com/SquidDev-CC/Blue-Shiny-Rocks/tree/rocks).
# Blue Shiny rocks

Blue Shiny Rocks, or BSRocks for short serves two purposes:
- Emulation of the Lua 5.1 environment
- Lightweight implementation of [LuaRocks](https://luarocks.org/)

Most functionality of Lua 5.1 is implemented, with the following caveats:
- The [debug library](http://www.lua.org/manual/5.1/manual.html#5.9) is only partially implemented.
- `debug.traceback` does not accept threads
- `debug.getinfo` only accepts a numeric value
- `.getmetatable`, `.setmetatable`, `.getfenv` and `.setfenv` are just their normal versions
- Everything else is not implemented
- `string.gmatch` will infinitely loop on the `*` pattern (e.g. `\n*`)
- `os` library is only partially implemented

The LuaRocks implementation is very minimal:
- Currently only supports downloading GitHub repositories
- Only pure Lua libraries are supported

## Getting started
- First install with Howl's webbuild: `pastebin run RcfW98XL SquidDev-CC/Blue-Shiny-Rocks -t build --once`
- Grab either `build/bsrocks.lua` or `build/bsrocks.min.lua`. We'll call this file `bsrocks`.
- Look for a package: `bsrocks search colours`
- Check it is the one you want: `bsrocks desc ansicolors`
- Install it: `bsrocks install ansicolors`
- Use it: `bsrocks repl` or `bsrocks exec myFile.lua`

You can also run `bsrocks help` for more information.

## Patchspec
The LuaRocks library also downloads "patchspec"s. These define modifications
required for a library to work in CC. The next big stage of this project is to
write ports and patches for key libraries.

The ultimate aim is to be able to run most pure Lua libraries with minimal, or no
patching. The repository for custom Lua ports and patchspecs is on a
[separate branch](https://github.com/SquidDev-CC/Blue-Shiny-Rocks/tree/rocks).
6 changes: 5 additions & 1 deletion bsrocks/commands/desc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ local function execute(name)
end

write(name .. ": " .. spec.version .. " ")
if isInstalled then
if spec.builtin then
printColoured("Built In", colours.magenta)
elseif isInstalled then
printColoured("Installed", colours.green)
else
printColoured("Not installed", colours.red)
Expand Down Expand Up @@ -68,6 +70,8 @@ local function execute(name)
local version = dependencies.parseVersion(current.version)
if not dependencies.matchConstraints(version, dependency.constraints) then
printColoured("Out of date", colours.yellow)
elseif current.builtin then
printColoured("Built In", colours.magenta)
else
printColoured("Installed", colours.green)
end
Expand Down
8 changes: 8 additions & 0 deletions bsrocks/commands/install.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
local install = require "bsrocks.rocks.install"

local description = [[
<name> The name of the package to install
[version] The version of the package to install
Installs a package and all dependencies. This will also
try to upgrade a package if required.
]]
return {
name = "install",
help = "Install a package",
syntax = "<name> [version]",
description = description,
execute = function(name, version)
if not name then error("Expected name", 0) end
install.install(name, version)
Expand Down
5 changes: 2 additions & 3 deletions bsrocks/commands/repl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ local function execute()
term.setTextColour(textColour)

local line = read(nil, history, autocomplete)
if not line then return end

if #line:gsub("%s", "") > 0 then
for i = #history, 1, -1 do
Expand All @@ -172,13 +173,11 @@ local function execute()
else
input = (" "):rep(#tostring(counter) + 3) .. "... "
end
elseif isEmpty then
else
execute(lines, true)
lines = {}
isEmpty = false
input = "In [" .. counter .. "]: "
else
isEmpty = true
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion bsrocks/rocks/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local function save(rockS, patchS)
local downloaded = download(rockS.source, files)

if not downloaded then
error("Cannot find downloader for " .. rockS.source.url, 0)
error("Cannot find downloader for " .. rockS.source.url .. ". . Please suggest this package to be patched.", 0)
end

if patchS then
Expand Down Expand Up @@ -88,6 +88,10 @@ local function install(name, version, constraints)

local rockspec = rockspec.fetchRockspec(server, name, version)

if rockspec.build and rockspec.build.type ~= "builtin" then
error("Cannot build type '" .. rockspec.build.type .. "'. Please suggest this package to be patched.", 0)
end

for _, deps in ipairs(rockspec.dependencies) do
local dependency = dependencies.parseDependency(deps)
local name = dependency.name
Expand Down

0 comments on commit 3d76cf5

Please sign in to comment.