Created
June 1, 2013 14:20
-
-
Save simsaens/5690562 to your computer and use it in GitHub Desktop.
Juice AutoInstall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Juice Single Install | |
--Installer created by @acp edited by @Briarfox | |
--- This will pull the Juice project into Codea for you | |
-- Instructions: | |
-- * Create a new project in Codea named Juice If you chose another name please change the variable Below | |
--This is case sensitive | |
ProjectName = "Juice" | |
-- * Paste this into the Main (not from the raw view, as iSafari will escape special characters) | |
-- * Run, run again, | |
-- If all went well, you should have a Juice project now | |
function getJsonLib() | |
local tabs = listProjectTabs() | |
if #tabs == 1 then | |
print("Pulling JSON library into project...") | |
local handleSuccess = function(data) | |
saveProjectTab("json", data) | |
sound(SOUND_POWERUP, 42179) | |
print("Success! Please relaunch this project") | |
end | |
http.request("https://dl.dropboxusercontent.com/s/9e4nvqeu4hsux2q/Json.lua?token_hash=AAFyMB98j4bnt_1gawf9wSke52hsoC7hsIvARcTuZNeOEw&dl=1", handleSuccess) | |
return false | |
else | |
return true | |
end | |
end | |
function setup() | |
local handleSuccess = function(data,i,j) | |
if listProjectTabs(ProjectName) == nil then | |
sound(SOUND_EXPLODE, 32351) | |
error("AutoGist project must exist first") | |
end | |
local gist = json.decode(data) | |
local projName = ProjectName | |
for k,v in pairs(gist.files) do | |
local name = projName .. ":" .. string.gsub(k,".lua","") | |
saveProjectTab(name, v.content) | |
end | |
sound(SOUND_PICKUP, 11797) | |
print("Success!") | |
end | |
local handleFailure = function(data) | |
sound(SOUND_EXPLODE, 32351) | |
print(data) | |
end | |
if getJsonLib() then | |
http.request("https://api.github.com/gists/5690550",handleSuccess, handleFailure) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment