First version. It's a bit of a hot mess but it'll let me program with my

own text editor, and that's what i need rn.
This commit is contained in:
lordtet 2025-08-13 00:09:09 -04:00
parent e710bd4155
commit fa7dde7961
2 changed files with 69 additions and 1 deletions

View file

@ -1,3 +1,23 @@
# OCWorkflow
Some workflow related items i thought would be helpful for programming with OpenComputers on a Server
Some workflow related items i thought would be helpful for programming with OpenComputers on a Server
## Setup
### The Projfile
The syntax here was inspired by `make` (a la autoconf). Simply running `ocbuild` with a Projfile in your directory will go.
As of now, the profile is simple, and looks like so:
`IP_OF_PROJECT_HTTP_SERVER,NAME_OF_PROJECT`
For example, if I have my project on an http server at 192.168.0.44, and the directory specs are in myproj.proj, it would look like so:
`192.168.0.44,myproj`
### Steps
- (Optional) make a project file called "Projfile" in your working directory. The format of the Projfile is specified above.
- Set up an http server whever you want to pull your files from. The server portion is directory-agnostic - the specified HTTP server can be a subdirectory of that server, instead of just the root IP.
- Make sure your project directory has a .proj project store. It simply lists the files to pull, seperated by newlines. These can be subdirectories as well.
- See Usage below.
## Usage
Just run it! If you don't want to use a project file, it will accept a server to pull from and a project file to read as arguments 1 and 2, like so:
`ocbuild IP_OF_PROJECT_HTTP_SERVER PROJNAME`

48
ocbuild.lua Normal file
View file

@ -0,0 +1,48 @@
local internet = require("internet")
local shell = require("shell")
local arg = {...}
local fs = require("filesystem")
local req = ""
local srcserv = ""
local srcproj = ""
if arg[1] ~= nil or arg[2] ~=nil then
srcserv = arg[1]
srcproj = arg[2]
elseif fs.exists(shell.getWorkingDirectory() .. "/Projfile") then
print("pulling from Projfile...")
projfile = shell.getWorkingDirectory() .. "/Projfile"
file = fs.open(projfile,"r")
if file == nil then
print("Need a project file or supplied project info!")
return
end
srcuncut = file:read(256)
local cut = string.find(srcuncut, ",")
srcserv = string.sub(srcuncut, 0, cut - 1)
srcproj = string.sub(srcuncut, cut + 1)
print(srcserv)
print(srcproj)
else
print("No args and no project file - no idea what to do! Abort.")
return
end
print("Requesting " .. "http://" .. srcserv .."/" .. srcproj .. ".proj")
local handle = internet.request("http://" .. srcserv .. "/" .. srcproj .. ".proj")
files = ""
for chunk in handle do
files = chunk
end
for str in string.gmatch(files, '([^' .. '\n' .. ']+)') do
shell.execute("wget -f http://" .. srcserv .. "/" .. str)
end
shell.execute("main")