kenjis / codeigniter-composer-installer

Installs the offical CodeIgniter 3 with secure folder structure via Composer
MIT License
377 stars 118 forks source link

Errors when using composer.phar #5

Closed Philio closed 7 years ago

Philio commented 8 years ago

If you install composer via the standard method from their website:

curl -sS https://getcomposer.org/installer | php

The installer doesn't work correctly:

php composer.phar create-project kenjis/codeigniter-composer-installer codeigniter
Installing kenjis/codeigniter-composer-installer (v0.4.0)
  - Installing kenjis/codeigniter-composer-installer (v0.4.0)
    Downloading: 100%         

Created project in codeigniter
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing codeigniter/framework (3.0.3)
    Loading from cache

Writing lock file
Generating autoload files
> Kenjis\CodeIgniter\Installer::postInstall
> composer update
sh: 1: composer: not found
Script composer update handling the post-install-cmd event returned with an error

  [RuntimeException]                        
  Error Output: sh: 1: composer: not found  

Granted it's not complex to fix, but if you don't have permission to move composer to a global bin folder or don't know how to use the bin folder in your home directory (or just don't want to) then it doesn't work.

kenjis commented 8 years ago

Why don't you install as composer?

See https://github.com/kenjis/codeigniter-composer-installer#install-codeigniter

Philio commented 8 years ago

What if you don't have permission to add it to the path?

kenjis commented 8 years ago

I install composer in ~/bin/.

Philio commented 8 years ago

I was hoping to provide some very simple instructions to someone who uses CodeIgniter on how to use Composer, but to avoid any possible platform specific issues I just created the project myself and added it to a git repo. It looks like your script does a good job from that respect looking at the created project structure (I don't use CI myself, but noticed by default everything is in the public web root)

It would be quite easy to support different composer paths, something like this bash script:

#!/bin/bash
if hash composer 2>/dev/null; then
  COMPOSER="composer"
elif [ -a "composer.phar" ]; then
  COMPOSER="./composer.phar"
else
  echo "Composer not found"
  exit 1
fi
echo "Using $COMPOSER"
kenjis commented 8 years ago

Your bash script does not work.

Why don't you instruct that installing composer in ~/bin/?

Philio commented 8 years ago

Works on Ubuntu:

$ ./find.sh 
Composer not found
$ curl -sS https://getcomposer.org/installer | php
...
$ ./find.sh 
Using ./composer.phar
$ mv composer.phar ~/bin/composer
$ source ~/.profile 
$ ./find.sh 
Using composer
kenjis commented 8 years ago

Your script does not work on Windows.

Philio commented 8 years ago

I just provided you that as an example of how easy it is to support different configurations. Windows doesn't have bash or shebang support so it obviously won't work. No doubt you also can't run composer.phar directly either, so this is irrelevant to Windows.

If you have no interest in fixing it, just close the issue.

kenjis commented 8 years ago

No doubt you also can't run composer.phar directly either, so this is irrelevant to Windows.

You can install CodeIgniter with this installer on Windows. I don't think dropping Windows.

I'm just asking you:

if you don't have permission to move composer to a global bin folder

Why don't you install into ~/bin/?

or don't know how to use the bin folder in your home directory

Why don't you teach how to?

(or just don't want to)

Why don't you teach why it is better.

And if he/she really don't want to, it is okay just to unzip CodeIgniter offical zip file.

If you use composer.phar in the current directory, do you download it every time you install CodeIgniter? What do you do it after the installation?