phar-io/phive

How to create phive.xml

glensc opened this issue · 7 comments

https://phar.io/ has an example:

# Install all phar files declared in phive.xml
phive install

but the same page has no info how to create phive.xml or what's it's format

not even this project readme has anything:

The file is auto-generated when phive is regularly used to install things.
Granted, the format should be documented, thus: #306

Otherwise, duplicate of #306

For me phive-0.15.0 generated .phive/phars.xml, not phive.xml.

➔ phive install composer
Phive 0.15.0 - Copyright (C) 2015-2021 by Arne Blankerts, Sebastian Heuer and Contributors
Linking /Users/glen/.phive/phars/composer-2.1.14.phar to /private/tmp/phive/tools/composer

➔ find
.
./tools
./tools/composer
./.phive
./.phive/phars.xml
➔

aside, what is the meaning of "regularly used to install things"? if I invoke phive 10 times it will start creating a different file? 😕

The .phive/phars.xml is the new and alternative location used by default in case no traditional phive.xml was found. It's technically a combination of composer.json and composer.lock.

Given that phive will manage that file for you, there should be no reason to manually create this file (== regular use).

Does not seem correct.

From my local test, it's exactly the opposite:

  • by default phive uses .phive/phars.xml

Try yourself running phive install composer in an empty directory.

After I mv .phive/phars.xml phive.xml phive starts to manage phive.xml

That's exactly what I wrote?

You wrote 1:

The file is auto-generated when phive is regularly used to install things.

You wrote 2:

Given that phive will manage that file for you, there should be no reason to manually create this file (== regular use).

You lost me.

I'll try again:

  • Phive stores its state in either .phive/phars.xml (newer versions) or phive.xml (older versions)
  • If neither file exists, the newer versions of phive will create .phive/phars.xml automagically upon first use of phive install <whatever>, older versions may still create the old phive.xml. Their content is currently identical.
  • If a phive.xml exists, it will be used - even by newer versions of phive - and kept up to date.
  • A command exists to migrate the old to the new location, if a user is interested
  • We are not aware of any reason to manually create either file
  • There may be of course be edge cases where editing the state file may come in handy, so we indeed should document it