Hi all. This is something I had initially built for myself, but after some polishing and refactoring it seems to be ready to be used by others (if there’s interest).
The basic idea is this:
You can version/source control your Codea projects by pushing the code to remote repositories on hosting sites, such as Github, Bitbucket, Gitlab, and so for. There are 2 parts to the system: a Codea app that you would run in your Codea workspace on iPad, and a web service that runs on my server at https://codea-scm.aws.mapote.com , which does the communications with repo hosting sites, and basically acts as a proxy for your source control actions.
The web site has install instructions and more detailed info, which is recommended to take a look at:
https://codea-scm.aws.mapote.com/
But if you are eager to get started, without reading any further, here’s the bootstrap installer for you:
--# Main
-- codea-scm bootstrap installer
function setup()
displayMode(STANDARD)
print("Installing codea-scm ...")
http.request("https://codea-scm.aws.mapote.com/install",
function (data, status, headers)
assert(loadstring(data))()
print("Installation complete. SUCCESS!")
print("Launch the project again to start using codea-scm.")
tween.delay(2.0, close)
end,
function (err)
print("PROBLEM downloading: " .. err)
end)
end
function draw()
background(37, 38, 50, 255)
end
Possible uses:
-
versioning and backups:
We are using true source control system, so yep we get the versioning from it. Backups are taken care off somewhat indirectly - by using remote repositories hosted at GitHub and other well known sites, (Presumably, they look after their storage systems and back them up regularly ) -
coding on both iPad and your laptop/desktop:
Some types of changes are just much easier to do on a computer. Vim, full keyboard, etc… You can do that, then commit and push your changes to the repository, then pull them to the iPad - to continue working there. -
code sharing:
The nice thing about repo hosting sites - such as GitHub and Bitbucket - they already have the infrastructure built around users and projects, and the logic and the UI all figured out. By hosting your repositories on one of those sites, you can leverage their access control mechanisms to share your Codea projects with just friends or everybody (or no one, if you don’t want to).
Limitations:
-
Right now only git is supported, although i tried to keep the web service and the app generic enough, so that other scm’s can be added in the future, if needed/wanted. For instance, Mercurial (Hg) and Subversion should not be hard to add support for.
-
You are limited to “Diff”, “Push”, and “Pull” operations. Anything more complex, you’d still need to do on your laptop/desktop. (Which is probably better kept that way anyway)
-
Only your source tabs are pushed/pulled. Assets, such as sprites, are not versioned. I still need to figure out a way to handle those.
###P.S.
Codea-SCM works on Codea 1.5.5 and Codea 2.0. However, with 2.0, there is a caveat to be aware of - related to http.request. It seems that in Codea 2.0, if you restart the project, http.request stops working (all requests just hang). Since Codea-SCM uses http.request quite a bit, the workaround is: don’t restart the project, simply close it, and then press the “play” button again. Then all should be good.