Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Compiling to given directory #9

Closed
tobiassjosten opened this issue Jul 3, 2011 · 9 comments
Closed

Compiling to given directory #9

tobiassjosten opened this issue Jul 3, 2011 · 9 comments
Assignees
Milestone

Comments

@tobiassjosten
Copy link

Currently you should be able to compile your site to a specific directory using phr up [src] [dst]. I have two problems with this.

  1. For some reason ../is appended to the directory. So when I try phr up .phrozn/ test/ it compiles to my current directory. To have to place the files in test I must use phr up .phrozn/ test/test/.

  2. Compiling to a different directory than the current one should be far more common than compiling from another directory than where .phrozn resides, since that is most likely your project's root. Hence I suggest the [src]and [dst] parameters switch order.

@ghost ghost assigned farazdagi Jul 3, 2011
@farazdagi
Copy link
Collaborator

Agreed on both fronts. Will see if I can push it into hotfix release (0.2.1) next week.

Thanks!

@tobiassjosten
Copy link
Author

Awesome! I'll see if I can free up some time to try and help you out with some actual code, unless you beat me to it.

@alexgieg
Copy link

alexgieg commented Feb 5, 2013

Hi. I'm experiencing this problem in 0.5.3 beta. phr up src dest appends "/.." to dest, generating files in src/../. The workaround is to use something like phr up src dest/discarded_word.

Edit: Moved --regen issue to #76.

@wdalmut
Copy link
Collaborator

wdalmut commented Feb 5, 2013

Hi @alexgieg,

can you explain more what you are doing? In my env static generation works fine,

$ mkdir src dest
$ phr init src
$ ls -las src/
4 drwxrwxr-x 3 walter walter 4096 Feb  5 19:08 .
4 drwxrwxr-x 3 walter walter 4096 Feb  5 19:08 ..
4 drwxrwxr-x 9 walter walter 4096 Feb  5 19:08 .phrozn

$ phr up src dest
Phrozn 0.5.3DEV by Victor Farazdagi

Starting static site compilation.

  [OK]      Source directory located: /home/walter/git/test/src/.phrozn/
  [OK]      Destination directory located: /home/walter/git/test/dest/
  [OK]      ./src/.phrozn/entries/demos/tabs.twig parsed
  [OK]      ./dest/demos/tabs.html written
  [OK]      ./src/.phrozn/entries/demos/modal.twig parsed
  [OK]      ./dest/demos/modal.html written
  [OK]      ./src/.phrozn/entries/demos/twipsy.twig parsed
  [OK]      ./dest/demos/twipsy.html written
  [OK]      ./src/.phrozn/entries/demos/popup.twig parsed
  [OK]      ./dest/demos/popup.html written
  [OK]      ./src/.phrozn/entries/about.twig parsed
  [OK]      ./dest/about/index.html written
  [OK]      ./src/.phrozn/styles/bootstrap.less parsed
  [OK]      ./dest/styles/bootstrap.css written
  [OK]      ./src/.phrozn/styles/default.less parsed
  [OK]      ./dest/styles/default.css written
  [OK]      ./src/.phrozn/scripts/default.js parsed
  [OK]      ./dest/scripts/default.js written
  [OK]      ./dest/media/README copied
  [OK]      ./dest/media/img/phrozn.png copied
  [OK]      ./dest/media/img/README copied

Phrozn is extremely flexible static site generator for PHP.
For additional information, see http://phrozn.info


$ ls -l dest/
total 32
drwxrwxr-x 2 walter walter  4096 Feb  5 19:09 about
drwxrwxr-x 2 walter walter  4096 Feb  5 19:09 demos
-rw-rw-r-- 1 walter walter 10328 Feb  5 19:09 index.html
drwxrwxr-x 3 walter walter  4096 Feb  5 19:09 media
drwxrwxr-x 2 walter walter  4096 Feb  5 19:09 scripts
drwxrwxr-x 2 walter walter  4096 Feb  5 19:09 styles

Effectively --regen seems not working properly.

@wdalmut
Copy link
Collaborator

wdalmut commented Feb 5, 2013

This could be related to #75

@alexgieg
Copy link

alexgieg commented Feb 6, 2013

Ah! I got what was wrong. Instead of using src, my script was referring to src/.phrozn:

With a relative destination path:

$ mkdir src dst
$ phr init src
$ phr up src/.phrozn dst
Phrozn 0.5.3 by Victor Farazdagi

Starting static site compilation.

  [OK]      Source directory located: /home/private/a/src/.phrozn/
  [OK]      Destination directory located: /../
  [OK]      ./src/.phrozn/entries/index.twig parsed
  [OK]      /../index.html written
  [OK]      ./src/.phrozn/entries/demos/tabs.twig parsed
  [OK]      /../demos/tabs.html written
  [OK]      ./src/.phrozn/entries/demos/twipsy.twig parsed
  [OK]      /../demos/twipsy.html written
  [OK]      ./src/.phrozn/entries/demos/modal.twig parsed
  [OK]      /../demos/modal.html written
  [OK]      ./src/.phrozn/entries/demos/popup.twig parsed
  [OK]      /../demos/popup.html written
  [OK]      ./src/.phrozn/entries/about.twig parsed
  [OK]      /../about/index.html written
  [OK]      ./src/.phrozn/styles/bootstrap.less parsed
  [OK]      /../styles/bootstrap.css written
  [OK]      ./src/.phrozn/styles/default.less parsed
  [OK]      /../styles/default.css written
  [OK]      ./src/.phrozn/scripts/default.js parsed
  [OK]      /../scripts/default.js written
  [FAIL]    /home/private/a/src/.phrozn/media/README: Failed transfering "/home/private/a/src/.phrozn/media/README" from media folder
  [FAIL]    /home/private/a/src/.phrozn/media/img/README: Failed transfering "/home/private/a/src/.phrozn/media/img/README" from media folder
  [FAIL]    /home/private/a/src/.phrozn/media/img/phrozn.png: Failed transfering "/home/private/a/src/.phrozn/media/img/phrozn.png" from media folder

(Followed by several error messages due to the root filesystem being read-only.)

With an absolute destination path:

$ mkdir src dst
$ ls
dst/ src/
$ phr init src
$ phr up src/.phrozn ~/a/dst
Phrozn 0.5.3 by Victor Farazdagi

Starting static site compilation.

  [OK]      Source directory located: /home/private/a/src/.phrozn/
  [OK]      Destination directory located: /home/private/a/dst/../
  [OK]      ./src/.phrozn/entries/about.twig parsed
  [OK]      ./dst/../about/index.html written
  [OK]      ./src/.phrozn/entries/demos/popup.twig parsed
  [OK]      ./dst/../demos/popup.html written
  [OK]      ./src/.phrozn/entries/demos/tabs.twig parsed
  [OK]      ./dst/../demos/tabs.html written
  [OK]      ./src/.phrozn/entries/demos/twipsy.twig parsed
  [OK]      ./dst/../demos/twipsy.html written
  [OK]      ./src/.phrozn/entries/demos/modal.twig parsed
  [OK]      ./dst/../demos/modal.html written
  [OK]      ./src/.phrozn/entries/index.twig parsed
  [OK]      ./dst/../index.html written
  [OK]      ./src/.phrozn/styles/default.less parsed
  [OK]      ./dst/../styles/default.css written
  [OK]      ./src/.phrozn/styles/bootstrap.less parsed
  [OK]      ./dst/../styles/bootstrap.css written
  [OK]      ./src/.phrozn/scripts/default.js parsed
  [OK]      ./dst/../scripts/default.js written
  [OK]      ./media/img/phrozn.png copied
  [OK]      ./media/img/README copied
  [OK]      ./media/README copied

$ ls dst
(empty)
$ ls
about/      demos/      dst/        index.html  media/      scripts/    src/        styles/

I guess a sanity check with an error message would solve this nicely, but it'd be more interesting if the src folder could actually be a direct folder rather than a hidden .phrozn subfolder within an otherwise empty folder. It'd make editing and moving things around easier for the case when one has the source in one place and the generated content elsewhere. Perhaps something like a phr init --bare src command resulting in this:

$ mkdir src
$ phr init --bare src
$ ls src
archive/    config.yml  entries/    layouts/    media/      plugins/    scripts/    styles/

With a corresponding phr up --bare src dst, or even a self-detecting phr up that'd show an error message and require an explicit dst when a bare src was detected. It'd certainly help my workflow. What do you think? :)

Edit: Moved --regen issue to #76.

@wdalmut
Copy link
Collaborator

wdalmut commented Feb 6, 2013

I think that this issue is absolutelly related to PR #75 that should simplify the project generation.

The regenerate option not working I think that we need to open a dedicated issue for this problem in order to simplify issues management.

@alexgieg
Copy link

Hi! Sorry for the delay. True enough, I'm opening a new issue about the regen not working: #76.

@farazdagi
Copy link
Collaborator

Compiling into custom directory is now implemented. And since -R/--regen issue got its own ticket, closing this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants