#1445 Naively trying hello.pod example

mpharrison Fri 11 Mar 2011

Hi,

I've been working through the HelloWorld intro, and I'm a bit stuck with the pod example. (Possibly I should leave it until I've learnt a bit more of the language! Possibly I'm making Java-ish assumptions about deployment :)

I've installed fantom into /opt/fantom (it's readonly to me, so I can't normally scribble on it)

my build.fan wants to write the pod into /opt/fantom/lib/fan/hello.pod, which seems a bit odd to me, as my src directory structure is under ~/dev/fantom/hello

So I set outPodDir = File.make(lib/).uri, and it builds ~/dev/fantom/hello/lib/hello.pod, but fan won't find the pod there, whatever way I try to run it.

I was kind of assuming fantom had the equivalent of a classpath, but further reading into the deployment chapter seems to indicate that I do have to let fantom write my pod into its lib/fan directory.

Is there no separation of Fantom's stuff and my stuff? Do I need a separate copy of fantom for all my projects?

Many thanks, and Best Regards,

Matthew.

vkuzkokov Sat 12 Mar 2011

You may want to look into PathEnv.

tcolar Sat 12 Mar 2011

I'm pretty sure that Fantom needs to put the pod in the "lib" folder under where you installed fan ... otherwise the "fan" command it won't find it.

There are ways around this I think (FAN_ENV variabl;e and the likes) ... but I think you would make your life much easier by installing fantom in your home folder(not read-only) for now to keep it simple. (and leave outPodDir alone).

peter Sat 12 Mar 2011

Hi Matthew,

Using Linux, I can do:

$ export FAN_ENV=util::PathEnv
$ export FAN_ENV_PATH=/home/code

And then build the pod (no messing with outPodDir). The pod appears in /home/code/lib/fan and runs from there as usual.

You can put several locations into FAN_ENV_PATH, but the first one is used to build pods into (and is called workDir). The home of your Fantom install is always assumed to be the last one on the list, so it can find the standard libraries.

Hope that helps,

Peter.

vkuzkokov Sat 12 Mar 2011

BTW, most build systems keep compile and install separated. There is always good reason to minimize number of operations to be run with additional privileges (like write access to destination).

mpharrison Sat 12 Mar 2011

Many thanks, all. That's a speedy response!

(I was RT'ing the FM, and had just got up to

PathEnv

and was about to post that I'd found the answer :-)

I'll try taking out the outPodDir, too, now.

BR,

Matthew.

Login or Signup to reply.