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

Does not honor 'times' configuration option #61

Open
ml-costmo opened this issue Oct 6, 2020 · 1 comment
Open

Does not honor 'times' configuration option #61

ml-costmo opened this issue Oct 6, 2020 · 1 comment

Comments

@ml-costmo
Copy link

ml-costmo commented Oct 6, 2020

gulp-rsync does not seem to honor the times configuration option.

To replicate:

  1. Set the command option to true for debugging
  2. Set the silent option to false for debugging
  3. Set the archive option to either true or false (try both ways - it makes no difference)
  4. Set the silent option to false (false overrides a behavior of archive but is not mutually-exclusive in rsync)

Since you set command to true, you will see the command that is being run, and it will not include the --no-times long option

Expected behavior:
When the times configuration parameter is set to either true or false the corresponding --times/--no-times command line parameter should be set for rsync (either -t or --times to enable, or --no-times to disable). Note that setting archive to true sets the --times command line parameter to true internally within rsync, so having --archive and --times set at the same time is non-harmful, but redundant. However, having --archive and --no-times set at the same time is useful and perfectly valid.

Here is my entire gulp task:

gulp.task( 'copy-sources',
    function( done )
    {
        gulp.src([
            srcDir
        ])
            .pipe(
                rsync({
                    command: true, // set this to true to see the rsync command that will run
                    root: srcDir, // when set to the source code root, rsync will show '.' (cwd) as the source directory
                    hostname: dstHost,
                    destination: dstDir,
                    archive: true,
                    times: false,
                    silent: false, // set to true to make the console less chatty
                    shell: 'ssh',
                    clean: false, // set to false to leave "missing" files from the orgin alone on the destination. true to delete them (sync)
                    dryrun: false, // set to true to see what will be done without doing anything
                    recursive: true,
                    exclude: [  '.DS_Store', '.buildpath', '.externalToolBuilders', '.git', 
								'.gitignore', '.project',, '.settings', 'logs' ] // directories you don't want to sync
              
                            })
            );
        done();
    }
);

Temporary workaround:
This is kludgy, and I'm sure you would do it differently, but I was able to insert this at line 81 of rsync.js to get the desired results:

	if( undefined !== this._options.t && false === this._options.t ) {
		args.push( "--no-times" );
	}

It may be worth noting that the rsync command does not change to include either --times or the --no-times option using any combination of true or false for the archive or the times configuration option. The times configuration option seems to have zero effect on anything.

My particular use case requires all of the options supplied by archive except that I need to drop modification times, which I was able to achieve using the workaround that I wouldn't have had to implement if the times configuration option were working as expected.

@ml-costmo
Copy link
Author

Instead of waiting for a fix, I forked this repo and published my fix here:
https://github.com/iwitness-design/gulp-rsync

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

1 participant