doc/book/en/development/cubes/cc-newcube.rst
brancholdstable
changeset 5422 0865e1e90674
parent 4985 02b52bf9f5f8
parent 5421 8167de96c523
child 5424 8ecbcbff9777
equal deleted inserted replaced
4985:02b52bf9f5f8 5422:0865e1e90674
     1 Creating a new cube from scratch using :command:`cubicweb-ctl newcube`
       
     2 ----------------------------------------------------------------------
       
     3 
       
     4 Let's start by creating the cube environment in which we will develop ::
       
     5 
       
     6   cd ~/hg
       
     7   # use cubicweb-ctl to generate a template for the cube
       
     8   cubicweb-ctl newcube mycube  # will ask some questions, most with nice default
       
     9   # makes the cube source code managed by mercurial
       
    10   cd mycube
       
    11   hg init
       
    12   hg add .
       
    13   hg ci
       
    14 
       
    15 If all went well, you should see the cube you just created in the list
       
    16 returned by ``cubicweb-ctl list`` in the section *Available cubes*,
       
    17 and if it is not the case please refer to :ref:`ConfigurationEnv`.
       
    18 
       
    19 To reuse an existing cube, add it to the list named ``__use__`` and defined in
       
    20 :file:`__pkginfo__.py`.  This variable is used for the instance packaging
       
    21 (dependencies handled by system utility tools such as APT) and the usable cubes
       
    22 at the time the base is created (import_erschema('MyCube') will not properly
       
    23 work otherwise).
       
    24 
       
    25 .. note::
       
    26 
       
    27     Please note that if you do not wish to use default directory for your cubes
       
    28     library, you should set the :envvar:`CW_CUBES_PATH` environment variable to
       
    29     add extra directories where cubes will be search, and you'll then have to use
       
    30     the option `--directory` to specify where you would like to place the source
       
    31     code of your cube:
       
    32 
       
    33     ``cubicweb-ctl newcube --directory=/path/to/cubes/library mycube``
       
    34 
       
    35 
       
    36 .. XXX resurrect once live-server is back
       
    37 .. Usage of :command:`cubicweb-ctl liveserver`
       
    38 .. -------------------------------------------
       
    39 
       
    40 .. To quickly test a new cube, you can also use the `liveserver` command for cubicweb-ctl
       
    41 .. which allows to create an instance in memory (using an SQLite database by
       
    42 .. default) and make it accessible through a web server ::
       
    43 
       
    44 ..   cubicweb-ctl live-server mycube
       
    45 
       
    46 .. or by using an existing database (SQLite or Postgres)::
       
    47 
       
    48 ..   cubicweb-ctl live-server -s myfile_sources mycube