{"action":"created","issue":{"url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/10","labels_url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/10/comments","events_url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/10/events","html_url":"https://github.com/loadsys/puphpet-release-composer-installer/pull/10","id":68498502,"number":10,"title":"Properly handle consuming projects without a .gitignore","user":{"login":"deizel","id":24155,"avatar_url":"https://avatars.githubusercontent.com/u/24155?v=3","gravatar_id":"","url":"https://api.github.com/users/deizel","html_url":"https://github.com/deizel","followers_url":"https://api.github.com/users/deizel/followers","following_url":"https://api.github.com/users/deizel/following{/other_user}","gists_url":"https://api.github.com/users/deizel/gists{/gist_id}","starred_url":"https://api.github.com/users/deizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deizel/subscriptions","organizations_url":"https://api.github.com/users/deizel/orgs","repos_url":"https://api.github.com/users/deizel/repos","events_url":"https://api.github.com/users/deizel/events{/privacy}","received_events_url":"https://api.github.com/users/deizel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-14T21:13:45Z","updated_at":"2015-04-15T13:24:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/pulls/10","html_url":"https://github.com/loadsys/puphpet-release-composer-installer/pull/10","diff_url":"https://github.com/loadsys/puphpet-release-composer-installer/pull/10.diff","patch_url":"https://github.com/loadsys/puphpet-release-composer-installer/pull/10.patch"},"body":"Found this during my testing, a nice big red error if the consuming project doesn't have a `.gitignore` file.\r\n\r\n```shell\r\n ❯ composer update\r\nLoading composer repositories with package information\r\nUpdating dependencies (including require-dev)\r\n  - Installing symfony/filesystem (v2.6.6)\r\n    Loading from cache\r\n\r\n  - Installing loadsys/puphpet-release-composer-installer (0.0.4)\r\n    Loading from cache\r\n\r\n  - Installing loadsys/puphpet-release (dev-master 0d02e12)\r\n    Cloning 0d02e12455a9f1c6140705ff3bd7930607a68ac7\r\n\r\n  [ErrorException]\r\n  file(/private/tmp/puppet-release-test/.gitignore): failed to open stream: No such file or directory\r\n```\r\n\r\nUsing PHP's `touch()` prevents this error from occurring."},"comment":{"url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/comments/93395631","html_url":"https://github.com/loadsys/puphpet-release-composer-installer/pull/10#issuecomment-93395631","issue_url":"https://api.github.com/repos/loadsys/puphpet-release-composer-installer/issues/10","id":93395631,"user":{"login":"beporter","id":637270,"avatar_url":"https://avatars.githubusercontent.com/u/637270?v=3","gravatar_id":"","url":"https://api.github.com/users/beporter","html_url":"https://github.com/beporter","followers_url":"https://api.github.com/users/beporter/followers","following_url":"https://api.github.com/users/beporter/following{/other_user}","gists_url":"https://api.github.com/users/beporter/gists{/gist_id}","starred_url":"https://api.github.com/users/beporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beporter/subscriptions","organizations_url":"https://api.github.com/users/beporter/orgs","repos_url":"https://api.github.com/users/beporter/repos","events_url":"https://api.github.com/users/beporter/events{/privacy}","received_events_url":"https://api.github.com/users/beporter/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T13:24:30Z","updated_at":"2015-04-15T13:24:30Z","body":"I'd like to discuss the behavior here a bit.\r\n\r\nIf  `.gitignore` file is already present, it's safe to assuming that the consuming project is using git, and thus we should be helpful and add the necessary entries. So far, so good.\r\n\r\nHowever, if no `.gitignore` is present, the consuming project _may_ be using git, or they could be using Mercurial or Subversion or nothing at all. While I'm content not adding support for exclusion mechanisms used by other version control systems until there is a demand for them, I'm not sure we should presume to add a potentially unnecessary .gitignore file to the consuming project.\r\n\r\nThere are a few solutions I can think of:\r\n\r\n* Merge this PR and just blindly assuming a git VCS environment, always creating a `.gitignore` even if there wasn't one.\r\n* Check for the presence of an existing `.gitignore`, and only make the additions if the file is present already. This has the downside of missing a case where the consuming project is using git but hasn't had a need for a `.gitignore` file yet (which seems unlikely based only on my own person experience, but nevertheless, a risk.)\r\n* Check for a `.git/` folder to determine whether to create/update the `.gitignore` file. This option seems the most reliable to me, but I'm definitely open to feedback.\r\n\r\nIn any case, it's clear that the `try/catch` block that was intended to already handle the case of a missing .gitignore file is not sufficient, since `file()` seems to throw an error instead of an exception. I think no matter what we need to clean that up.\r\n\r\nDoes anybody have any thoughts they'd like to contribute?"}}