This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
max96at's profile picture

Github Repository Downloader

Started by max96at, 11 September 2012 - 04:40 PM
max96at #1
Posted 11 September 2012 - 06:40 PM
Github Repositor Downloader


Did you ever wish you could download a program pack or

a custom ComputerCraft OS someone put up on github ingame?

Now you finally can!!!



News:
  • Updated to version 1.1

Features:
  • Download entire Github repositories by typing to your ComputerCraft computer
  • If you're playing on a server that has HTTP API enabled you can use this program to easily get your programs on a computer even if you can't access the server's files
  • Choose which branch you wan't and if you prefer just downloading a subdirectory of the repo that's possible too
  • Select where to place the repository on your computer
  • You can even blacklist paths for files that should not be downloaded
Requirements:
  • The HTTP API needs to be enabled in your ComputerCraft config
Credits:
  • m1cr0man for helping me understand lua better, optimizing parts of my code and saying "I don't ragequit on code, code ragequits on me" after hours of debugging
  • All the guys and girls at #computercraft for answering my questions and finding bugs in my program
Downloads:Changelog:
Spoiler1.1
  • The program won't check if a file was already downloaded by comparing against the filesystem anymore, instead it first puts all the paths in a table and downloads them afterwards. Essentially this allows you to overwrite already downloaded files if you use it a second time.
Kolpa #2
Posted 11 September 2012 - 07:07 PM
ah i did something similar for the team-econ installer was thinking about releasing it here but well :)/>/>
Tiin57 #3
Posted 12 September 2012 - 12:29 AM
ah i did something similar for the team-econ installer was thinking about releasing it here but well :)/>/>
Yeah, my git API accomplished the same thing, but bit by bit. Good job.
gknova61 #4
Posted 13 September 2012 - 09:00 AM
I've actually been thinking of using Github as a repository for my lua programs but thought it useless as I didn't have a way of downloading the repo and having it update on all my computers I have the software deployed to. 1dy later, someone comes out with this! This must be a dream. *Do not pinch me*
oggehej #5
Posted 31 October 2012 - 12:33 PM
Just getting the error: OS:333: Not an HTTP URL
Did I do something wrong? I downloaded it via the pastebin command.
Kolpa #6
Posted 02 November 2012 - 07:39 AM
github is using https calls you will have to upgrade your computer craft version to support https
oggehej #7
Posted 03 November 2012 - 12:21 PM
github is using https calls you will have to upgrade your computer craft version to support https
Can't do it since i'm on an tekkit server, but thanks anyway.
Kolpa #8
Posted 04 November 2012 - 06:59 AM
take a look at this library for lua only json http://regex.info/blog/lua/json if you want to move away from regex

you can also load it like this

local dec = http.get("http://regex.info/code/JSON.lua")
local JSON = loadstring(dec:readAll())()
jclark #9
Posted 04 November 2012 - 08:07 AM
Kolpa -

Do you have that JSON library working in CC? I can load the library, but I can't encode anything. Here's a simple test program:

Spoiler
local dec = http.get("http://regex.info/code/JSON.lua")
local JSON = loadstring(dec:readAll())()
local t = {a='apple', b='foo'}
local tj = JSON:encode(t)
print(tj)

This (and every variation I can think of) fails with
string:255: JSON:encode must be called in method format
. Looking at the code for JSON.lua, it's clear that encode is getting a value for self that it doesn't expect (line 797), but I don't know why. I'm pretty sure I'm using JSON:encode exactly as the sample code suggests.

I'm running CC1.45 on MC 1.3.2.

Thanks,
Jason
Kolpa #10
Posted 04 November 2012 - 10:34 AM
the whole thing working with an github downloader

https://github.com/K...o%20updater.lua

what you are trying to do is probably decoding not encoding :D/>/>

also though

JSON:encode(t)
doesnt seem to work this does:

JSON:encode_pretty(t)
if you really want to encode
jclark #11
Posted 04 November 2012 - 02:45 PM
the whole thing working with an github downloader

https://github.com/K...o%20updater.lua

Cool, but I only see decode

what you are trying to do is probably decoding not encoding :D/>/>

No, look at my code - I am trying to encode a lua table into JSON. I'll decode it later (on the other side of a rednet connection).

also though

JSON:encode(t)
doesnt seem to work this does:

JSON:encode_pretty(t)
if you really want to encode

Well, that does work - but trying to immediately decode it with JSON:decode() fails with the same error. Both encode() and decode() start with

if type(self) ~= 'table' or self.__index ~= OBJDEF then
but encode_pretty does not. Guess it's time to read the lua docs on objects and figure out why this fails. Interesting to note that your code works for you, with the call to decode().
Leo Verto #12
Posted 05 November 2012 - 01:14 AM
Really nice program, going to use this for my project soon.
ElvishJerricco #13
Posted 10 November 2012 - 03:34 PM
Thank you for this very useful tool! =D
RootUser #14
Posted 13 September 2015 - 10:02 PM
Ohh… awesome… i'll use it in my installer