当你使用Akelos生成你的项目,他将为这个应用程序创建整个结构目录.Akelos知道如何在结构中找到他需要的东西,所以你无须告诉他。
这是在生成应用程序时生成的目录级数。在版本之间除了次要的变化之外,每一个Akelos project拥有相同的结构,使用的是同样的命名规则。这种一致性将给你带来巨大的好处。你可以非常迅速的在两个 Akelos projects之间移动,而不需要去重新学习项目的组织结构。
为了弄懂这个目录,我们使用在以前创建的应用程序demo。可以用这个命令C:\akelos\> akelos demo来创建。
现在我们就进如demo应用程序的根目录,如下所示:
C:\akelos\> cd demo
C:\akelos\demo> dir
你可以看到结构目录,如下所示:
demo/
/app
/controller
/helpers
/models
/views
/layouts
/config
/lib
/log
/public
/script
/test
/tmp
/vendor
README
现在让我解释一下每个目录的目的
app : This organizes your application components. It's got subdirectories that hold the view (views and helpers), controller (controllers), and the back-end business logic (models).
app/controllers: The controllers subdirectory is where Akelos looks to find controller classes. A controller handles a web request from the user.
app/helpers: The helpers subdirectory holds any helper classes used to assist the model, view, and controller classes. This helps to keep the the model, view, and controller code small, focused, and uncluttered.
app/models: The models subdirectory holds the classes that model and wrap the data stored in our application's database. In most frameworks, this part of the application can grow pretty messy, tedious, verbose, and error-prone. Akelos makes it dead simple!
app/view: The views subdirectory holds the display templates to fill in with data from our application, convert to
HTML, and return to the user's browser.
app/view/layouts: Holds the template files for layouts to be used with views. This models the common header/footer method of wrapping views. In your views, define a layout using the <tt>var $layout = 'default';</tt> and create a file named default.tpl. Inside default.tpl, call {content_for_layout} to render the view using this layout.
config: This directory contains the small amount of configuration code that your application will need, including your database configuration and your Akelos routing of incoming web requests (routes.php). You can also tailor the behavior of the three Rails environments for test, development, and deployment with files found in the environments directory.
lib: You'll put libraries here, unless they explicitly belong elsewhere (such as vendor libraries). This is a good place to put your classes or functions that don't fit in a model or are shared across many controllers.
log: Logs go here. You'll find separate logs for each Akelos environment (development.log, test.log, and production.log).
public: Like the public directory for a web server, this directory has web files that don't change, such a s JavaScript files (public/javascripts), graphics (public/images), stylesheets (public/stylesheets), and
HTML files (public).
script: This directory holds scripts to launch and manage the various tools that you'll use with Akelos. For example, there are scripts to generate code (generate) and launch the web server (server).
test: The tests you write and those Akelos creates for you all go here. You'll see a subdirectory for unit tests (unit) and fixtures (fixtures).
tmp: Akelos uses this directory to hold temporary files for intermediate processing.
vendor: Libraries provided by third-party vendors (such as security libraries or database utilities beyond the basic Akelos distribution) go here.
Apart from these directories there will be two files available in demo directory.