Locally shared common code or plugin possible?

Hi all,

 

is there a simple way to locally share some common code with multiple projects?

I do have some code I want to use in multiple projects/prototypes I’m working on in parallel and I wonder if there’s a way other than manually synchronizing these files over all the active projects?

I tried to append a path to package.path but that didn’t work.

Is there any other way? A way to locally create a plugin used in multiple projects?

Thanks,

Michael

I don’t know of a Corona specific way, however, what we do is have our main Serenity framework ( at Glitch ) and my own personal Puggle library set up as repos on BitBucket, then when we create a new game we naturally have that setup as a bitbucket repo as well.

We can then easily add those frameworks as submodules to our games, allowing the latest code to get pulled from the individual repos and any changes we make in the game repo can then get pushed back to the library repos ready for all other games that use them ( hopefully that makes some kind of sense? )

When we want to pull down the serenity framework into our new game, we just use this command:

git submodule add https://bitbucket.org/path/to/repo serenity

A bit more info about submodules can be read here - http://blogs.atlassian.com/2011/12/git-submodules/

Please note though, I am by no means a Git expert. All I know is that this works for us. There are possibly other ( probably better ) ways to do this, but this works.

Thanks for your reply - such a setup of course makes a lot of sense and I’ve used a similar one for many projects and years with Subversions externals.

For a mature setup it’s a decent solution, for now I just look for something even faster and fully automated as I kind of work on multiple prototypes at the same time and write some framework code - I guess it would be even possible to start multiple Corona simulators at the same time or even more extreme, having multiple prototypes deployed and updated using LiveBuilds at the same time (haven’t tested this, so I’m not sure this is possible).

Anyway - I’ll see what I’ll do, there’s always the option to write a small tool/python script running in the background and distributing any changed file into my projects.

I’ve never tried, but could symbolic links to a directory work at all for a require call?

Thanks for the idea - works like a charm.

@Graham,

Symbolic links work fine under Windows.  I think they work in OS X too.

I use this script in my ‘common code/asset’ projects:

rmdir ssk2 rmdir images rmdir sounds rmdir factories mklink /j .\ssk2 X:\Work\00\_CurentProjects\Corona\SSK2\ssk2 mklink /j .\images X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\images mklink /j .\sounds X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\sounds mklink /j .\factories X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\factories

That’s great that they work. I’ve always meant to try but never got around to it. Would certainly be useful when I’m making little throwaway prototypes that I don’t want to make a full repo for.

Well actually there’s a tiny inconvenience, Corona simulator doesn’t autoload a changed file within a symbolic linked folder but that’s ok for now as I can switch apps, reload the project and switch back to the editor without thinking :slight_smile:

Maybe I should try if hard links work even better, but even as it is now, it’s great already.

I don’t know of a Corona specific way, however, what we do is have our main Serenity framework ( at Glitch ) and my own personal Puggle library set up as repos on BitBucket, then when we create a new game we naturally have that setup as a bitbucket repo as well.

We can then easily add those frameworks as submodules to our games, allowing the latest code to get pulled from the individual repos and any changes we make in the game repo can then get pushed back to the library repos ready for all other games that use them ( hopefully that makes some kind of sense? )

When we want to pull down the serenity framework into our new game, we just use this command:

git submodule add https://bitbucket.org/path/to/repo serenity

A bit more info about submodules can be read here - http://blogs.atlassian.com/2011/12/git-submodules/

Please note though, I am by no means a Git expert. All I know is that this works for us. There are possibly other ( probably better ) ways to do this, but this works.

Thanks for your reply - such a setup of course makes a lot of sense and I’ve used a similar one for many projects and years with Subversions externals.

For a mature setup it’s a decent solution, for now I just look for something even faster and fully automated as I kind of work on multiple prototypes at the same time and write some framework code - I guess it would be even possible to start multiple Corona simulators at the same time or even more extreme, having multiple prototypes deployed and updated using LiveBuilds at the same time (haven’t tested this, so I’m not sure this is possible).

Anyway - I’ll see what I’ll do, there’s always the option to write a small tool/python script running in the background and distributing any changed file into my projects.

I’ve never tried, but could symbolic links to a directory work at all for a require call?

Thanks for the idea - works like a charm.

@Graham,

Symbolic links work fine under Windows.  I think they work in OS X too.

I use this script in my ‘common code/asset’ projects:

rmdir ssk2 rmdir images rmdir sounds rmdir factories mklink /j .\ssk2 X:\Work\00\_CurentProjects\Corona\SSK2\ssk2 mklink /j .\images X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\images mklink /j .\sounds X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\sounds mklink /j .\factories X:\Work\00\_CurentProjects\Corona\SSK2\releases\ssk2\_pro\extras\factories

That’s great that they work. I’ve always meant to try but never got around to it. Would certainly be useful when I’m making little throwaway prototypes that I don’t want to make a full repo for.

Well actually there’s a tiny inconvenience, Corona simulator doesn’t autoload a changed file within a symbolic linked folder but that’s ok for now as I can switch apps, reload the project and switch back to the editor without thinking :slight_smile:

Maybe I should try if hard links work even better, but even as it is now, it’s great already.