{"action":"created","issue":{"url":"https://api.github.com/repos/fakefs/fakefs/issues/310","repository_url":"https://api.github.com/repos/fakefs/fakefs","labels_url":"https://api.github.com/repos/fakefs/fakefs/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/fakefs/fakefs/issues/310/comments","events_url":"https://api.github.com/repos/fakefs/fakefs/issues/310/events","html_url":"https://github.com/fakefs/fakefs/issues/310","id":91653100,"node_id":"MDU6SXNzdWU5MTY1MzEwMA==","number":310,"title":"Errno::ENOENT: No such file or directory","user":{"login":"volkanunsal","id":151600,"node_id":"MDQ6VXNlcjE1MTYwMA==","avatar_url":"https://avatars2.githubusercontent.com/u/151600?v=4","gravatar_id":"","url":"https://api.github.com/users/volkanunsal","html_url":"https://github.com/volkanunsal","followers_url":"https://api.github.com/users/volkanunsal/followers","following_url":"https://api.github.com/users/volkanunsal/following{/other_user}","gists_url":"https://api.github.com/users/volkanunsal/gists{/gist_id}","starred_url":"https://api.github.com/users/volkanunsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volkanunsal/subscriptions","organizations_url":"https://api.github.com/users/volkanunsal/orgs","repos_url":"https://api.github.com/users/volkanunsal/repos","events_url":"https://api.github.com/users/volkanunsal/events{/privacy}","received_events_url":"https://api.github.com/users/volkanunsal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-06-28T23:09:48Z","updated_at":"2018-08-16T19:40:39Z","closed_at":"2018-08-16T19:40:39Z","author_association":"NONE","body":"I am using FakeFS to capture the output Sprockets compilation. I thought this would be easy, but it hasn't been. The problem I am running into is for some reason FakeFS cannot find the fake file it created –– that is my guess. \n\nHere is the my terminal output:\n\n``` bash\n[2] pry(#<AssetFinder>)> output_dir = Rails.root.join(\"public/assets\")\n=> #<FakeFS::Pathname:/Users/newuser/w/citiesense/search/public/assets>\n[3] pry(#<AssetFinder>)> output_dir.children\n=> [#<FakeFS::Pathname:/Users/newuser/w/citiesense/search/public/assets/sample-a8866ad1c1fd36e33c8b25b41f1cf65b.js+>]\n[4] pry(#<AssetFinder>)> manifest.compile(matcher)\nErrno::ENOENT: No such file or directory - /Users/newuser/w/citiesense/search/public/assets/sample-a8866ad1c1fd36e33c8b25b41f1cf65b.js+\nfrom /Users/newuser/.rvm/gems/ruby-2.1.5@citiesense_search/gems/fakefs-0.6.7/lib/fakefs/fileutils.rb:188:in `block in mv'\n```\n\nAs you can see from line `[3]`, the file seems to be in the file system, but `fakefs/fileutils.rb:188` doesn't think so. This is the code that throws that error:\n\n``` ruby\nif (target = FileSystem.find(path))\n  dest_path = if File.directory?(dest)\n                File.join(dest, File.basename(path))\n              else\n                dest\n              end\n  if File.directory?(dest_path)\n    fail Errno::EEXIST, dest_path unless options[:force]\n  elsif File.directory?(File.dirname(dest_path))\n    FileSystem.delete(dest_path)\n    FileSystem.add(dest_path, target.entry.clone)\n    FileSystem.delete(path)\n  else\n    fail Errno::ENOENT, dest_path unless options[:force]\n  end\nelse\n  fail Errno::ENOENT, path\nend\n```\n\nCan anyone shed any light on why `FileSystem.find` is returning nil here?\n"},"comment":{"url":"https://api.github.com/repos/fakefs/fakefs/issues/comments/413661498","html_url":"https://github.com/fakefs/fakefs/issues/310#issuecomment-413661498","issue_url":"https://api.github.com/repos/fakefs/fakefs/issues/310","id":413661498,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzY2MTQ5OA==","user":{"login":"gnikonorov","id":13026015,"node_id":"MDQ6VXNlcjEzMDI2MDE1","avatar_url":"https://avatars2.githubusercontent.com/u/13026015?v=4","gravatar_id":"","url":"https://api.github.com/users/gnikonorov","html_url":"https://github.com/gnikonorov","followers_url":"https://api.github.com/users/gnikonorov/followers","following_url":"https://api.github.com/users/gnikonorov/following{/other_user}","gists_url":"https://api.github.com/users/gnikonorov/gists{/gist_id}","starred_url":"https://api.github.com/users/gnikonorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnikonorov/subscriptions","organizations_url":"https://api.github.com/users/gnikonorov/orgs","repos_url":"https://api.github.com/users/gnikonorov/repos","events_url":"https://api.github.com/users/gnikonorov/events{/privacy}","received_events_url":"https://api.github.com/users/gnikonorov/received_events","type":"User","site_admin":false},"created_at":"2018-08-16T19:40:39Z","updated_at":"2018-08-16T19:40:39Z","author_association":"COLLABORATOR","body":"Hi @volkanunsal,\r\n\r\nIt seems like this is no longer an issue. I was able to find the file `sample-a8866ad1c1fd36e33c8b25b41f1cf65b.js+` using both `ruby` and `ruby` under `fakefs`. I am going to close out this issue since I can't reproduce it and it's old, but please do re-open it if I misunderstood you.\r\n\r\nWith `fakefs`:\r\n```\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…45]\r\n15:38 $ cat file_with_plus_write.rb\r\nrequire 'fakefs'\r\n\r\nfilename = 'sample-a8866ad1c1fd36e33c8b25b41f1cf65b.js+'\r\nFile.open(filename, 'w') { |file| file.write(\"Some content\") }\r\nexists = File.exist?(filename)\r\nif exists then\r\n  puts \"File exists\"\r\nelse\r\n  puts \"File does not exist\"\r\nend\r\n\r\nfilename = 'a8866ad1c1fd36e33c8b25b41f1cf65b.js+'\r\nexists = File.exist?(filename)\r\nif exists then\r\n  puts \"File exists\"\r\nelse\r\n  puts \"File does not exist\"\r\nend\r\n\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…45]\r\n15:38 $ ruby file_with_plus_write.rb\r\nFile exists\r\nFile does not exist\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…45]\r\n15:38 $\r\n```\r\n\r\nWithout `fakefs`:\r\n```\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…45]\r\n15:39 $ cat file_with_plus_write.rb\r\n#require 'fakefs'\r\n\r\nfilename = 'sample-a8866ad1c1fd36e33c8b25b41f1cf65b.js+'\r\nFile.open(filename, 'w') { |file| file.write(\"Some content\") }\r\nexists = File.exist?(filename)\r\nif exists then\r\n  puts \"File exists\"\r\nelse\r\n  puts \"File does not exist\"\r\nend\r\n\r\nfilename = 'a8866ad1c1fd36e33c8b25b41f1cf65b.js+'\r\nexists = File.exist?(filename)\r\nif exists then\r\n  puts \"File exists\"\r\nelse\r\n  puts \"File does not exist\"\r\nend\r\n\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…45]\r\n15:39 $ ruby file_with_plus_write.rb\r\nFile exists\r\nFile does not exist\r\n~/projects/fakefs/.my_tests/test_issue_310 [master|…46]\r\n15:39 $\r\n```"}}
{"actor":{"display_login":"gnikonorov"}}