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