Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request : Ability to create project in current (Existing) directory. #1135

Closed
purplefish32 opened this issue Sep 21, 2012 · 27 comments
Closed
Labels
Milestone

Comments

@purplefish32
Copy link

I would really like to be able to override the create-project test that disallows installation if the destination directory exits.

What I am trying to achieve :

php composer.phar create-project symfony/framework-standard-edition . 2.1.1

I am aware that in the documentation it states : "The directory is not allowed to exist, it will be created during installation."

My feature request is to be able to override the test (Something like --force) so that I can install in the current directory where the only other file is composer.phar anyway

@stof
Copy link
Contributor

stof commented Sep 21, 2012

Well, what should it do in such case ? delete the folder first to be able to install the package properly ? Merging existing content with the content of the package is not a safe install.

I don't really think the amount of work for this is worth it.

Btw, git or svn don't allow you to clone to in an existing folder either (which would make the work even harder for us by having to implement some workaround for the GitDownloader and the ZipDownloader btw)

@cs278
Copy link
Contributor

cs278 commented Sep 21, 2012

Both git and svn allow you to clone into an existing directory, but it must be empty.

@fprochazka
Copy link
Contributor

I think this might be handy, if allowed only for empty directories.

@smasty
Copy link
Contributor

smasty commented Sep 22, 2012

I vote for ability to create a new project in an existing empty directory, the same way as git allows you to.

@purplefish32
Copy link
Author

I would just add : If the only file in the directory is composer.phar then treat the directory as empty

@stof
Copy link
Contributor

stof commented Sep 22, 2012

@purplefish32 why ? It would make it still have the same issue: git and svn don't allow to clone in a non-empty directory, thus requiring to implement some workaround.

@purplefish32
Copy link
Author

@stof Just for the sake of simplicity, I am scripting a custom installer for Symfony and a few bundles via ServerTools (https://github.com/JoshuaEstes/ServerTools), seems logic to me to create a new project folder then the script will pull in composer, set up symfony etc...
Plan B is to set up Symfony in a temp (blank) folder then move everything back

@stof
Copy link
Contributor

stof commented Sep 23, 2012

@purplefish32 but why would you need to put composer in the folder in which the project will be setup ? Couldn't you put it in the parent folder ?

@purplefish32
Copy link
Author

@stof I guess I can live with that

@fprochazka
Copy link
Contributor

And why can't you have composer in system-wide directory? Like /usr/local/bin/composer ?

@purplefish32
Copy link
Author

@hosiplan Allthough this may at first seem to be the ideal solution (It is the one I use when not trying to script installs), I see a few drawbacks when
using this solution from within the app installer.

  1. I don’t want to rely on what the user has already installed or not (composer)
  2. The user may have changed the symlink (comp ...)
  3. Impossible to tell whether the installed version of composer is the latest (App would crash saying composer needs self update)
  4. I much prefer the method used by Capifony/Capistrano for deploying symfony apps : curl the latest version of composer into the current directory

I do understand that Capistrano clones the repo before installing composer via curl and that there must be some issues with
git/svn needing a workaround. I'm just suggesting that if there is a quick and easy hack/workaround to this problem it would be a cool feature to add.

As I said before if this is really too difficult I will stick with my plan B and install via a temp directory.

@fprochazka
Copy link
Contributor

@purplefish32: Imho that's responsibility of system administrator - not programmer.

But I agree this would be neat if allowed for emty directories, ignoring composer.phar file.

@Seldaek
Copy link
Member

Seldaek commented Sep 26, 2012

It sounds to me like it's not worth the trouble (at least the composer.phar thing, because most likely to allow this we need to rm the dir, chdir to the parent and then run the code), but if someone gets it to work without too much insanity I'm not against it.

cordoval pushed a commit to cordoval/composer that referenced this issue Oct 12, 2012
… tests, and update to Composer/Downloader/VcsDownloader.
cordoval pushed a commit to cordoval/composer that referenced this issue Oct 12, 2012
cordoval added a commit to cordoval/composer that referenced this issue Oct 12, 2012
@jovobe
Copy link

jovobe commented Nov 8, 2012

+1

1 similar comment
@leftouterjoins
Copy link

+1

@cordoval
Copy link
Contributor

thanks guys, eve though authors are not commenting i am positive on this one too, let's work on this on the weekend @bzitzow see you then

@Seldaek
Copy link
Member

Seldaek commented Nov 14, 2012

As I said before (not sure if it was in person at SfLive SF or here, but whatever) I will accept this as creating a project in an existing empty directory. If it has content, you can't do anything. That's how git & friends work and I think it makes a lot of sense, rm -rf should be able to reverse whatever you did in an easy way, and if we start mixing stuff with existing files that goes against this.

@ph-il
Copy link

ph-il commented Jan 14, 2014

@Seldaek I do have a case where it might be very helpfull : I did a composer "project", that will help us to do migration from legacy application. So all old code are moved in a directory call legacy, then we can now call Composer. But for now, I need to create a new project, then copy all files in the old project.

@Seldaek
Copy link
Member

Seldaek commented Jan 15, 2014

@ph-il that sounds like a pretty temporary use case for a one-time conversion. Not really something I would consider valid in the bigger picture, and anyway this is just not feasible easily due to git constraints etc, so it's very unlikely it will happen.

@courtney-miles
Copy link

I found this thread when looking for such a feature.

My case is that I'm starting a new project and I'm using Vagrant. I need a place to put the vagrant files, which i've put in the project root (typical practice, I believe). But after starting Vagrant, which automatically mounts the project folder, I can't create a Symfony project because the folder is already populated with vagrant files.

So I have to install Symfony into it's own folder within the project, which is redundant. It's obviously not the worst thing in the world. It's just extra trouble to achieve the folder structure I had in mind.

@MickL
Copy link

MickL commented Oct 12, 2014

Also i create an emtpy project with PHPStorm. I want to install Symfony2 within PHPStorm terminal but it says directory already exists. So i have to create it into a new folder and copy the content into the root.

I would be cool to have a --force command.

@abudayah
Copy link

+1

2 similar comments
@mobula9
Copy link

mobula9 commented Oct 21, 2014

👍

@chiliec
Copy link

chiliec commented Nov 19, 2014

+1

@illegalnumbers
Copy link

+1

@andreas-bergstrom
Copy link

I was searching for this feature as well. Although using git clone to current directory works, it would by nice if composer itself supported it.

@arnaudbaali
Copy link

👍

@composer composer locked and limited conversation to collaborators Dec 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests