How to compile (watch) all files in a directory and recursively?

1,847 views
Skip to first unread message

philip andrew

unread,
Jun 15, 2013, 11:15:01 AM6/15/13
to pogos...@googlegroups.com
Hi there,

How can I compile and watch all files in a directory recursively?

Thanks, Philip


Tim Macfarlane

unread,
Jun 15, 2013, 1:27:31 PM6/15/13
to philip andrew, pogos...@googlegroups.com
No built in way of doing it unfortunately, you can of course do 'pogo -cw *.pogo' for all files in a directory and some shells (zsh, and newish bash) allow a recursive glob allowing 'pogo -cw **/*.pogo'. Neither will find new files as you create them though.

For node.js projects I don't find this a problem since you can just run the pogo directly, and when you really want the JS I write a Makefile (old school!)

For web, you can use something like connect-compiler to compile the JS and cache when things change, I have a patched one at github.com/featurist/connect-compiler. Or use something like stitchy (on npm), which will put it all into one app.js file, usually better for web projects anyway.

I do have intentions of including some of features in pogo itself, especially recursive watch, but lets do source maps first! :)
--
You received this message because you are subscribed to the Google Groups "pogoscript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pogoscript+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

philip andrew

unread,
Jun 15, 2013, 10:22:07 PM6/15/13
to pogos...@googlegroups.com, philip andrew
Yes I use Yeoman for web builds, http://yeoman.io/.

I'll take a look at these two, not sure how to use them yet in my Grunt build file.

Thanks

philip andrew

unread,
Jun 15, 2013, 10:42:01 PM6/15/13
to pogos...@googlegroups.com, philip andrew
Hi Tim,

I guess what I need is the equivilent of Grunt Contrib Coffee.


In my Gruntfile.js it has:
  grunt.initConfig({
    yeoman: yeomanConfig,
    watch: {
      coffee: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
        tasks: ['coffee:dist']
      },

Which uses the coffee task to compile the scripts...

Phil

On Sunday, June 16, 2013 1:27:31 AM UTC+8, Tim Macfarlane wrote:

Tim Macfarlane

unread,
Jun 16, 2013, 12:00:51 PM6/16/13
to philip andrew, pogos...@googlegroups.com
Looks like a good idea, not familiar with those tools but sounds like I should be!

There is an API for pogo, including methods for compilation and evaluation. They're not documented, but are stable and could help you with anything you might want to do with grunt.

    pogo = require 'pogo'

    pogo.compile (...)
    pogo.evaluate (...)


Tim.

philip andrew

unread,
Aug 13, 2013, 1:58:20 AM8/13/13
to pogos...@googlegroups.com, philip andrew
Hi,

Yes thanks for the API - I wrote my own code based upon yours slightly, written in Coffeescript, assuming your a developer and you start with Coffeescript.


Thats immediately obvious to you of course, but for any other developer who comes along, they may want to compile all *.pogo files in a directory and have the *.js outputted to another directory and do it from node js javaascript.
It could be improved to support scanning for changes in the files by comparing the timestamp of changed file, also to run in a loop polling could be an improvement.

I'm doing a project using some of Pogoscript for the Intel Perception Computing Challenge, https://perceptualchallenge.intel.com/ - cross my fingers and hope to win.

Phil

Oleksandr Knyga

unread,
Jan 7, 2014, 9:11:39 AM1/7/14
to pogos...@googlegroups.com

Use Kjscompiler - makes compilation of multiple JavaScript files with Google Closure Compiler application in right order.

суббота, 15 июня 2013 г., 18:15:01 UTC+3 пользователь philip andrew написал:
Reply all
Reply to author
Forward
0 new messages