Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newer always says [no files] with rsync task #21

Closed
mnpenner opened this issue Dec 6, 2013 · 4 comments
Closed

newer always says [no files] with rsync task #21

mnpenner opened this issue Dec 6, 2013 · 4 comments

Comments

@mnpenner
Copy link

mnpenner commented Dec 6, 2013

I'm trying to use newer to rsync any modified files up to my dev server. Here's my setup:

watch: {
    upload: {
        files: ['**/*'],
        tasks: ['newer:rsync:dev']
    },
},

rsync: {
    options: {
        args: ['--verbose'],
        exclude: ['.*','node_modules','sql','artifacts','session','logs','cache'],
        recursive: true,
        syncDestIgnoreExcl: true
    },
    dev: {
        options: {
            src: './',
            dest: '/path/to/project',
            host: 'dev3',
        }
    }
},

When I run the watch with --verbose and the modify a file, it tells me:

Running "newer:rsync:dev" (newer) task
Options: cache="/path/to/project/node_modules/grunt-newer/.cache"
File: [no files]
No newer files to process.

If it's trying to compare the source files against the rsync dest, that would be incorrect, because those live on a different server.... there don't appear to be any options to suppress this behaviour, however.

@tschaub
Copy link
Owner

tschaub commented Dec 13, 2013

Thanks for the report @mnbayazit. The newer task uses Grunt's convention for specifying src/dest pairs. Unfortunately, it looks like the rsync task has a different interpretation of the dest configuration property.

As mentioned in the rsync readme:

this task does not use Grunt's in-built path expanding and globbing

So I'm afraid the two tasks will not work well together. I'll try to think about ways that it could be made to work, but I don't have any immediate suggestions.

tschaub added a commit that referenced this issue Dec 13, 2013
@mnpenner
Copy link
Author

My understanding is that newer will only check against dest if it exists. Otherwise, it keeps an internal cache to determine if the files have changed. Can't you add an option to suppress looking at dest even if it is present? I think that might be the easiest solution.

@tschaub
Copy link
Owner

tschaub commented Dec 13, 2013

The current logic is that if dest is present in a task's config but isn't a file that exists, use all src files. This allows tasks to run properly after clean (in cases where clean removes dest files).

An option to ignore all dest files would work.

  newer: {
    options: {
      dest: false
    }
  }

But this would be a "global" option. That is, all tasks prefixed with newer would behave in the same way.

The same kind of option could be used to tell newer that there are multiple dest files. E.g. to support grunt-spritely (see #22), the following configuration could be used:

  newer: {
    options: {
      dest: ['build/images/sprite.jpg', 'build/css/style.css']
    }
  }

In both of these cases, newer would be configured to work with a specific task. The current options (only one is documented) are meant to work when prefixing multiple tasks with newer.

I'd like to come up with a solution to override the default behavior on a task-by-task basis. The other experimental option (isNewer, see #18), should also be a per-target option.

This could be accomplished by providing options to newer using the target task's name (or name:target for multitasks).

E.g.

  newer: {
    rsync: {
      ignoreDest: true
    }
  }

I'd like to come up with something that is flexible enough to use on multiple tasks. Suggestions welcome.

@tschaub
Copy link
Owner

tschaub commented Mar 1, 2014

No progress on a workaround for this yet. I'll reopen if anything changes.

@tschaub tschaub closed this as completed Mar 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants