Coder Social home page Coder Social logo

Comments (15)

thomasfl avatar thomasfl commented on September 26, 2024

Hi Mikael!

What a brilliant idea to let ruby export an environment variabel to the sub process with the updated filename. I will most definitely try it out today or tomorrow.

I had the same problem yesterday when using filewatcher to automatically run jslint on a set of javascript files.

Regards
Thomas Flemming :-)

Den 9. jan. 2013 kl. 09:53 skrev Maikel D [email protected]:

Hello,

I'm trying to write 1 script that can watch for my Jade, SCSS and CoffeeScript files and compile them on save.

Your filewatcher has got me there except for 1 obstacle, I can't tell which file was saved so I can re-compile it.

I don't use ruby, so I'm using this script from the command line. I run the following code:

filewatcher -r . "*.jade *.scss" "echo [X] updated"
All I need is for [x] to be replaced with the filename. Is that possible through your plugin?
I've tried a few different variable names (thought I might get lucky) but had no luck.


Reply to this email directly or view it on GitHub.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

It would be really handy and it will make your plugin much more powerful.

It might be a good idea to pass 3 variables, just for flexibility, for
example {filename}, {file_dir} and {filepath}. Where filename is only the
name, e.g. index.scss, file_dir is only the directory, e.g. ./css/ and
filepath is the full url, e.g. ./css/index.scss.

This will make your plugin very flexible :-)

I'm looking forward to see the update.
On 10 Jan 2013 01:14, "Thomas Flemming" [email protected] wrote:

Hi Mikael!

What a brilliant idea to let ruby export an environment variabel to the
sub process with the updated filename. I will most definitely try it out
today or tomorrow.

I had the same problem yesterday when using filewatcher to automatically
run jslint on a set of javascript files.

Regards
Thomas Flemming :-)

Den 9. jan. 2013 kl. 09:53 skrev Maikel D [email protected]:

Hello,

I'm trying to write 1 script that can watch for my Jade, SCSS and
CoffeeScript files and compile them on save.

Your filewatcher has got me there except for 1 obstacle, I can't tell
which file was saved so I can re-compile it.

I don't use ruby, so I'm using this script from the command line. I run
the following code:

filewatcher -r . "*.jade *.scss" "echo [X] updated"
All I need is for [x] to be replaced with the filename. Is that possible
through your plugin?
I've tried a few different variable names (thought I might get lucky)
but had no luck.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-12045680.

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

Maikel, I'll implement all three environment variables when I have time. Hopefulle this evening.

If you are using bash, you would be able to do something like this:

  $ filewatcher "*.scss" "sass $filename"

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

Yeah, that would be awesome.

Really looking forward to seeing it. Hopefully it's an easy thing for you to implement :)

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

By the way, about your gem package. Do you have to manually update it?

Because when I ran 'gem install filewatcher', I got version 0.1.5. Which was missing a lot of cool things, such as the --recurse flag. So I overwrote the content of that package (on my machine) with the content of the github repo.

I'm just curious if when you update github with a new version, the gem package is automatically updated.

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

I have committed a new version to both rubygems.org and github where FILENAME, FILEPATH and FILEDIR is available as environment variables. If you're using a unix like system you can use single quotes on the command string:

$ filewatcher *.js 'node $FILENAME'

Please let me know if it works for you. Please note that the documentation has been changed. I have to admit I haven't got the recurse option to work myself, I just merged a patch I got.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

Awesome, I'm gonna test it now.
I hope being on Windows 8 doesn't present any random issues!

About the recurse option, that's what's great about open-source :) you get a very helpful community.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

This is what I'm getting with single quotes:

$ filewatcher -r . "*.scss *.jade" 'echo $FILENAME $FILEPATH $FILEDIR changed'
$FILENAME $FILEPATH $FILEDIR changed
$FILENAME $FILEPATH $FILEDIR changed

And this is with double quotes:

$ filewatcher -r . "*.scss *.jade" "echo $FILENAME $FILEPATH $FILEDIR changed"
     changed
     changed

I'm using Windows 8, with Git Bash, which emulates a lot of the linux stuff.
Any ideas how to get around this?

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

Try without quotes around file patterns, like this;

$ filewatcher -r . *.scss *.jade 'echo $FILENAME $FILEPATH $FILEDIR changed'

Thomas Flemming

Den 11. jan. 2013 kl. 01:03 skrev Maikel D [email protected]:

This is what I'm getting with single quotes:

$ filewatcher -r . "*.scss *.jade" 'echo $FILENAME $FILEPATH $FILEDIR changed'
$FILENAME $FILEPATH $FILEDIR changed
$FILENAME $FILEPATH $FILEDIR changed
And this is with double quotes:

$ filewatcher -r . "*.scss *.jade" "echo $FILENAME $FILEPATH $FILEDIR changed"
changed
changed
I'm using Windows 8, with Git Bash, which emulates a lot of the linux stuff.
Any ideas how to get around this?


Reply to this email directly or view it on GitHub.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

I got the same thing.

$ filewatcher -r . *.scss *.jade 'echo $FILENAME $FILEPATH $FILEDIR changed'
$FILENAME $FILEPATH $FILEDIR changed
$FILENAME $FILEPATH $FILEDIR changed

There's nothing wrong with the 'watching' of files, that happens just fine.
I did a tiny bit of research based on my tiny knowledge of ruby, and it seems that the ruby ENV variable isn't exposed to the system, or something like that?

I don't know if there's a workaround to get it working on Windows!

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

I' have a pc at work where I can test it later today.

-Thomas Flemming

Den 11. jan. 2013 kl. 02:38 skrev Maikel D [email protected]:

I got the same thing.

$ filewatcher -r . *.scss *.jade 'echo $FILENAME $FILEPATH $FILEDIR changed'
$FILENAME $FILEPATH $FILEDIR changed
$FILENAME $FILEPATH $FILEDIR changed
There's nothing wrong with the 'watching' of files, that happens just fine.
I did a tiny bit of research based on my tiny knowledge of ruby, and it seems that the ruby ENV variable isn't exposed to the system, or something like that?

I don't know if there's a workaround to get it working on Windows!


Reply to this email directly or view it on GitHub.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

Best of luck :)

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

Try using %FILENAME% in git bash.

Sendt fra min mobiltelefon, hilsen
Thomas Flemming

Den 11. jan. 2013 kl. 08:37 skrev Maikel D [email protected]:

Best of luck :)


Reply to this email directly or view it on GitHub.

from filewatcher.

maikeldaloo avatar maikeldaloo commented on September 26, 2024

That's awesome.

That works. Well done Thomas :)

On 12 January 2013 02:59, Thomas Flemming [email protected] wrote:

Try using %FILENAME% in git bash.

Sendt fra min mobiltelefon, hilsen
Thomas Flemming

Den 11. jan. 2013 kl. 08:37 skrev Maikel D [email protected]:

Best of luck :)


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-12150287.

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

The documentation is updated. Closing...

from filewatcher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.