←  Programs

ComputerCraft | Programmable Computers for Minecraft

»

gitget - Version 2 release!

Obnoxious_Ninja's Photo Obnoxious_Ninja 30 Jun 2014

 Lua.is.the.best, on 07 June 2014 - 01:48 AM, said:

I.. sense.. AWESOMENESS!!
Now I can finally create an installer without creating a function called get(repo, file) and then calling it like a hundred times!!
Now, all I have to do is:
local username = "aepic999"
local repo = "MyProject"
function hte()
if fs.exists(gitget)
shell.run("gitget", username, repo)
else
print("GitGet application does not exist. Downloading...")
shell.run("pastebin", "get", "6aMMzdwd", "gitget")
shell.run("gitget", username, repo)
end
echo("Installed.")
end
if http then
print("HTTP enabled. You can continue.")
hte()
else
print("HTTP not enabled. App will not continue.")
end
while my other version that used get() was long, and I gave up when I reached the API folder.
EDIT: Put a measure in there to make sure it doesn't still run the code when HTTP API is off.
EDIT 2: Put the hte() function directly after the variables so the if wouldn't get confused, nor the function.
EDIT 3: And just to note, if you want to make this your own, change "username" and "repo", but KEEP THEM STRINGS! If you don't, the shell.run() calls I use will fail.
EDITSAURUS: You can hard-code the strings (hardcoded: not in variable or dependent on variables).

Well, it would be more user friendly if it looked more like:
local username = "aepic999"
local repo = "MyProject"
function hte()
  if fs.exists(gitget) then --You missed this
    shell.run("gitget", username, repo)
  else
    print("GitGet application does not exist. Downloading...")
    shell.run("pastebin", "get", "6aMMzdwd", "gitget")
    shell.run("gitget", username, repo)
  end
  if fs.exists("one of your files") then --You don't check if it was installed before saying it was installed
    print("Installed.") -- echo?
    else
      print("An error occured while attempting to install.")
  end
end

if http then
  print("HTTP enabled. You can continue.")
  hte()
  else
    print("HTTP not enabled. App will not continue.")
end
Quote

Lua.is.the.best's Photo Lua.is.the.best 10 Jul 2014

Uhm..
Still, doesn't look right.
You aren't putting else in the if, it's part of an if, so:
(Hint: It doesn't matter about indentation, indentation makes it look like it's in the function or whatever more)
if http then
  print("HTTP enabled. You can continue.")
  hte()
else
  print("HTTP not enabled. App will not continue.")
end

Edited by Lua.is.the.best, 10 July 2014 - 02:31 AM.
Quote

apemanzilla's Photo apemanzilla 27 Mar 2015

GitGet version 2 is released! Changes include:
  • Asynchronous downloads for huge speed increases
  • Will now retry failed files
  • Progress bar instead of spamming files
  • Bugfixes
  • More user-friendly preset mode
Tell me what you guys think!
Quote

Geforce Fan's Photo Geforce Fan 27 Mar 2015

I hope my installer still works, because it literly(don't judge) runs gitget off pastebin.
edit: you made a new pasteID. Will update it to that though.
Edited by Geforce Fan, 27 March 2015 - 02:02 AM.
Quote

apemanzilla's Photo apemanzilla 27 Mar 2015

 Geforce Fan, on 27 March 2015 - 02:00 AM, said:

I hope my installer still works, because it literly(don't judge) runs gitget off pastebin.
edit: you made a new pasteID. Will update it to that though.

Yeah, I purposely made it as a new paste just in case people were doing something like this. I recommend editing it and putting your own version of gitget on pastebin as an installer however. It's more flexible that way.
Quote

Geforce Fan's Photo Geforce Fan 27 Mar 2015

Woah. The new gitget is WAY faster.
Do you mind if I include this as a default program in my OS?
Edited by Geforce Fan, 27 March 2015 - 02:12 AM.
Quote

apemanzilla's Photo apemanzilla 27 Mar 2015

 Geforce Fan, on 27 March 2015 - 02:06 AM, said:

Woah. The new gitget is WAY faster.
Do you mind if I include this as a default program in my OS?

Nope, just add credits please :)

The way it works now is it sends ALL the file requests at once, then saves the files as the events for each one trigger. Previously, it would request one file, wait for it, save it, and then continue to the next one. So yeah, much faster :P

Edit: Just made a minor change to gitget that might help with operating system support (no longer requires the shell API)
Edited by apemanzilla, 27 March 2015 - 02:37 AM.
Quote

Geforce Fan's Photo Geforce Fan 27 Mar 2015

Most, if not all OSes give programs the Shell API. Mine does, it even uses it itself!
Edited by Geforce Fan, 27 March 2015 - 08:48 PM.
Quote

apemanzilla's Photo apemanzilla 28 Mar 2015

 Geforce Fan, on 27 March 2015 - 08:47 PM, said:

Most, if not all OSes give programs the Shell API. Mine does, it even uses it itself!

Just to be safe ;)
Quote

sandalle's Photo sandalle 31 Mar 2015

Hey apemanzilla, thanks for putting this together. :) I was looking at ways to update https://github.com/s...eactor_control/ in pastebin via WebHooks, but pastebin only seems to allow for creating new entries and not updating existing ones with the API, plus I couldn't seem to modify the WebHooks to be very versatile in what they send to pastebin.

So, I'm looking at using this for pulling down updates, but I would like to only pull from the latest post in https://github.com/s...ontrol/releases (see https://github.com/s...releases/latest for always latest release) and not every commit to master (since that's where semi-tested and untested code goes, especially when merging pull requests :)). I don't need the whole ZIP or .tar.gz file, just a specific file ( e.g. latest release is 0.3.16 with https://github.com/s...onitor_prog.lua ), though grabbing the ZIP or .tar.gz and uncompressing would work, too.

I did not see gitget (nor gitget2) on https://github.com/a...ab=repositories to submit an enhancement request. :)
Quote

apemanzilla's Photo apemanzilla 02 Apr 2015

 sandalle, on 31 March 2015 - 09:51 PM, said:

Hey apemanzilla, thanks for putting this together. :)/> I was looking at ways to update https://github.com/s...eactor_control/ in pastebin via WebHooks, but pastebin only seems to allow for creating new entries and not updating existing ones with the API, plus I couldn't seem to modify the WebHooks to be very versatile in what they send to pastebin.

So, I'm looking at using this for pulling down updates, but I would like to only pull from the latest post in https://github.com/s...ontrol/releases (see https://github.com/s...releases/latest for always latest release) and not every commit to master (since that's where semi-tested and untested code goes, especially when merging pull requests :)/>). I don't need the whole ZIP or .tar.gz file, just a specific file ( e.g. latest release is 0.3.16 with https://github.com/s...onitor_prog.lua ), though grabbing the ZIP or .tar.gz and uncompressing would work, too.

I did not see gitget (nor gitget2) on https://github.com/a...ab=repositories to submit an enhancement request. :)/>
Try putting releases in a separate branch. Then you can use gitget2 to download just the necessary branch. For example, merge the latest "release" code into the branch "releases" and then run "gitget sandalle minecraft_bigreactor_control releases" to download it.

I'm keeping gitget2 on pastebin so you can download it without needing a version of gitget.
Quote

houseofkraft's Photo houseofkraft 08 Mar 2017

May I turn GitGet into an API so I can use it for my program.
Quote

apemanzilla's Photo apemanzilla 09 Mar 2017

 houseofkraft, on 08 March 2017 - 10:38 PM, said:

May I turn GitGet into an API so I can use it for my program.

Sure, but please add my name in the credits.
Quote