tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 53 forks source link

Fill Timestamp file for versionning #57

Closed malys closed 9 years ago

malys commented 9 years ago

Could you integrate my modification? and publish this new version,

Thank you

tschaub commented 9 years ago

I'm in favor of merging something like your first commit (c82d53b6e9501ac41e02a42ec669e6748c806afe). If you rebase on master and push just this one commit (with the comments above addressed), I'll be happy to merge.

You'll need to provide a bit more explanation about https://github.com/malys/grunt-newer/commit/667b006d95798f0d16277294bcf3a39d48df1ef8. Since this change looks unrelated to filling the timestamp file with the time, it would be preferable to handle this in a separate branch.

malys commented 9 years ago

I have tried to use grunt-newer on Windows for a specific use case. In my process, I need to generate sprites with compass. This task spends too much time. In first step, I want to save time for my development team. The first developer adds a picture in the directory.Grunt Newer detects changes, generates sprites and he commits (files and cache). The second one updates this workspace and launches the build and Grunt Newer disables compass generation. Well done!!! If the SHA1 of cache file doesn't change, GIT doesn't want to commit it. That's why I add timestamp in cache file.

Sometimes we move (copy and paste or cut) pictures to Grunt Newer monitored directory. On Windows, the created or updated time of this file aren't always updated. That's why I have to manage both time and add counter to detect if the user adds picture. It's not perfect but It works fine.

malys commented 9 years ago

Trikon, I have used time because Grunt Newer checks is based on time. To my mind, the best solution will be to store sha1 of each file in .cache. But, this process will spend too much time.

stats.ino and stats.size proposal have the issue.

tschaub commented 9 years ago

@malys I reworked your https://github.com/malys/grunt-newer/commit/c82d53b6e9501ac41e02a42ec669e6748c806afe commit and published 1.1.0.

If you still need something like the second commit, please open a separate pull request describing the use case.

Regarding alternatives to time for comparing changes, I started some time ago on adding md5sum comparison (see 75e4947909bc9307a82cb537062dffbd6e1ecd25). The hash generation and comparison functions are in lib/util.js. If anybody wants to take a stab at hooking them up, feel free. I was imagining adding support for a method option to the newer task. By default, mtime would be compared. Optionally, md5sum could be supported.

malys commented 9 years ago

Many tanks. I will update my dependency and try it.