franzliedke / studio

A workbench for developing Composer packages.
MIT License
1.14k stars 73 forks source link

Allow creating new packages from custom skeleton sources #15

Open sagikazarmark opened 9 years ago

sagikazarmark commented 9 years ago

Sometimes we have to follow rules about packages (eg. when developing a package in an organization). Would be awesome to be able create packages from existing sources, for example a skeleton repository.

franzliedke commented 9 years ago

Thanks for the input! Hmm, not sure about the best way to do this.

You could copy the package and then use the load command. As an alternative, I could add a --local flag similar to the --git option.

What do you think?

sagikazarmark commented 9 years ago

Both could work. I imagine some command/option which simply pulls down a repository (either form local or github, optionally accepts a branch name, and creates a new package based on that source.

Actually, this is not a major one. I usually use Jeffrey Way's Fetch plugin for sublime to create a new package from a skeleton. The reason I think it would be good is that by default studio asks a set of questions when creating a new package. If I have those pre-set in a skeleton repo, actually the questions does not add anything to the process, so the should be skipped.

franzliedke commented 9 years ago

Well, you can already use studio create --git repoaddress then.

You will only be asked those questions when you generate a new empty project.

sagikazarmark commented 9 years ago

But that will use the skeleton repo as origin, won't it? Also, it would preserve the history, which I don't want.

Ideally it should do the following:

git clone SKELETON_REPO package_name
rm -rf .git
git init
franzliedke commented 9 years ago

Interesting. Okay, that is a different use case, specifically for skeleton repos. Okay, we'll let this sit a bit, for now you can use a combination of the --git option and running these two commands by hand, okay?

sagikazarmark commented 9 years ago

Of course, I am not pushing anything. Thought it might be a useful thing.

dberry37388 commented 9 years ago

+1 on the skeleton repo, that's a great idea.

It would also be nice to be able to use a standard set of placeholders, (namespace, vendor, etc...) that will be replaced inside the files in the repo. Maybe recursively go through the files and regex replace the placeholders.

sagikazarmark commented 9 years ago

Yeah, that's a good idea. Currently I also do it by hand.

RemiCollin commented 9 years ago

Came accross this project which was a move in this direction : https://github.com/packedge/workbench/

Seem to have been abandonned half way though

sebastiaanluca commented 8 years ago

The regex replace thing would come in handy when starting a package from https://github.com/thephpleague/skeleton for instance. Currently throws a Composer\Json\JsonValidationException when using it with the --git argument since the placeholders aren't being replaced (and I hate to spend the 10 minutes doing a find/replace of all those placeholders each time I start a new package).