Commit Graph

128 Commits

Author SHA1 Message Date
Scott Taylor
02b76af287 Add File#to_i (an alias for fileno) 2009-11-08 13:27:51 -05:00
Scott Taylor
1e685ed25e Implement File#to_io 2009-11-08 13:27:50 -05:00
Scott Taylor
2877f7d4c1 Cleanup trailing whitespace 2009-11-08 01:04:16 -05:00
Scott Taylor
d2264eb646 Fix FakeFS#close 2009-11-08 00:56:00 -05:00
Scott Taylor
dd8ff05eec Make sure that no StringIO instance methods leak out FakeFS::File that aren't in File 2009-11-05 03:25:04 -05:00
Scott Taylor
daad2bb625 Ensure that every method in IO and File (RealFile) is in FakeFS::File (since File < IO). raise NotImplemenetedErrors for methods which have not yet been implemented. 2009-11-05 03:22:39 -05:00
Scott Taylor
ba4de58233 Add File#pos=, File#tell= 2009-11-05 03:21:53 -05:00
Scott Taylor
9e50475cb3 Add File#pos 2009-11-05 03:21:49 -05:00
Jon Yurek
bfffa910e9 Bitmask file creation modes allow for Tempfile compatability. 2009-10-30 09:53:39 -07:00
Sam Goldstein
1c6825fb9b added support for recursive globbing
FakeDir.glob now handles recursive globs (i.e. '**') like the standard
lib Dir.  Previously they were treated identically to single wild cards
(i.e. '*')

Resolves issue #16
http://github.com/defunkt/fakefs/issues#issue/16
2009-10-29 09:26:54 -07:00
Scott Taylor
01b0421c49 Add File#seek. Fixes Github Issue #19 2009-10-29 05:46:39 -04:00
Scott Taylor
6f5cff81ca Add binary mode. Resolves Github #13 2009-10-29 05:46:39 -04:00
Scott Barron
838274f965 Dir.entries returns only basenames, not full paths - make FakeFS match that behavior 2009-10-27 00:27:34 +08:00
dmathieu
20ef508317 Refactoring ln_sf and testing it 2009-10-14 15:36:13 +08:00
Nick Quaranto
8f26158a5a Adding a passable implementation of File.mtime 2009-10-07 00:13:58 -07:00
Nick Quaranto
72e8ee62c7 Allowing File#read to chunk IO 2009-10-07 00:08:20 -07:00
Nick Quaranto
5deda9b456 File.size? actually returns nil instead of false 2009-10-07 00:06:43 -07:00
Nick Quaranto
e591d3b2d3 Adding File.size? too 2009-10-07 00:06:36 -07:00
Nick Quaranto
166ff444d9 Aliasing File.readable? to File.exist? so Rack::File can work 2009-10-07 00:06:28 -07:00
Scott Taylor
c00d450662 Add File::delete and alias File::unlink. Get those, plus FileUtils.rm to work properly with hard links. Closes #8 2009-10-01 02:52:02 -04:00
Scott Taylor
bdcdc26d49 Add hard links. Closes #11 2009-10-01 02:46:07 -04:00
Scott Taylor
7e927d8ff0 Add File.symlink as an alias for FileUtils.ln_s 2009-10-01 02:46:07 -04:00
Scott Taylor
34a88c4e63 Start File::Stat. Add Stat#symlink?, stat#directory? 2009-10-01 02:46:07 -04:00
Scott Taylor
6f08568d8f Add File.link as a copy operation 2009-10-01 02:46:06 -04:00
Scott Taylor
6d44186cf7 Truncate an existing file in "w", "w+" modes. 2009-10-01 02:46:00 -04:00
Scott Taylor
3a5098092c Raise an IOError when a file is read in a write-only mode. 2009-10-01 02:46:00 -04:00
Scott Taylor
e3446636e5 Create files in w, w+, a, and a+ modes when calling File.new and the file is missing. 2009-10-01 02:46:00 -04:00
Scott Taylor
17e2e47027 Raise an error when opening a file which does not exist in read-write ('r+') mode 2009-10-01 02:46:00 -04:00
Scott Taylor
2881614123 Raise an Errno::ENOENT error when opening a file which does not exist 2009-10-01 02:45:59 -04:00
Scott Taylor
a8245db145 Raise an error when giving File.open an illegal access mode. Set default mode for File.open to READ_ONLY 2009-10-01 02:45:59 -04:00
Scott Taylor
6068034c29 Don't allow writing in read-only mode 2009-10-01 02:45:59 -04:00
Jon Yurek
a34f8e8beb Implemented File.size 2009-09-30 12:08:54 +08:00
Chris Wanstrath
25e47887b0 Merge branch 'master' of github.com:defunkt/fakefs 2009-09-21 19:43:17 -07:00
Chris Wanstrath
fa89049964 style tweaks 2009-09-21 19:42:23 -07:00
Chris Wanstrath
a22f0c5ee6 Remove debug statements 2009-09-21 19:37:55 -07:00
Rob Sanheim
bbb659fcf8 Add support for mkpath, an alias for mkdir_p on FileUtils
Signed-off-by: Chris Wanstrath <chris@ozmm.org>
2009-09-22 10:28:56 +08:00
Myles Eftos
a926ebf1c5 Added File.extname and FileUtils.rmdir 2009-09-14 01:41:00 +08:00
Myles Eftos
1403c5b421 Fixed Dir read method to strip the path, so it matches the Ruby Dir path. Bumped version number 2009-09-13 22:50:34 +08:00
Myles Eftos
fa3f27e6c3 Finished tests for Class methods. chroot isn't implemented 2009-09-13 22:10:42 +08:00
Myles Eftos
af330bc5ab Added tests for Dir instance methods 2009-09-13 21:50:08 +08:00
David Reese
e8257feadd File#puts accepts (*args) and arrays
Signed-off-by: Chris Wanstrath <chris@ozmm.org>
2009-09-11 22:23:55 +08:00
Matt Freels
9d09436dba handle case where FileSystem.find has to find the root 2009-07-28 01:12:52 -07:00
Matt Freels
76002ea431 support globbing to files and partial path part matches 2009-07-28 00:25:31 -07:00
Matt Freels
506a33fed4 Dir.pwd and Dir.getwd 2009-07-27 10:56:56 -07:00
Chris Wanstrath
ffeb6516f5 Mock{Dir, File, Symlink} => Fake{Dir, File, Symlink} 2009-07-27 00:09:06 -07:00
Chris Wanstrath
a7f20095f0 fix random cloning bugs 2009-07-19 15:23:42 -07:00
Chris Wanstrath
eb634265e6 do a deep copy of the hash 2009-07-19 14:23:02 -07:00
Pat Nakajima
7d57d483df Implemented File#<< and File#close 2009-07-19 14:17:04 -07:00
Chris Wanstrath
04a6a7a527 when copying or moving files, ensure the new parent gets set correctly 2009-07-19 14:16:21 -07:00
Jeff Hodges
a201579ef4 FileUtils.touch with multiple files was broken on 1.9.
String#each does not exist in ruby 1.9, so Array() must be used.
2009-06-13 23:56:14 -07:00
Mark
bd97171227 Refactored touch to verify that the parent directories exist 2009-06-13 22:29:00 -07:00
Mark
27e24b2260 Added touch to fileutils 2009-06-13 00:22:37 -07:00
Pat Nakajima
d7870563aa Fixed inconsistent File.directory? behavior 2009-06-12 18:22:48 -04:00
Pat Nakajima
57d02ab8b2 More accurate test for File.file? 2009-06-12 18:16:16 -04:00
Pat Nakajima
94afbcabc1 Fixed File.file? for non-existent files 2009-06-12 17:54:32 -04:00
Pat Nakajima
bf6f121601 Fix FileUtils.cp behavior. 2009-06-11 18:11:44 -04:00
Chris Wanstrath
3537c43cbe add FileUtils.cp & tests 2009-06-03 17:53:07 -07:00
Chris Wanstrath
e051533cd4 ensure File.read raises the correct error 2009-06-03 17:47:10 -07:00
Jeff Hodges
8aba1ad6a5 we can now clone even hard to find dotfiles 2009-06-02 00:16:19 -07:00
Jeff Hodges
364dc66ee5 FileSystem.clone now clones directories and dot files. 2009-06-01 23:54:04 -07:00
Jeff Hodges
c0be5bd8f2 cp_r given a src ending in '/.' now copies over the contents of the
src dir.
2009-06-01 04:13:53 -07:00
Jeff Hodges
da576d4208 Fixes to cp_r, ln_s, directory? and file?. Raise an error if we try to cp_r into
something that isn't a directory. Do not allow symlinking if the path
the symlink would be at already exists. directory? and file? now
correctly pass if called on a symlink path that points to a path of
the corresponding type.
2009-06-01 03:52:08 -07:00
Jeff Hodges
ddcdfcd04f Suddenly, cp_r works beautifully! This commit now lets us handle the
case where a directory is meant to be copied as a subdirectory to the
destination path when that path already exists. We also do the
appropriate error message when the dest path given is non-existent and
so is its parent.

Oh, crap, we should probably check that it's a directory that we are
merging into.
2009-06-01 03:25:12 -07:00
Jeff Hodges
4de717a976 Hum, how did that test pass last night? 2009-05-31 22:41:11 -07:00
Jeff Hodges
4f6259d180 FileSystem.clone now works when cloning regular files. 2009-05-31 02:24:33 -07:00
Jeff Hodges
2a0eba7933 cp_r should also raise an error when it cannot find the source file. 2009-05-30 23:40:45 -07:00
Jeff Hodges
35c2da972b Fixing cp_r sharing data between files copied 2009-05-30 23:30:50 -07:00
Jeff Hodges
b5e7359eac fixing FileUtils.mv 2009-05-30 23:24:29 -07:00
Jeff Hodges
2b3132096c FileUtils.mv should raise error on missing file 2009-05-30 22:04:17 -07:00
Jeff Hodges
45b0e2828f adding File#flush 2009-05-30 21:22:57 -07:00
Jeff Hodges
97e2133282 Dir.chdir can now be called without a block, and another error state
in chdir is taken care of. Specifically, where chdir into a
non-existent directory could put the filesystem into a broken state.
2009-05-30 20:40:21 -07:00
Jeff Hodges
b3bc7f6615 chdir now can be nested inside itself, errors if the directory doesn't
exist and we can still use absolute paths inside it.
2009-05-30 20:21:44 -07:00
Jeff Hodges
35c88244de default File.open to read mode 2009-05-30 11:31:19 -07:00
Jeff Hodges
d9a44e5482 Dir.chdir support (but not without a block :() 2009-05-30 11:30:46 -07:00
Jeff Hodges
af2eb63dbe Adding support for chown, chown_R and tests for Dir.glob. 2009-05-30 10:56:06 -07:00
Chris Wanstrath
b9a8f4e8ca few more read tests, readlines 2009-05-29 11:46:49 -07:00
Chris Wanstrath
d8aa9f38fc don't overwrite existing directories yet 2009-05-29 11:00:44 -07:00
Chris Wanstrath
384d58e736 make tests work, add more, start adding File.read and friends 2009-05-29 10:23:39 -07:00