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

Init feature #796

Closed
jawira opened this issue Oct 20, 2017 · 5 comments
Closed

Init feature #796

jawira opened this issue Oct 20, 2017 · 5 comments

Comments

@jawira
Copy link
Contributor

jawira commented Oct 20, 2017

It would be nice to have an "initialize" option for Phing.

I systematically look for this feature everytime I discover a new package.

This kind of feature is usual nowadays, to name a few:

  • Behat: $ behat --init
  • Composer: $ php composer.phar init
  • Phinx: $ phinx init .

So for Phing I'm wanting something like this:

$ vendor/bin/phing -init
$ vendor/bin/phing -i

Ideally this command would create two files at the root of the project: build.xml and build.properties (these are the default naming conventions).

The content of build.xml:

<?xml version="1.0" encoding="UTF-8" ?>

<project name="" description="" default="">
    
    <target name="" description="">
        
    </target>
    
</project>

The content of build.properties:

[section]
name=value

I have already worked on this, and I'm really expecting for your feedback.

@siad007
Copy link
Member

siad007 commented Oct 20, 2017

Thanks for your PR!
Some small issues:

  • do we really need a property file generated?
  • if so, there is no support for sections by a property file but for ini files

I would suggest dropping the generation of the property file.

@siad007
Copy link
Member

siad007 commented Oct 20, 2017

What do you think about a optional usage of a filename?

$ vendor/bin/phing -init "phing.xml"

It would also be nice to support

  • a single file (phing.xml)
  • with a relative path (test/phing.xml)
  • or an absolute path (/path/to/phing.xml)
    What do you think.

@siad007 siad007 added this to the 3.0 milestone Oct 20, 2017
@jawira
Copy link
Contributor Author

jawira commented Oct 20, 2017

Thanks a lot for your quick feedback!

About generation of property file: I added this because it's what I always use in all my projects, and I consider it's a good practice to keep all properties together in a same file, however, I agree that not all people need or want a property file.

Regarding sections, I know they are not supported by properties and are omitted, but I always use sections in my properties as categories:

[database]
db.user=user

[ftp]
ftp.server=

[tests]
dir.output=

But once again, I agree this couldn't be the case for all Phing's users. Therefore I will drop the generation of property file as you suggest, mainly for the sake of simplicity.

Concerning the optional usage of a filename, I'm not very keen about this. The main reason is that I want to keep the -init option really simple and straight forward. I always call my buildfile build.xml because this way I don't have to use the -f option and the command is shorter in terminal. Even if I'm not really against this idea I prefer keeping things simple.

@jawira
Copy link
Contributor Author

jawira commented Oct 20, 2017

I updated my PR, I have taken into account your suggestions.

@mrook
Copy link
Member

mrook commented Nov 29, 2017

Closed because #797 was merged.

@mrook mrook closed this as completed Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants