问题
I was not able to find a good resource which is describing the following Zend_Tool command:
- zf create project path name-of-profile file-of-profile
Not even here:
- http://framework.zend.com/manual/en/zend.tool.usage.cli.html
Does somebody know a good resource regarding this command?
Note: I'm interested in the name-of-profile and file-of-profile part. Usage, examples, etc.
Maybe even a visual approach like in this references:
- http://marklodato.github.com/visual-git-guide/index-en.html
- http://osteele.com/archives/2008/05/commit-policies
回答1:
I am not familiar enough with the internals of ZF Tool Project, but have a look at
- http://framework.zend.com/manual/en/zend.tool.project.create-a-project.html
- http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Tool/Project/Provider/Project.php
Afaik (which is not much) Zend Tool maintains an XML file to keep track of your project. This is required for any subsequent actions to be applied correctly to your project through Zend Tool.
The DocBlock for the create
action in the Project Provider says:
/**
* create()
*
* @param string $path
* @param string $nameOfProfile shortName=n
* @param string $fileOfProfile shortName=f
*/
When run without the two optional arguments, the method will eventually create a new project file with
$newProfile = new Zend_Tool_Project_Profile(array(
'projectDirectory' => $path,
'profileData' => $profileData
));
with $profileDate
being the content of the default configuration file. If you specify $fileOfProfile
, you can override the configuration file and supply your own file, e.g.
if ($fileOfProfile != null && file_exists($fileOfProfile)) {
$profileData = file_get_contents($fileOfProfile);
}
Obviously, you have to supply a full path to the file for this to work. The alternative is to supply a file identifier, which Zend Tool will then try to find in a predefined location, e.g.
$storage = $this->_registry->getStorage();
if ($profileData == '' && $nameOfProfile != null && $storage->isEnabled()) {
$profileData = $storage->get('project/profiles/' . $nameOfProfile . '.xml');
}
I have no clue what the storage part is about. Like I said, I am not familiar with Zend Tool's inner workings. If I understand correctly, you can use the additional two arguments to load an existing project in a new location or customize the default one.
You might want to browse the ChangeLog to find out more about it.
来源:https://stackoverflow.com/questions/4237765/zf-create-project-path-name-of-profile-file-of-profile