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

Guard doesn't run after rsync updates a file (debug shows that it is partially working...) #794

Closed
tden012 opened this issue Oct 10, 2015 · 10 comments

Comments

@tden012
Copy link

tden012 commented Oct 10, 2015

Hi guys

My set up is as follows:

I am developing a rails app in a virtual machine being managed by vagrant. Currently, I am using rsync to update files in the virtual machine. My rsync arguments in Vagrant look like this:

config.vm.synced_folder "./data", "/var/www/nginx",
    type: "rsync",
    owner: "root",
    group: "www",
    rsync__exclude: ["tmp/", ".git/", "Gemfile.lock"],
    rsync__args: ["-rltW", "--delete", "--chown=false"]

In addition, I am using the guard-rspec gem to perform automated testing.

I know that guard works correctly because if I change a file from within the VM, guard runs fine. However, when I change a file on the host machine it does not seem to run.

When I run guard in debug mode (guard -d) and change a file from within the VM, I see the following output (and guard works like a charm):

21:37:05 - DEBUG - Start interactor
21:37:06 - DEBUG - Interactor was stopped or killed
21:37:06 - DEBUG - Hook :run_on_modifications_begin executed for Guard::RSpec

However, when I run guard in debug mode and change the same file on my host I see this output:

21:37:09 - DEBUG - Start interactor
21:38:06 - DEBUG - Interactor was stopped or killed
21:38:06 - DEBUG - Start interactor

I understand that the fact that the Interactor is killed means that it is picking up the file change. What I don't understand is why this is not being processed correctly (i.e. the hook is missing). Can anyone help?

Here's my guardfile in full, in case it helps. Thanks in advance.

PS: I did try using listen to forward local file system changes, but it seems that listen doesn't support TCP forwarding any more. In addition, I can't get version 2.9 of listen to work either. But, given that guard seems to be detecting the file system change, I think I'm missing something very small (and possibly very obvious)...

guard :rspec, cmd: "bundle exec rspec" do
  require "guard/rspec/dsl"
  dsl = Guard::RSpec::Dsl.new(self)

  # Feel free to open issues for suggestions and improvements

  # RSpec files
  rspec = dsl.rspec
  watch(rspec.spec_helper) { rspec.spec_dir }
  watch(rspec.spec_support) { rspec.spec_dir }
  watch(rspec.spec_files)

  # Ruby files
  ruby = dsl.ruby
  dsl.watch_spec_files_for(ruby.lib_files)

  # Rails files
  rails = dsl.rails(view_extensions: %w(erb haml slim))
  dsl.watch_spec_files_for(rails.app_files)
  dsl.watch_spec_files_for(rails.views)

  watch(rails.controllers) do |m|
    [
      rspec.spec.("routing/#{m[1]}_routing"),
      rspec.spec.("controllers/#{m[1]}_controller"),
      rspec.spec.("acceptance/#{m[1]}")
    ]
  end

  # Rails config changes
  watch(rails.spec_helper)     { rspec.spec_dir }
  watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
  watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }

  # Capybara features specs
  watch(rails.view_dirs)     { |m| rspec.spec.("features/#{m[1]}") }
  watch(rails.layouts)       { |m| rspec.spec.("features/#{m[1]}") }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
  end

end
@e2
Copy link
Contributor

e2 commented Oct 10, 2015

I know that guard works correctly because if I change a file from within the VM, guard runs fine. However, when I change a file on the host machine it does not seem to run.

Have you checked that the rsync does work? If you have a host file, does the VM file get changed?

Listen has a debugging option, so you can run LISTEN_GEM_DEBUGGING=2 bundle exec guard

If you post the output of that, it should be easier to find out what changes are actually happening, and why Guard isn't handling them.

@tden012
Copy link
Author

tden012 commented Oct 11, 2015

Have you checked that the rsync does work? If you have a host file, does the VM file get changed?

Yes, rsync works correctly. I know this because I have opened the synced files using nano on the VM side. In addition, guard runs without a flaw using forced polling (however, I don't like that option because it chews through a lot of system resources... my CPU fan runs overtime when I use the option)

Have you checked that the rsync does work? If you have a host file, does the VM file get changed?
Listen has a debugging option, so you can run LISTEN_GEM_DEBUGGING=2 bundle exec guard

Okay, so here is the output that I got from it. Having taken a look at the last few lines myself, I would hazard a guess that Guard is picking up the the changed file as a new addition rather than a modification... perhaps this is where the issue is?

I, [2015-10-11T22:43:21.051407 #3958]  INFO -- : Listen loglevel set to: 0
I, [2015-10-11T22:43:21.051757 #3958]  INFO -- : Listen version: 3.0.3
D, [2015-10-11T22:43:21.293304 #3958] DEBUG -- : Adapter: considering polling ...
D, [2015-10-11T22:43:21.293700 #3958] DEBUG -- : Adapter: considering optimized backend...
22:43:21 - INFO - Guard::RSpec is running
D, [2015-10-11T22:43:21.553397 #3958] DEBUG -- : Waiting for processing to start...
22:43:21 - INFO - Guard is now watching at '/var/www/nginx/app'
I, [2015-10-11T22:43:21.618884 #3958]  INFO -- : Record.build(): 0.04351 seconds
[1] guard(main)> D, [2015-10-11T22:43:38.959544 #3958] DEBUG -- : inotify: app/models ([:attrib, :isdir])
D, [2015-10-11T22:43:38.959732 #3958] DEBUG -- : unknown: dir:/var/www/nginx/app/app/models ({})
D, [2015-10-11T22:43:38.960568 #3958] DEBUG -- : Scanning: app/models({}): {"license.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "license_collection.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "user.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_member.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "request_for_proposal.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_relationship.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account.rb"=>{:mtime=>1444556347.5132143, :mode=>33277}, ".keep"=>{:mtime=>1444454729.4167664, :mode=>34301}, "role.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/app/models/license.rb>, #<Pathname:/var/www/nginx/app/app/models/license_collection.rb>, #<Pathname:/var/www/nginx/app/app/models/user.rb>, #<Pathname:/var/www/nginx/app/app/models/account_member.rb>, #<Pathname:/var/www/nginx/app/app/models/concerns>, #<Pathname:/var/www/nginx/app/app/models/request_for_proposal.rb>, #<Pathname:/var/www/nginx/app/app/models/account_relationship.rb>, #<Pathname:/var/www/nginx/app/app/models/account.rb>, #<Pathname:/var/www/nginx/app/app/models/.keep>, #<Pathname:/var/www/nginx/app/app/models/role.rb>}>
D, [2015-10-11T22:43:38.961197 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/license.rb ({})
D, [2015-10-11T22:43:38.961937 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/license_collection.rb ({})
D, [2015-10-11T22:43:38.962539 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/user.rb ({})
D, [2015-10-11T22:43:38.963249 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account_member.rb ({})
D, [2015-10-11T22:43:38.964333 #3958] DEBUG -- : unknown: dir:/var/www/nginx/app/app/models/concerns ({})
D, [2015-10-11T22:43:38.966821 #3958] DEBUG -- : Scanning: app/models/concerns({}): {".keep"=>{:mtime=>1444454729.4167664, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/app/models/concerns/.keep>}>
D, [2015-10-11T22:43:38.967238 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/concerns/.keep ({})
D, [2015-10-11T22:43:38.967760 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/request_for_proposal.rb ({})
D, [2015-10-11T22:43:38.968306 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account_relationship.rb ({})
D, [2015-10-11T22:43:38.968812 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account.rb ({})
D, [2015-10-11T22:43:38.969323 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/.keep ({})
D, [2015-10-11T22:43:38.970260 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/role.rb ({})
D, [2015-10-11T22:43:38.970809 #3958] DEBUG -- : inotify: app/models ([:attrib, :isdir])
D, [2015-10-11T22:43:38.981495 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:create])
D, [2015-10-11T22:43:38.981656 #3958] DEBUG -- : added: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:change=>:added})
D, [2015-10-11T22:43:38.982347 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:attrib])
D, [2015-10-11T22:43:38.982684 #3958] DEBUG -- : modified: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:change=>:modified})
D, [2015-10-11T22:43:38.983298 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:close_write, :close])
D, [2015-10-11T22:43:38.983593 #3958] DEBUG -- : modified: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:change=>:modified})
D, [2015-10-11T22:43:38.984351 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:attrib])
D, [2015-10-11T22:43:38.984627 #3958] DEBUG -- : modified: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:change=>:modified})
D, [2015-10-11T22:43:38.986102 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:attrib])
D, [2015-10-11T22:43:38.986283 #3958] DEBUG -- : modified: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:change=>:modified})
D, [2015-10-11T22:43:38.986744 #3958] DEBUG -- : inotify: app/models/.account.rb.6mCfg3 ([:moved_from, :move])
D, [2015-10-11T22:43:38.987067 #3958] DEBUG -- : moved_from: file:/var/www/nginx/app/app/models/.account.rb.6mCfg3 ({:cookie=>610, :change=>:moved_from})
D, [2015-10-11T22:43:38.987507 #3958] DEBUG -- : inotify: app/models/account.rb ([:moved_to, :move])
D, [2015-10-11T22:43:38.987811 #3958] DEBUG -- : moved_to: file:/var/www/nginx/app/app/models/account.rb ({:cookie=>610, :change=>:moved_to})
D, [2015-10-11T22:43:38.988279 #3958] DEBUG -- : inotify: app/models ([:attrib, :isdir])
D, [2015-10-11T22:43:38.988474 #3958] DEBUG -- : unknown: dir:/var/www/nginx/app/app/models ({})
D, [2015-10-11T22:43:38.988771 #3958] DEBUG -- : Scanning: app/models({}): {"license.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "license_collection.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "user.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_member.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "request_for_proposal.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_relationship.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account.rb"=>{:mtime=>1444556347.5132143, :mode=>33277}, ".keep"=>{:mtime=>1444454729.4167664, :mode=>34301}, "role.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/app/models/license.rb>, #<Pathname:/var/www/nginx/app/app/models/license_collection.rb>, #<Pathname:/var/www/nginx/app/app/models/user.rb>, #<Pathname:/var/www/nginx/app/app/models/account_member.rb>, #<Pathname:/var/www/nginx/app/app/models/concerns>, #<Pathname:/var/www/nginx/app/app/models/request_for_proposal.rb>, #<Pathname:/var/www/nginx/app/app/models/account_relationship.rb>, #<Pathname:/var/www/nginx/app/app/models/account.rb>, #<Pathname:/var/www/nginx/app/app/models/.keep>, #<Pathname:/var/www/nginx/app/app/models/role.rb>}>
D, [2015-10-11T22:43:38.989315 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/license.rb ({})
D, [2015-10-11T22:43:38.990790 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/license_collection.rb ({})
D, [2015-10-11T22:43:38.993441 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/user.rb ({})
D, [2015-10-11T22:43:38.993932 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account_member.rb ({})
D, [2015-10-11T22:43:38.994684 #3958] DEBUG -- : unknown: dir:/var/www/nginx/app/app/models/concerns ({})
D, [2015-10-11T22:43:38.995116 #3958] DEBUG -- : Scanning: app/models/concerns({}): {".keep"=>{:mtime=>1444454729.4167664, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/app/models/concerns/.keep>}>
D, [2015-10-11T22:43:38.995567 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/concerns/.keep ({})
D, [2015-10-11T22:43:38.996086 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/request_for_proposal.rb ({})
D, [2015-10-11T22:43:38.996596 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account_relationship.rb ({})
D, [2015-10-11T22:43:38.997085 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/account.rb ({})
D, [2015-10-11T22:43:38.997630 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/.keep ({})
D, [2015-10-11T22:43:38.998092 #3958] DEBUG -- : unknown: file:/var/www/nginx/app/app/models/role.rb ({})
D, [2015-10-11T22:43:38.998926 #3958] DEBUG -- : inotify: app/models ([:attrib, :isdir])
D, [2015-10-11T22:43:39.083775 #3958] DEBUG -- : listen: raw changes: [[nil, "/var/www/nginx/app/app/models/.account.rb.6mCfg3"], [:added, "/var/www/nginx/app/app/models/account.rb"]]
D, [2015-10-11T22:43:39.087782 #3958] DEBUG -- : listen: final changes: {:modified=>[], :added=>["/var/www/nginx/app/app/models/account.rb"], :removed=>[]}
D, [2015-10-11T22:43:39.088563 #3958] DEBUG -- : Callback took 0.0005376338958740234 sec
[1] guard(main)> 

@e2
Copy link
Contributor

e2 commented Oct 11, 2015

raw changes: [[nil, "/var/www/nginx/app/app/models/.account.rb.6mCfg3"], [:added, "/var/www/nginx/app/app/models/account.rb"]]
final changes: {:modified=>[], :added=>["/var/www/nginx/app/app/models/account.rb"], :removed=>[]}

Yes, it looks like rsync in catching the file change while it's being saved by your editor (or whatever tool you're using for changes).

You should just change your editor setting on how it creates backup files (maybe none at all). I think modifying the file in-place is the best option.

Listen has some techniques for supporting specific editors to avoid this - what editor are you using?

@tden012
Copy link
Author

tden012 commented Oct 13, 2015

Sorry for the delay on this.

The editor I'm using is gedit, and I've been using it with backup files turned off. As far as I know, it is modifying the file directly. Is there anything I need to do to get gedit to work correctly?

@e2
Copy link
Contributor

e2 commented Oct 14, 2015

You can try increasing the wait delay: https://github.com/guard/guard/wiki/Command-line-options-for-Guard#-y--wait-for-delay-option

gedit was supposed to be supported, though the backup files don't match what you're getting:

https://github.com/guard/listen/blob/master/lib/listen/silencer.rb#L24

If you can, try a different editor first, and see if you get different results.

If not, I'll probably need the output and the version of gedit you're using.

I'm guessing that if you add something like this to your Guardfile

ignore /\..*\.[a-z][0-9]{6}/i

it may work. (Show me the output with debugging so I can confirm).

@tden012
Copy link
Author

tden012 commented Oct 19, 2015

Thanks for sticking with me on.

So, I the delay option, but that didn't seem to work.

I also tried the option with the ignore command, but no luck there either. This is my Guardfile with the command (just in case I'm using it wrong - your line is at the top of the file)

ignore /\..*\.[a-z][0-9]{6}/i

guard :rspec, cmd: "spring rspec" do
  require "guard/rspec/dsl"
  dsl = Guard::RSpec::Dsl.new(self)

  # Feel free to open issues for suggestions and improvements

  ignore /\..*\.[a-z][0-9]{6}/i

  # RSpec files
  rspec = dsl.rspec
  watch(rspec.spec_helper) { rspec.spec_dir }
  watch(rspec.spec_support) { rspec.spec_dir }
  watch(rspec.spec_files)

  # Ruby files
  ruby = dsl.ruby
  dsl.watch_spec_files_for(ruby.lib_files)

  # Rails files
  rails = dsl.rails(view_extensions: %w(erb haml slim))
  dsl.watch_spec_files_for(rails.app_files)
  dsl.watch_spec_files_for(rails.views)

  watch(rails.controllers) do |m|
    [
      rspec.spec.("routing/#{m[1]}_routing"),
      rspec.spec.("controllers/#{m[1]}_controller"),
      rspec.spec.("acceptance/#{m[1]}")
    ]
  end

  # Rails config changes
  watch(rails.spec_helper)     { rspec.spec_dir }
  watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
  watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }

  # Capybara features specs
  watch(rails.view_dirs)     { |m| rspec.spec.("features/#{m[1]}") }
  watch(rails.layouts)       { |m| rspec.spec.("features/#{m[1]}") }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
  end

  # Business logic specs
  watch(%r{^app/business_logic/(.+)\.rb$})    { |m| "spec/business_logic/#{m[1]}_spec.rb" }
end

The debug output, after running with ignore is:

I, [2015-10-20T11:49:47.509188 #6273]  INFO -- : Listen loglevel set to: 0
I, [2015-10-20T11:49:47.509517 #6273]  INFO -- : Listen version: 3.0.3
D, [2015-10-20T11:49:47.727990 #6273] DEBUG -- : Adapter: considering polling ...
D, [2015-10-20T11:49:47.728356 #6273] DEBUG -- : Adapter: considering optimized backend...
11:49:47 - INFO - Guard::RSpec is running
I, [2015-10-20T11:49:47.991303 #6273]  INFO -- : Record.build(): 0.04809 seconds
D, [2015-10-20T11:49:47.991442 #6273] DEBUG -- : Waiting for processing to start...
11:49:47 - INFO - Guard is now watching at '/var/www/nginx/app'
[1] guard(main)> D, [2015-10-20T11:49:59.251002 #6273] DEBUG -- : inotify: spec/models ([:attrib, :isdir])
D, [2015-10-20T11:49:59.251224 #6273] DEBUG -- : unknown: dir:/var/www/nginx/app/spec/models ({})
D, [2015-10-20T11:49:59.252101 #6273] DEBUG -- : Scanning: spec/models({}): {"request_for_proposal_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "license_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "account_spec.rb"=>{:mtime=>1445294937.514271, :mode=>34301}, "license_collection_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "account_member_spec.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_relationship_spec.rb"=>{:mtime=>1444882608.7566042, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/spec/models/request_for_proposal_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/license_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/license_collection_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_member_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_relationship_spec.rb>}>
D, [2015-10-20T11:49:59.252832 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/request_for_proposal_spec.rb ({})
D, [2015-10-20T11:49:59.253835 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/license_spec.rb ({})
D, [2015-10-20T11:49:59.254472 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_spec.rb ({})
D, [2015-10-20T11:49:59.257340 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/license_collection_spec.rb ({})
D, [2015-10-20T11:49:59.257890 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_member_spec.rb ({})
D, [2015-10-20T11:49:59.258433 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_relationship_spec.rb ({})
D, [2015-10-20T11:49:59.259246 #6273] DEBUG -- : inotify: spec/models ([:attrib, :isdir])
D, [2015-10-20T11:49:59.267926 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:create])
D, [2015-10-20T11:49:59.268106 #6273] DEBUG -- : added: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:change=>:added})
D, [2015-10-20T11:49:59.268853 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:attrib])
D, [2015-10-20T11:49:59.269191 #6273] DEBUG -- : modified: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:change=>:modified})
D, [2015-10-20T11:49:59.269926 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:close_write, :close])
D, [2015-10-20T11:49:59.270249 #6273] DEBUG -- : modified: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:change=>:modified})
D, [2015-10-20T11:49:59.270940 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:attrib])
D, [2015-10-20T11:49:59.271332 #6273] DEBUG -- : modified: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:change=>:modified})
D, [2015-10-20T11:49:59.273286 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:attrib])
D, [2015-10-20T11:49:59.273629 #6273] DEBUG -- : modified: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:change=>:modified})
D, [2015-10-20T11:49:59.274190 #6273] DEBUG -- : inotify: spec/models/.account_spec.rb.lyrHf5 ([:moved_from, :move])
D, [2015-10-20T11:49:59.274562 #6273] DEBUG -- : moved_from: file:/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5 ({:cookie=>671, :change=>:moved_from})
D, [2015-10-20T11:49:59.275088 #6273] DEBUG -- : inotify: spec/models/account_spec.rb ([:moved_to, :move])
D, [2015-10-20T11:49:59.275483 #6273] DEBUG -- : moved_to: file:/var/www/nginx/app/spec/models/account_spec.rb ({:cookie=>671, :change=>:moved_to})
D, [2015-10-20T11:49:59.276004 #6273] DEBUG -- : inotify: spec/models ([:attrib, :isdir])
D, [2015-10-20T11:49:59.276742 #6273] DEBUG -- : unknown: dir:/var/www/nginx/app/spec/models ({})
D, [2015-10-20T11:49:59.278397 #6273] DEBUG -- : Scanning: spec/models({}): {"request_for_proposal_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "license_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "account_spec.rb"=>{:mtime=>1445294937.514271, :mode=>34301}, "license_collection_spec.rb"=>{:mtime=>1444454729.4207685, :mode=>34301}, "account_member_spec.rb"=>{:mtime=>1444454729.4167664, :mode=>34301}, "account_relationship_spec.rb"=>{:mtime=>1444882608.7566042, :mode=>34301}} -> #<Set: {#<Pathname:/var/www/nginx/app/spec/models/request_for_proposal_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/license_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/license_collection_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_member_spec.rb>, #<Pathname:/var/www/nginx/app/spec/models/account_relationship_spec.rb>}>
D, [2015-10-20T11:49:59.279194 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/request_for_proposal_spec.rb ({})
D, [2015-10-20T11:49:59.280115 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/license_spec.rb ({})
D, [2015-10-20T11:49:59.281298 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_spec.rb ({})
D, [2015-10-20T11:49:59.282245 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/license_collection_spec.rb ({})
D, [2015-10-20T11:49:59.282874 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_member_spec.rb ({})
D, [2015-10-20T11:49:59.283403 #6273] DEBUG -- : unknown: file:/var/www/nginx/app/spec/models/account_relationship_spec.rb ({})
D, [2015-10-20T11:49:59.284258 #6273] DEBUG -- : inotify: spec/models ([:attrib, :isdir])
D, [2015-10-20T11:49:59.372271 #6273] DEBUG -- : listen: raw changes: [[nil, "/var/www/nginx/app/spec/models/.account_spec.rb.lyrHf5"], [:added, "/var/www/nginx/app/spec/models/account_spec.rb"]]
D, [2015-10-20T11:49:59.373999 #6273] DEBUG -- : listen: final changes: {:modified=>[], :added=>["/var/www/nginx/app/spec/models/account_spec.rb"], :removed=>[]}
D, [2015-10-20T11:49:59.375168 #6273] DEBUG -- : Callback took 0.0007839202880859375 sec

I'm using gedit version 3.10.4 with backup files unchecked, if that helps. But perhaps it's not specific to an editor, because I tried editing with both Geany and nano (from within the terminal) but had no luck.

@e2
Copy link
Contributor

e2 commented Oct 20, 2015

Ok, I got it. It's rsync that's creating those files.

Just subscribe to this issue here: guard/listen#350

I'm closing this here, since this will be fixed as soon as I release a new version of Listen with the fix.

@e2 e2 closed this as completed Oct 20, 2015
@e2
Copy link
Contributor

e2 commented Oct 20, 2015

Actually, this should fix it (add --inplace):

rsync__args: ["-rltW", "--delete", "--inplace", "--chown=false"]

@tden012
Copy link
Author

tden012 commented Oct 27, 2015

Hey, sorry for the delay on this - got caught up for a bit. I just tried out your fix and it works! Thanks for your help with this. I have to remember this in the future - didn't figure that rsync replacing instead of editing the files would cause this issue.

@e2
Copy link
Contributor

e2 commented Oct 27, 2015

Glad to help :)

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