| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- EN-Revision: 19777 -->
- <!-- Reviewed: no -->
- <sect1 id="zend.tool.usage.cli">
- <title>Verwendung von Zend_Tool auf der Kommandozeile</title>
- <para>
- Das <acronym>CLI</acronym>, oder Kommandozeilentool (intern bekannt als Konsolen Tool),
- ist aktuell das primäre Interface für die Bearbeitung von <classname>Zend_Tool</classname>
- Anfragen. Mit dem <acronym>CLI</acronym> Tool können Entwickler Tooling Anfragen im
- "Kommandozeilen Fenster", auch bekannt als "Terminal" Fenster, auslösen. Diese Umgebung ist
- vorherrschend bei *nix Umgebungen, es gibt aber auch übliche Implementationen unter Windows
- mit <filename>cmd.exe</filename>, Console2 und auch im Cygwin Projekt.
- </para>
- <!--
- <sect2 id="zend.tool.usage.cli.introduction">
- <title>Einführung</title>
- </sect2>
- -->
- <sect2 id="zend.tool.usage.cli.installation">
- <title>Installation</title>
- <sect3 id="zend.tool.usage.cli.installation.download-and-go">
- <title>Herunterladen und anfangen</title>
- <para>
- Zuerst muss Zend Framework heruntergeladen werden. Das kann man tun, indem man auf
- framework.zend.com geht und das letzte Release herunterlädt. Nachdem man das
- Paket heruntergeladen und auf dem System plaziert hat ist der nächste Schritt das
- zf Kommendo auf dem System zu erstellen. Der einfachste Weg das zu tun ist die
- richtigen Dateien vom bin/ Verzeichnis des Downloads zu kopieren, und diese Dateien
- im <emphasis>gleichen</emphasis> Verzeichnis zu platzieren wie der Ort an dem die
- PHP CLI Binardatei ist.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.installation.pear">
- <title>Installation über Pear</title>
- <para>
- Um es über PEAR zu installieren muss man die 3rd Party Site zfcampus.org verwenden
- und das letzte Zend Framwork PEAR Paket empfangen. Diese Pakete werden
- typischerweise innerhalb eines Tages nach einem offiziellen Zend Framework Release
- erstellt. Der Vorteil der Installation über den PEAR Package Manager ist, dass die
- ZF Bibliothek im include_path endet, und die zf.php und ZF Skripte an einem Ort im
- eigenen System enden der es erlaubt Sie ohne zusätzliches Setup zu starten.
- </para>
- <programlisting language="text"><![CDATA[
- pear discover-channel pear.zfcampus.org
- pear install zfcampus/zf
- ]]></programlisting>
- <para>
- Das ist es schon. Nachdem initialen Setup sollte man in der Lage sein weiter zu
- machen indem das zf Kommando ausgeführt wird. Ein gute Weg um zu prüfen ob es
- vorhanden ist, ist es zf --help auszuführen.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.installation.install-by-hand">
- <title>Installation von Hand</title>
- <para>
- Die Installtion von Hand zeigt den Prozess um zf.php und die Zend Framework
- Bibliothek dazu zu zwingen zusammen zu arbeiten wenn diese nicht auf konventionellen
- Orten abgelegt wurden, oder zumindest, an einem Ort an dem das eigene System diese
- nicht einfach ausführen kann (typisch für Programme im eigenen System Pfad).
- </para>
- <para>
- Wenn man auf einem *nix oder Mac System ist, kann man auch einen Link von irgendwo im
- eigenen Pfad zur zf.sh Datei erstellen. Wenn man das macht muss man sich keine
- Gedanken darüber machen das die Zend Framework Bibliothek im eigenen include_path
- ist, da die Dateien zf.php und zf.sh auf die Bibliothek, relativ dazu wo Sie sind,
- zugreifen können (was bedeutet das die ./bin/ Dateien relativ zu ../library/ der
- Zend Framework Bibliothek sind).
- </para>
- <para>
- Es gibt eine Anzahl von anderen vorhandenen Optionen für das Setup von zf.php und
- der Bibliothek im eigenen System. Diese Optionen drehen sich um das Setzen von
- speziellen Umgebungsvariablen. Diese werden im späteren Kapitel "Die CLI Umgebung
- anpassen" beschrieben. Die Umgebungsvariablen für das Setzen von include_path,
- ZF_INCLUDE_PATH und ZF_INCLUDE_PATH_PREPEND für zf.php sind die interessantesten.
- </para>
- </sect3>
- </sect2>
- <sect2 id="zend.tool.usage.cli.general-purpose-commands">
- <title>Kommandos für generelle Zwecke</title>
- <sect3 id="zend.tool.usage.cli.general-purpose-commands.version">
- <title>Version</title>
- <para>
- Das zeigt die aktuelle Versionsnummer der Kopie vom Zend Framework welche das zf.php
- Tool verwendet.
- </para>
- <programlisting language="text"><![CDATA[
- zf show version
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.general-purpose-commands.built-in-help">
- <title>Eingebaute Hilfe</title>
- <para>
- Das eingebaute Hilfe System ist der primäre Ort von dem man up-to-date Informationen
- darüber erhält was das eigene System in der Lage ist zu tun. Das Hilfe System ist
- dahingehend dynamisch das Provider dem eigenen System hinzugefügt und
- automatisch ausgeführt werden, und als solches werden die notwendigen Parameter
- damit Sie ausgeführt werden können, im Hilfe Schirm vorhanden. Der einfachste Weg um
- den Hilfe Schirm zu erhalten ist der folgende:
- </para>
- <programlisting language="text"><![CDATA[
- zf --help
- ]]></programlisting>
- <para>
- Das gibt einen Überblick über die verschiedenen Möglichkeiten des Systems. Manchmal
- gibt es engültigere Kommandos die ausgeführt werden können, und um mehr
- Informationen über Sie zu erhalten muss man ein spezialisierteres Hilfe Kommando
- ausführen. Für die spezialisierte Hilfe muss einfach eines der Elemente des
- Kommandos mit einem "=" ersetzt werden. Das sagt dem Hilfe System das man mehr
- Informationen darüber will welche Kommandos an Stelle des Fragezeichens stehen
- können. Zum Beispiel:
- </para>
- <programlisting language="text"><![CDATA[
- zf ? controller
- ]]></programlisting>
- <para>
- Das obige bedeutet "zeig mir alle 'Aktionen' für den Provider 'controller'"; wärend
- das folgende:
- </para>
- <programlisting language="text"><![CDATA[
- zf show ?
- ]]></programlisting>
- <para>
- bedeutet "zeig mit alle Provider welche die 'show' Aktion unterstützen. Das arbeitet
- auch wenn man in Optionen geht wie man im folgenden Beispiel sehen kann:
- </para>
- <programlisting language="text"><![CDATA[
- zf show version.? (zeige alle Spezialitäten)
- zf show version ? (zeige alle Optionen)
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.general-purpose-commands.manifest">
- <title>Manifest</title>
- <para>
- Das zeigt welche Informationen im Tooling System Manifest sind. Das ist wichtiger
- für Entwickler von Providers als für normale Benutzer des Tooling Systems.
- </para>
- <programlisting language="text"><![CDATA[
- zf show manifest
- ]]></programlisting>
- </sect3>
- <!--
- <sect3 id="zend.tool.usage.cli.general-purpose-commands.tool-configuration">
- <title>Tool Konfiguration</title>
- <para>Platzhalter, benötigt Handbuch von @beberli</para>
- </sect3>
- -->
- </sect2>
- <sect2 id="zend.tool.usage.cli.project-specific-commands">
- <title>Projekt spezifische Kommandos</title>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.project">
- <title>Project</title>
- <para>
- The project provider is the first command you might want to run. This will setup the basic
- structure of your application. This is required before any of the other providers can
- be executed.
- </para>
- <programlisting language="text"><![CDATA[
- zf create project MyProjectName
- ]]></programlisting>
- <para>
- This will create a project in a directory called ./MyProjectName. From this point on,
- it is important to note that any subsequent commands on the command line must be issued
- from within the project directory you had just created. So, after creation, changing into
- that directory is required.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.module">
- <title>Project</title>
- <para>
- The module provider allows for the easy creation of a Zend Framework module. A module
- follows the hMVC pattern loosely. When creating modules, it will take the same structure
- used at the application/ level, and duplicate it inside of the chosen name for your module,
- inside of the "modules" directory of the application/ directory without duplicating the
- modules directory itself. For example:
- </para>
- <programlisting language="text"><![CDATA[
- zf create module Blog
- ]]></programlisting>
- <para>
- This will create a module named Blog at application/modules/Blog, and all of the artifacts
- that a module will need.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.controller">
- <title>Controller</title>
- <para>
- The controller provider is responsible for creating (mostly) empty controllers as well
- as their corresponding view script directories and files. To utilize it to create
- an 'Auth' controlller, for example, execute:
- </para>
- <programlisting language="text"><![CDATA[
- zf create controller Auth
- ]]></programlisting>
- <para>
- This will create a controller named Auth, specifically it will create a file at
- application/controllers/AuthController.php with the AuthController inside.
- If you wish to create a controller for a module, use any of the following:
- </para>
- <programlisting language="text"><![CDATA[
- zf create controller Post 1 Blog
- zf create controller Post -m Blog
- zf create controller Post --module=Blog
- ]]></programlisting>
- <para>
- Note: In the first command, 1 is the value for the "includeIndexAction" flag.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.action">
- <title>Action</title>
- <para>
- To create an action within an existing controller:
- </para>
- <programlisting language="text"><![CDATA[
- zf create action login Auth
- zf create action login -c Auth
- zf create action login --controller-name=Auth
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.view">
- <title>View</title>
- <para>
- To create a view outside of the normal controller/action creation, you would use
- one of the following:
- </para>
- <programlisting language="text"><![CDATA[
- zf create view Auth my-script-name
- zf create view -c Auth -a my-script-name
- ]]></programlisting>
- <para>
- This will create a view script in the controller folder of Auth.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.model">
- <title>Model</title>
- <para>
- The model provider is only responsible for creating the proper model files,
- with the proper name inside the application folder. For example
- </para>
- <programlisting language="text"><![CDATA[
- zf create model User
- ]]></programlisting>
- <para>
- If you wish to create a model within a specific module:
- </para>
- <programlisting language="text"><![CDATA[
- zf create model Post -m Blog
- ]]></programlisting>
- <para>
- The above will create a 'Post' model inside of the 'Blog' module.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.form">
- <title>Form</title>
- <para>
- The form provider is only responsible for creating the proper form file and
- init() method, with the proper name inside the application folder. For example:
- </para>
- <programlisting language="text"><![CDATA[
- zf create form Auth
- ]]></programlisting>
- <para>
- If you wish to create a model within a specific module:
- </para>
- <programlisting language="text"><![CDATA[
- zf create form Comment -m Blog
- ]]></programlisting>
- <para>
- The above will create a 'Comment' form inside of the 'Blog' module.
- </para>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.database-adapter">
- <title>DbAdapter</title>
- <para>
- To configure a DbAdapter, you will need to provide the information as a url
- encoded string. This string needs to be in quotes on the command line.
- </para>
- <para>
- For example, to enter the following information:
- <itemizedlist>
- <listitem>
- <para>adapter: Pdo_Mysql</para>
- </listitem>
- <listitem>
- <para>username: test</para>
- </listitem>
- <listitem>
- <para>password: test</para>
- </listitem>
- <listitem>
- <para>dbname: test </para>
- </listitem>
- </itemizedlist>
- The following will have to be run on the command line:
- </para>
- <programlisting language="text"><![CDATA[
- zf configure dbadapter "adapter=Pdo_Mysql&username=test&password=test&dbname=test"
- ]]></programlisting>
- <para>
- This assumes you wish to store this information inside of the
- 'production' space of the application configuration file. The following will
- demonstrate an sqlite configuration, in the 'development' section of the
- application config file.
- </para>
- <programlisting language="text"><![CDATA[
- zf configure dbadapter "adapter=Pdo_Sqlite&dbname=../data/test.db" development
- zf configure dbadapter "adapter=Pdo_Sqlite&dbname=../data/test.db" -s development
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.db-table">
- <title>DbTable</title>
- <para>
- The DbTable provider is responsible for creating Zend_Db_Table
- model/data access files for your application to consume, with the proper
- class name, and in the proper location in the application. The two
- important pieces of information are the <emphasis>DbTable name</emphasis>,
- and the <emphasis>actual database table name</emphasis>. For example:
- </para>
- <programlisting language="text"><![CDATA[
- zf create dbtable User user
- zf create dbtable User -a user
- // also accepts a force option to overwrite existing files
- zf create dbtable User user -f
- zf create dbtable User user --force-override
- ]]></programlisting>
- <para>
- The DbTable provider is also capable of creating the proper files by
- scanning the database configured with the above DbAdapter provider.
- </para>
- <programlisting language="text"><![CDATA[
- zf create dbtable.from-database
- ]]></programlisting>
- <para>
- When executing the above, it might make sense to use the pretend / "-p"
- flag first so that you can see what would be done, and what tables can
- be found in the database.
- </para>
- <programlisting language="text"><![CDATA[
- zf -p create dbtable.from-database
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.project-specific-commands.layout">
- <title>Layout</title>
- <para>
- Currently, the only supported action for layouts is simply to enable them
- will setup the proper keys in the application.ini file for the application
- resource to work, and create the proper directories and layout.phtml file.
- </para>
- <programlisting language="text"><![CDATA[
- zf enable layout
- ]]></programlisting>
- </sect3>
- </sect2>
- <sect2 id="zend.tool.usage.cli.environment-customization">
- <title>Environment Customization</title>
- <sect3 id="zend.tool.usage.cli.environment-customization.storage-directory">
- <title>The Storage Directory</title>
- <para>
- The storage directory is important so that providers may have a place to find
- custom user generated logic that might change the way they behave. One example
- can be found below is the placement of a custom project profile file.
- </para>
- <programlisting language="text"><![CDATA[
- zf --setup storage-directory
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.environment-customization.configuration-file">
- <title>The Configuration File</title>
- <para>
- This will create the proper zf.ini file. This <emphasis>should</emphasis>
- be run after <code>zf --setup storage-directory</code>. If it is not, it will
- be located inside the users home directory. If it is, it will be located inside
- the users storage directory.
- </para>
- <programlisting language="text"><![CDATA[
- zf --setup config-file
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.tool.usage.cli.environment-customization.environment-locations">
- <title>Environment Locations</title>
- <para>
- These should be set if you wish to override the default places where zf will
- attempt to read their values.
- </para>
- <itemizedlist>
- <listitem>
- <para>ZF_HOME</para>
- <itemizedlist>
- <listitem><para>the directory this tool will look for a home directory</para></listitem>
- <listitem><para>directory must exist</para></listitem>
- <listitem>
- <para>search order:</para>
- <itemizedlist>
- <listitem><para>ZF_HOME environment variable</para></listitem>
- <listitem><para>HOME environment variable</para></listitem>
- <listitem><para>then HOMEPATH environment variable</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>ZF_STORAGE_DIRECTORY</para>
- <itemizedlist>
- <listitem><para>where this tool will look for a storage directory</para></listitem>
- <listitem><para>directory must exist</para></listitem>
- <listitem>
- <para>search order:</para>
- <itemizedlist>
- <listitem><para>ZF_STORAGE_DIRECTORY environment variable</para></listitem>
- <listitem><para>$homeDirectory/.zf/ directory</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>ZF_CONFIG_FILE</para>
- <itemizedlist>
- <listitem><para>where this tool will look for a configuration file</para></listitem>
- <listitem>
- <para>search order:</para>
- <itemizedlist>
- <listitem><para>ZF_CONFIG_FILE environment variable</para></listitem>
- <listitem><para>$homeDirectory/.zf.ini file if it exists</para></listitem>
- <listitem><para>$storageDirectory/zf.ini file if it exists</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>ZF_INCLUDE_PATH</para>
- <itemizedlist>
- <listitem><para>set the include_path for this tool to use this value</para></listitem>
- <listitem>
- <para>original behavior:</para>
- <itemizedlist>
- <listitem><para>use php's include_path to find ZF</para></listitem>
- <listitem><para>use the ZF_INCLUDE_PATH environment variable</para></listitem>
- <listitem><para>use the path ../library (relative to zf.php) to find ZF</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>ZF_INCLUDE_PATH_PREPEND</para>
- <itemizedlist>
- <listitem><para>prepend the current php.ini include_path with this value</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </sect3>
- </sect2>
- </sect1>
|