Glad you like nanoc - I do too; it's awesome :)
To answer your questions:
> 1, as the title said, is nanoc site portable? I mean ,if i copy a
> nanoc site in my usb drive ,using it on other computers,when I enter
> into it's directory ,is everything still consistent?
Yes, this is fine.
nanoc sites are self-contained and only use relative paths under the
root area so you can move them around no problems. This is really useful
for lots of reasons. E.g. I can take a tarball of someone else's nanoc
site, uncompress it on my local machine and build their site myself! :)
A great way to learn nanoc is to take a snapshot of Denis's Stoneship
site or the nanoc Website itself and play around with it locally; this
shows how portable sites are and you can see for yourself moving a site
around is no problem:
http://nanoc.stoneship.org/hg/sites-nanoc/
http://nanoc.stoneship.org/hg/sites-stoneship/
Or create a small test site yourself with minimal content.
> 2, what are the term "datasource" imply? as I can see ,the nanoc can
> conver a "page" into different "reprentations", this is awesome, but I
> still guessing is there anything more powerful like converting a
> database "source" into a completely staticsite?
A nanoc DataSource is just an interface.
At the moment, there's only one implementation of that interface which is filesystem-backed. i.e. pages and assets are files on disk somewhere.
The DataSource interface could be implemented to be backed by a database but this hasn't yet been written. This would probably be a part of making some kind of nanoc GUI tool, but again that's all hypothetical.
http://nanoc.stoneship.org/help/rdoc/classes/Nanoc/DataSource.html
I don't think representations in nanoc work quite how you think they do.
A good example of a representation is where you have an image file that
gets coverted into say a thumbnail and a full sized image; there are two
representations of that core image asset. In this case we are just
talking about assets and multiple representations really only apply to
assets.
Pages don't really work like this and typically the mapping is 1-1. i.e.
you have a layout and some content which produces an (X)HTML page.
Using a filesystem isn't that burdensome once you get used to it;
content can be written in Markdown making actual content files small and
powerful layouts can be built using ERB/Haml - nanoc gives all of these
a structure and place within the filesystem that is logical and
intuitive. Unless you are planning a really huge site, I wouldn't see it
getting out of control - the best thing is to try for yourself and see! :)
(Anyone else, please point out if I have anything wrong).
Hope this helps,
Rob
> Hi Harry,
>
> Glad you like nanoc - I do too; it's awesome :)
>
> To answer your questions: [..]
>
> (Anyone else, please point out if I have anything wrong).
This e-mail has been lying around in my inbox for a few days, waiting
for me to write a reply, but I think a lot has been said already.
Maybe I can clarify a few things though...
nanoc sites are entirely portable indeed. If you are using the
filesystem or filesystem_combined data sources, there is no reason to
worry about data loss. You can take a site created on a Mac OS X
computer to a Windows PC and it'd still compile just fine--assuming
you have all the necessary gems installed, that is :).
If you use a database data source (which at the moment doesn't exist),
then this could be harder. For example, if you would be using a MySQL
database, you'd have to make sure that database is transferred to the
other computer as well. If you stick to filesystem or
filesystem_combined, this should not be a problem though.
Data sources are objects that are used for loading and storing data.
Representations are not really related to data sources... a page/asset
is stored as one entity by the data source, but when compiled can
result in multiple output files. For example, a photo stored as an
asset could have a thumbnail representation, a full-size one, and
perhaps a rotated sepia one with a rough border so it looks like an
old photograph. There would be one asset stored by the data source,
but three distinct output files.
Each site has a YAML file containing page defaults and asset defaults.
(If it doesn't, update your site--see 'nanoc help update'.) If you
define multiple representations in the asset defaults YAML file, then
all assets will have the representations defined in the asset
defaults. (The same is true for page defaults.)
Regards,
Denis
--
Denis Defreyne
denis.d...@stoneship.org