doc/book/en/development/cubes/layout.rst
branchstable
changeset 5394 105011657405
parent 5393 875bdc0fe8ce
child 5395 e0ab7433e640
equal deleted inserted replaced
5393:875bdc0fe8ce 5394:105011657405
     1 
       
     2 .. _foundationsCube:
       
     3 
       
     4 .. _cubelayout:
       
     5 
       
     6 Standard structure for a cube
       
     7 -----------------------------
       
     8 
       
     9 A cube is structured as follows:
       
    10 
       
    11 ::
       
    12 
       
    13   mycube/
       
    14   |
       
    15   |-- data/
       
    16   |   |-- cubes.mycube.css
       
    17   |   |-- cubes.mycube.js
       
    18   |   `-- external_resources
       
    19   |
       
    20   |-- debian/
       
    21   |   |-- changelog
       
    22   |   |-- compat
       
    23   |   |-- control
       
    24   |   |-- copyright
       
    25   |   |-- cubicweb-mycube.prerm
       
    26   |   `-- rules
       
    27   |
       
    28   |-- entities.py
       
    29   |
       
    30   |-- i18n/
       
    31   |   |-- en.po
       
    32   |   |-- es.po
       
    33   |   `-- fr.po
       
    34   |
       
    35   |-- __init__.py
       
    36   |
       
    37   |-- MANIFEST.in
       
    38   |
       
    39   |-- migration/
       
    40   |   |-- postcreate.py
       
    41   |   `-- precreate.py
       
    42   |
       
    43   |-- __pkginfo__.py
       
    44   |
       
    45   |-- schema.py
       
    46   |
       
    47   |-- setup.py
       
    48   |
       
    49   |-- site_cubicweb.py
       
    50   |
       
    51   |-- hooks.py
       
    52   |
       
    53   |-- test/
       
    54   |   |-- data/
       
    55   |   |   `-- bootstrap_cubes
       
    56   |   |-- pytestconf.py
       
    57   |   |-- realdb_test_mycube.py
       
    58   |   `-- test_mycube.py
       
    59   |
       
    60   `-- views.py
       
    61 
       
    62 
       
    63 We can use subpackages instead of python modules for ``views.py``, ``entities.py``,
       
    64 ``schema.py`` or ``hooks.py``. For example, we could have:
       
    65 
       
    66 ::
       
    67 
       
    68   mycube/
       
    69   |
       
    70   |-- entities.py
       
    71   |-- hooks.py
       
    72   `-- views/
       
    73       |-- forms.py
       
    74       |-- primary.py
       
    75       `-- widgets.py
       
    76 
       
    77 
       
    78 where :
       
    79 
       
    80 * ``schema`` contains the schema definition (server side only)
       
    81 * ``entities`` contains the entities definition (server side and web interface)
       
    82 * ``hooks`` contains hooks and/or views notifications (server side only)
       
    83 * ``views`` contains the web interface components (web interface only)
       
    84 * ``test`` contains tests related to the cube (not installed)
       
    85 * ``i18n`` contains message catalogs for supported languages (server side and
       
    86   web interface)
       
    87 * ``data`` contains data files for static content (images, css, javascripts)
       
    88   ...(web interface only)
       
    89 * ``migration`` contains initialization files for new instances (``postcreate.py``)
       
    90   and a file containing dependencies of the component depending on the version
       
    91   (``depends.map``)
       
    92 * ``debian`` contains all the files managing debian packaging (you will find
       
    93   the usual files ``control``, ``rules``, ``changelog``... not installed)
       
    94 * file ``__pkginfo__.py`` provides component meta-data, especially the distribution
       
    95   and the current version (server side and web interface) or sub-cubes used by
       
    96   the cube.
       
    97 
       
    98 
       
    99 At least you should have the file ``__pkginfo__.py``.
       
   100 
       
   101 
       
   102 The :file:`__init__.py` and :file:`site_cubicweb.py` files
       
   103 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   104 
       
   105 The :file:`__pkginfo__.py` file
       
   106 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   107 
       
   108 It contains metadata describing your cubes, mostly useful for
       
   109 packaging.
       
   110 
       
   111 
       
   112 :file:`migration/precreate.py` and :file:`migration/postcreate.py`
       
   113 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   114 
       
   115 .. XXX detail steps of instance creation
       
   116 
       
   117 
       
   118 External resources such as image, javascript and css files
       
   119 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   120 
       
   121 .. XXX naming convention external_resources file
       
   122 
       
   123 
       
   124 Out-of the box testing
       
   125 ~~~~~~~~~~~~~~~~~~~~~~
       
   126 
       
   127 .. XXX MANIFEST.in, __pkginfo__.include_dirs, debian
       
   128 
       
   129 
       
   130 Packaging and distribution
       
   131 ~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   132 
       
   133 .. XXX MANIFEST.in, __pkginfo__.include_dirs, debian
       
   134