Project importing

We’re going to try to bring back project importing in the next update for Codea (2.3.3). You will be able to import any zip file and Codea will prompt you to choose to import projects, assets, or asset packs contained within.

You can see a demo here https://twitter.com/TwoLivesLeft/status/821526874492809216

Hopefully Apple will allow the feature to come to Codea :grin:

Can’t Wait For this,
It will make my life way easier!
:smile:

@Simeon I saw that video yesterday on your twitter, and I had a question. When it says “export projects”, will it export all the projects?

@Simeon Not sure what all this will do, but will this eventually allow backing up and restoring projects to Dropbox. You say it will allow importing zip files, will it also handle non zip files.

@dave1707 what sort of files would you like it to handle?

@CamelCoder that feature will export everything except the example projects (all your assets, asset packs, projects, and so on).

@Simeon Would it be able to handle straight text files. I currently backup 474 projects in a single 1.3MB text file I store in Dropbox. I can manually restore any project from that file in about 30 seconds, but without an option to create projects/tabs under program control it would take a long time if I had to restore every project. Is what you’re talking about going to be a way to backup and restore projects.

@dave1707 I think your solution is very advanced. We could allow Codea to import plain text files, but it seems like it might be more helpful to you if we provide an API to create and delete projects?

@Simeon Creating a project ( issue #327 in 2014 ) along with listProject ( issue # 235 in 2013) were requested in the issue tracker so that we could create some backup and restore programs. Are you saying we might finally get those.

@dave1707 Yes I would like to finally add those if they will be valuable for you.

@dave1707 I’ve added the following API for projects:

createProject(name)

deleteProject(name)

listProjects()
listProjects(collection)

create/delete project functions take a name string as argument. The string can be a single project name (e.g., “My Project”), or it can fully specify a collection and project (e.g., “Examples:Anagrams”).

If createProject is used and the collection does not exist (e.g., createProject("Libraries:Test")) then that collection of projects will be created.

createProject creates a standard blank project by default. That is, it has the default Main tab code that Codea normally creates from the UI.

You cannot delete the project that is currently running. Deleting the last project from a collection will delete the entire collection.

listProjects will list all projects by default with fully qualified names. If given the name of a collection it will only list projects in that collection. The default collection for your projects is reserved under the name “documents”.

@Simeon Thank You. I’ve been waiting for those for several years. I wonder if a maxCreate variable would be needed to prevent someone from creating unlimited projects in a loop gone wild. The variable could have an initial value of say 20, but can be changed to some other value if the person knows they’ll create more projects.

Any chance you could test it with the iOS app Working Copy? It would be great if you could export/import it into Working Copy and then sync right to your GitHub account. This would make creating a project in groups much, much easier.
(Something I struggle with every year with my students).

Another app to test with is Git2Go.

@MrCoxall I’ll be doing a proper integration with Working Copy (and others) once Apple approves 2.3.3 with project import. It’s still “In Review”, I need to find out why it’s taking so long.

Hi @Simeon,

Tried out the project API and the commands you listed. Set up the following code in a library tab and called the relevant functions. Managed to delete and create files and list projects to list a library or examples.


function projNew(name)
--
    createProject(name)
end

function projDump(name)
    --
    deleteProject(name)
end

function projCheck(name)
    --
    local lp = {}
    lp = listProjects(name)
    for x = 1, #lp do
        print(x,lp[x])
    end
end

Thanks for this ran on iPad Pro.

Bri_G

P.s. Been trying to replicate the touch problem I mentioned earlier but inconsistent, and haven’ t been able to get the endend problem. I have noticed my iPad Pro is sometimes less sensitive to touch than my iPad2 - may be just my kit!

Copied to project beta