it's my first tutorial so…
Step One
You shall be needing a GitHub repository - head to www.github.com and create an account.
Then you should create a new repository.
The name can be anything, Tungsten OS or such anything!
And the description is optional.
You don't need the .gitignore and license features yet since you haven't really made Tungsten OS proper yet. It is still under development.
Step Two
With a GitHub repository located at www.github.com/youname/theRepositoryName you can continue on here.
Now I have a nifty little program called (not mine) SourceTree which you can get here.
Setting up SourceTree
Spoiler
Now once it's installed you need to set it up.Step One
The first screen just needs you to put in your full name and email address (I used the one associated with GitHub)
Make sure you have all of the boxes ticked and agree to the license.
Step Two
The next screen is about SSH Client, click Use OpenSSH and click next.
Step Three
Now you must enter your GitHub user informations, such as your username and password.
Click finish.
Step Four
Now since SourceTree is setup - it's time to clone a repository.
Click the Clone/New button, you will have a window with 3 tabs, make sure you are on the Clone Repository tab.
You will the the field SourcePath/URL; look to the right of it and you'll see an icon of the world (a button), click it.
This will list all your repositories on the account.
Select the repository in that screen and click OK to go back to the window with three tabs.
The next field; Destination Path; is where the repository is managed on your computer.
So click the three dots next to the field and locate where you wish to save the repository. (For instance, I am using /c/users/me/documents/github/repo)
Do not make this your computer folder
Leave the folder to [Root].
Click the Clone button.
Step Five
Head into the folder you set as the destination path, and paste your programs or computer layout in there. (For instance, I'll put my OSes files in C:/users/me/documents/github/osros/)
Once you've done that head back into SourceTree and in the block 'Working Copy Changes' you will see all the files you've copied.
Click on one of the files in the block and hit CRTL+A to select all, then hit the Add button at the top. You will see those move to the Staged Changes.
Step Six
Click the Commit button next to the Clone/New button and write a nice little message to say why you're uploading the files.
Once you've done that click the Commit button.
Step Seven
Hit the Push button, in the same row as Add.
This will upload the files in your destination folder with the commit you wrote to your URL. Now if you go to www.github.com/yourUsername/repo and you should see all the files you put in the
destination folder.
That is SourceTree setup - When you wish to update the files just overwrite them in the destination folder and add them to the Staged Changes in SourceTree with a nice commit then Push them up.
They will change on GitHub.
The Installer
Note: You need the HTTP API enabled for this to work!
How to enable the HTTP API
Spoiler
To enable the HTTP API you need to head to the ComputerCraft Config in your Minecraft or modpack (computercraft.cfg). If you cannot find this, make sure you are in the rightdirectory, and if still not; search for computercraft.cfg. Now when you try and open that file, Windows will ask what do you want to do, click Search for Program to run with, and choose Notepad.
Once in; look for B:enableAPI_http=false and change the false to true.
Now, the file we shall be downloading is called 'startup', located at www.github.com/myName/repo/startup .
If you try to download that into ComputerCraft it'll show you all of the HTML details, which is useless - so we need the raw file which is found at
https://raw.github.com/me/repo/startup .
That is what we shall download.
So now to get, read and save 'startup' off GitHub, we shall use the code:
local download = http.get("https://raw.github.com/myName/repo/startup") --This will make 'download' hold the contents of the file.
local handle = download.readAll() --Reads everything in download
download.close() --remember to close download!
local file = fs.open("startup","w") --opens the file 'startup' with the permissions to write.
file.write(handle) --writes all the stuff in handle to the file 'startup'.
file.close() --remember to close download!
That is basically it!Now putting that code in for each file is a mission, so you can put it into a local function: (in the installer)
This code will make sure it downloaded it, else if it didn't the installer will return false with an error message.
local function get(repoFile,saveTo)
local download = http.get("https://raw.github.com/myName/repo/repoFile") --This will make 'download' hold the contents of the file.
if download then --checks if download returned true or false
local handle = download.readAll() --Reads everything in download
download.close() --remember to close the download!
local file = fs.open(saveTo,"w") --opens the file defined in 'saveTo' with the permissions to write.
file.write(handle) --writes all the stuff in handle to the file defined in 'saveTo'
file.close() --remember to close the file!
else --if returned false
print("Unable to download the file "..repoFile)
print("Make sure you have the HTTP API enabled or")
print("an internet connection!")
end --end the if
end --close the function
Now call this function with:
get("startup","startup") --remember the quotation marks! (" ")
That is basically it for an advanced installer of GitHub. That is exactly what the pastebin get program does, it just doesn't run with a function and has the URL www.pastebin.com/raw?i= (or whatever)
and saves the raw.
If you need any questions just ask me. ALSO if the code I posted errors just tell me - I posted it without testing…