author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Wed, 03 Feb 2010 18:44:24 +0100 | |
changeset 4437 | 21f2e01fdd6a |
parent 2280 | 31269a9b9ec4 |
permissions | -rw-r--r-- |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
1 |
Creating a new cube from scratch using :command:`cubicweb-ctl newcube` |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
2 |
---------------------------------------------------------------------- |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
3 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
4 |
Let's start by creating the cube environment in which we will develop :: |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
5 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
6 |
cd ~/hg |
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
7 |
# use cubicweb-ctl to generate a template for the cube |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
8 |
cubicweb-ctl newcube mycube # will ask some questions, most with nice default |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
9 |
# makes the cube source code managed by mercurial |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
10 |
cd mycube |
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
11 |
hg init |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
12 |
hg add . |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
13 |
hg ci |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
14 |
|
2280
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
15 |
If all went well, you should see the cube you just created in the list |
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
16 |
returned by ``cubicweb-ctl list`` in the section *Available cubes*, |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
17 |
and if it is not the case please refer to :ref:`ConfigurationEnv`. |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
18 |
|
2280
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
19 |
To reuse an existing cube, add it to the list named ``__use__`` and defined in |
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
20 |
:file:`__pkginfo__.py`. This variable is used for the instance packaging |
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
21 |
(dependencies handled by system utility tools such as APT) and the usable cubes |
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
22 |
at the time the base is created (import_erschema('MyCube') will not properly |
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
23 |
work otherwise). |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
24 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
25 |
.. note:: |
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
26 |
|
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
27 |
Please note that if you do not wish to use default directory for your cubes |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
28 |
library, you should set the :envvar:`CW_CUBES_PATH` environment variable to |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
29 |
add extra directories where cubes will be search, and you'll then have to use |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
30 |
the option `--directory` to specify where you would like to place the source |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
31 |
code of your cube: |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
32 |
|
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
33 |
``cubicweb-ctl newcube --directory=/path/to/cubes/library mycube`` |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
34 |
|
2172
cf8f9180e63e
delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1714
diff
changeset
|
35 |
|
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
36 |
.. XXX resurrect once live-server is back |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
37 |
.. Usage of :command:`cubicweb-ctl liveserver` |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
38 |
.. ------------------------------------------- |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
39 |
|
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
40 |
.. To quickly test a new cube, you can also use the `liveserver` command for cubicweb-ctl |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
41 |
.. which allows to create an instance in memory (using an SQLite database by |
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
42 |
.. default) and make it accessible through a web server :: |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
43 |
|
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
44 |
.. cubicweb-ctl live-server mycube |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
45 |
|
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
46 |
.. or by using an existing database (SQLite or Postgres):: |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
47 |
|
4437
21f2e01fdd6a
update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
48 |
.. cubicweb-ctl live-server -s myfile_sources mycube |