Compare commits

..

No commits in common. "master" and "gh-pages" have entirely different histories.

85 changed files with 9161 additions and 3978 deletions

View File

@ -1,5 +0,0 @@
Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^test/.+_test.rb$%) do |filename, _|
filename
end
end

3
.gitignore vendored
View File

@ -1,3 +0,0 @@
*.sw?
pkg
Gemfile.lock

1
.rspec
View File

@ -1 +0,0 @@
--color

View File

@ -1,35 +0,0 @@
Scott Taylor <scott@railsnewbie.com>
Pat Nakajima <patnakajima@gmail.com>
Chris Wanstrath <chris@ozmm.org>
Myles Eftos <myles@madpilot.com.au>
Jeff Hodges <jeff@somethingsimilar.com>
Matt Freels <matt@freels.name>
Eero Saynatkari <projects@kittensoft.org>
Víctor Martínez <knoopx@gmail.com>
Nick Quaranto <nick@quaran.to>
Aaron Suggs <aaron@ktheory.com>
Victor Costan <costan@gmail.com>
Eric MSP Veith <eveith@wwweb-library.net>
Jon Yurek <jyurek@thoughtbot.com>
Jared Luxenberg <jared@jaredlux.com>
Lars Gierth <lars.gierth@gmail.com>
Greg Campbell <gtcampbell@gmail.com>
Ben Mabey <ben@benmabey.com>
Mark <mark@amerine.net>
Sam Goldstein <sam@aboutus.org>
Ryan McGeary <ryan@mcgeary.org>
Noah Paessel <knowuh@gmail.com>
dmathieu <42@dmathieu.com>
Mariusz Pietrzyk <wijet@wijet.pl>
marano <thiagomarano@gmail.com>
jameswilding <james@jameswilding.net>
Tymon Tobolski <i@teamon.eu>
Scott Barron <scott@elitists.net>
Andrius Chamentauskas <andrius.chamentauskas@gmail.com>
Keita Urashima <ursm@ursm.jp>
David Reese <david@whatcould.com>
msassak <msassak@gmail.com>
Andrius Chamentauskas <sinsiliux@gmail.com>
timo3377 <tim.linquist@gmail.com>
Mislav Marohnić <mislav.marohnic@gmail.com>
Rob Sanheim <rsanheim@gmail.com>

View File

@ -1,8 +0,0 @@
source :rubygems
group :development do
gem 'rspec'
gem 'jeweler'
gem 'sdoc-helpers'
gem 'rdiscount'
end

20
LICENSE
View File

@ -1,20 +0,0 @@
Copyright (c) 2009 Chris Wanstrath
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,137 +0,0 @@
FakeFS
======
Mocha is great. But when your library is all about manipulating the
filesystem, you really want to test the behavior and not the implementation.
If you're mocking and stubbing every call to FileUtils or File, you're
tightly coupling your tests with the implementation.
def test_creates_directory
FileUtils.expects(:mkdir).with("directory").once
Library.add "directory"
end
The above test will break if we decide to use `mkdir_p` in our code. Refactoring
code shouldn't necessitate refactoring tests.
With FakeFS:
def test_creates_directory
Library.add "directory"
assert File.directory?("directory")
end
Woot.
Usage
-----
require 'fakefs'
# That's it.
Don't Fake the FS Immediately
-----------------------------
require 'fakefs/safe'
FakeFS.activate!
# your code
FakeFS.deactivate!
# or
FakeFS do
# your code
end
Rails
-----
If you are using fakefs in a rails project with bundler, you'll probably want to specify the following in your Gemfile:
gem "fakefs", :require => "fakefs/safe"
RSpec
-----
The above approach works with RSpec as well. In addition you may include
FakeFS::SpecHelpers to turn FakeFS on and off in a given example group:
require 'fakefs/spec_helpers'
describe "my spec" do
include FakeFS::SpecHelpers
end
See `lib/fakefs/spec_helpers.rb` for more info.
How is this different than MockFS?
----------------------------------
FakeFS provides a test suite and works with symlinks. It's also strictly a
test-time dependency: your actual library does not need to use or know about
FakeFS.
Caveats
-------
FakeFS internally uses the `Pathname` and `FileUtils` constants. If you use
these in your app, be certain you're properly requiring them and not counting
on FakeFS' own require.
Speed?
------
<http://gist.github.com/156091>
Installation
------------
### [Gemcutter](http://gemcutter.org/)
$ gem install fakefs
### [Rip](http://hellorip.com)
$ rip install git://github.com/defunkt/fakefs.git
Contributing
------------
Once you've made your great commits:
1. [Fork][0] FakeFS
2. Create a topic branch - `git checkout -b my_branch`
3. Push to your branch - `git push origin my_branch`
4. Create an [Issue][1] with a link to your branch
5. That's it!
Meta
----
* Code: `git clone git://github.com/defunkt/fakefs.git`
* Home: <http://github.com/defunkt/fakefs>
* Docs: <http://defunkt.github.com/fakefs>
* Bugs: <http://github.com/defunkt/fakefs/issues>
* List: <http://groups.google.com/group/fakefs>
* Test: <http://runcoderun.com/defunkt/fakefs>
* Gems: <http://gemcutter.org/gems/fakefs>
[0]: http://help.github.com/forking/
[1]: http://github.com/defunkt/fakefs/issues
Releasing
---------
1. Update version in lib/fakefs/version.rb
2. Commit it
3. rake publish

View File

@ -1,59 +0,0 @@
$LOAD_PATH.unshift File.join(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'test')
desc "Run tests"
task :test do
Dir['test/**/*_test.rb'].each { |file| require file }
end
task :default => [:test, :spec]
require 'rspec/core/rake_task'
desc "Run specs"
RSpec::Core::RakeTask.new
begin
require 'jeweler'
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
require 'fakefs/version'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "fakefs"
gemspec.summary = "A fake filesystem. Use it in your tests."
gemspec.email = "chris@ozmm.org"
gemspec.homepage = "http://github.com/defunkt/fakefs"
gemspec.description = "A fake filesystem. Use it in your tests."
gemspec.authors = ["Chris Wanstrath", "Scott Taylor", "Jeff Hodges", "Pat Nakajima"]
gemspec.has_rdoc = false
gemspec.version = FakeFS::Version.to_s
end
rescue LoadError
puts "Jeweler not available."
puts "Install it with: gem install jeweler"
end
begin
require 'sdoc_helpers'
rescue LoadError
puts "sdoc support not enabled. Please gem install sdoc-helpers."
end
desc "Build a gem"
task :gem => [ :gemspec, :build ]
desc "Push a new version to Gemcutter"
task :publish => [ :gemspec, :build ] do
abort("Tests failed!") unless system("rake test")
system "git tag v#{FakeFS::Version}"
system "git push origin v#{FakeFS::Version}"
system "git push origin master"
system "gem push pkg/fakefs-#{FakeFS::Version}.gem"
system "git clean -fd"
exec "rake pages"
end
desc "Update contributors"
task :update_contributors do
sh "git-rank-contributors > CONTRIBUTORS"
end

BIN
apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

200
classes/FakeFS.html Normal file
View File

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
FakeFS
</h1>
<ul class="files">
<li><a href="../files/lib/fakefs/base_rb.html">lib/fakefs/base.rb</a></li>
<li><a href="../files/lib/fakefs/dir_rb.html">lib/fakefs/dir.rb</a></li>
<li><a href="../files/lib/fakefs/fake/dir_rb.html">lib/fakefs/fake/dir.rb</a></li>
<li><a href="../files/lib/fakefs/fake/file_rb.html">lib/fakefs/fake/file.rb</a></li>
<li><a href="../files/lib/fakefs/fake/symlink_rb.html">lib/fakefs/fake/symlink.rb</a></li>
<li><a href="../files/lib/fakefs/file_rb.html">lib/fakefs/file.rb</a></li>
<li><a href="../files/lib/fakefs/file_system_rb.html">lib/fakefs/file_system.rb</a></li>
<li><a href="../files/lib/fakefs/file_test_rb.html">lib/fakefs/file_test.rb</a></li>
<li><a href="../files/lib/fakefs/fileutils_rb.html">lib/fakefs/fileutils.rb</a></li>
<li><a href="../files/lib/fakefs/spec_helpers_rb.html">lib/fakefs/spec_helpers.rb</a></li>
<li><a href="../files/lib/fakefs/version_rb.html">lib/fakefs/version.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000000">activate!</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000001">deactivate!</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="FakeFS/FileSystem.html">FakeFS::FileSystem</a></li>
<li><span class="type">MODULE</span> <a href="FakeFS/FileUtils.html">FakeFS::FileUtils</a></li>
<li><span class="type">MODULE</span> <a href="FakeFS/SpecHelpers.html">FakeFS::SpecHelpers</a></li>
<li><span class="type">MODULE</span> <a href="FakeFS/Version.html">FakeFS::Version</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/Dir.html">FakeFS::Dir</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/FakeDir.html">FakeFS::FakeDir</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/FakeFile.html">FakeFS::FakeFile</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/FakeSymlink.html">FakeFS::FakeSymlink</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/File.html">FakeFS::File</a></li>
<li><span class="type">CLASS</span> <a href="FakeFS/FileTest.html">FakeFS::FileTest</a></li>
</ul>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000000">
<a name="M000000"></a><b>activate!</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000000_source')" id="l_M000000_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/491da764d1500fbfcbf8f9e2242c07593af57a29/lib/fakefs/base.rb#L7" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000000_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/base.rb, line 7</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">activate!</span>
<span class="ruby-constant">Object</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:Dir</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:File</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:FileTest</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:FileUtils</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:Dir</span>, <span class="ruby-constant">FakeFS</span><span class="ruby-operator">::</span><span class="ruby-constant">Dir</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:File</span>, <span class="ruby-constant">FakeFS</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:FileUtils</span>, <span class="ruby-constant">FakeFS</span><span class="ruby-operator">::</span><span class="ruby-constant">FileUtils</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:FileTest</span>, <span class="ruby-constant">FakeFS</span><span class="ruby-operator">::</span><span class="ruby-constant">FileTest</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000001">
<a name="M000001"></a><b>deactivate!</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/491da764d1500fbfcbf8f9e2242c07593af57a29/lib/fakefs/base.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000001_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/base.rb, line 22</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deactivate!</span>
<span class="ruby-constant">Object</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:Dir</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:File</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:FileTest</span>)
<span class="ruby-identifier">remove_const</span>(<span class="ruby-identifier">:FileUtils</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:Dir</span>, <span class="ruby-constant">RealDir</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:File</span>, <span class="ruby-constant">RealFile</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:FileTest</span>, <span class="ruby-constant">RealFileTest</span>)
<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">:FileUtils</span>, <span class="ruby-constant">RealFileUtils</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

776
classes/FakeFS/Dir.html Normal file
View File

@ -0,0 +1,776 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::Dir</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::Dir
<span class="parent">&lt;
<a href="../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/dir_rb.html">lib/fakefs/dir.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>#</dt>
<dd>
<ul>
<li><a href="#M000012">[]</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000013">chdir</a>,</li>
<li><a href="#M000014">chroot</a>,</li>
<li><a href="#M000003">close</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000015">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000005">each</a>,</li>
<li><a href="#M000016">entries</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000017">foreach</a></li>
</ul>
</dd>
<dt>G</dt>
<dd>
<ul>
<li><a href="#M000018">glob</a></li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li><a href="#M000019">mkdir</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000002">new</a></li>
</ul>
</dd>
<dt>O</dt>
<dd>
<ul>
<li><a href="#M000020">open</a></li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li><a href="#M000006">path</a>,</li>
<li><a href="#M000007">pos</a>,</li>
<li><a href="#M000008">pos=</a>,</li>
<li><a href="#M000022">pwd</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000009">read</a>,</li>
<li><a href="#M000010">rewind</a></li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li><a href="#M000011">seek</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000021">tmpdir</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Included Modules</div>
<ul>
<li>
<span>Enumerable</span>
START:includes
</li>
</ul>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000012">
<a name="M000012"></a><b>[]</b>(pattern)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L55" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000012_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 55</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>(<span class="ruby-identifier">pattern</span>)
<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000013">
<a name="M000013"></a><b>chdir</b>(dir, &amp;blk)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L59" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000013_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 59</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000014">
<a name="M000014"></a><b>chroot</b>(string)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L63" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000014_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 63</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chroot</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-comment cmt"># Not implemented yet</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000015">
<a name="M000015"></a><b>delete</b>(string)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L67" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000015_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 67</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SystemCallError</span>, <span class="ruby-node">&quot;No such file or directory - #{string}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">values</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000016">
<a name="M000016"></a><b>entries</b>(dirname)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L72" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000016_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">dirname</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SystemCallError</span>, <span class="ruby-identifier">dirname</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dirname</span>)
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dirname</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file</span>) }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000017">
<a name="M000017"></a><b>foreach</b>(dirname, &amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L77" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000017_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 77</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-identifier">dirname</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">dirname</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">file</span> }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000018">
<a name="M000018"></a><b>glob</b>(pattern)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L81" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000018_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 81</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>)
[<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">pattern</span>) <span class="ruby-operator">||</span> []].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>}.<span class="ruby-identifier">sort</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000019">
<a name="M000019"></a><b>mkdir</b>(string, integer = 0)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L85" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000019_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 85</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">integer</span> = <span class="ruby-value">0</span>)
<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>)
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">pop</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-node">&quot;No such file or directory - #{string}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">||</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>))
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EEXIST</span>, <span class="ruby-node">&quot;File exists - #{string}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000002">
<a name="M000002"></a><b>new</b>(string)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000002_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 5</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-ivar">@path</span> = <span class="ruby-identifier">string</span>
<span class="ruby-ivar">@open</span> = <span class="ruby-keyword kw">true</span>
<span class="ruby-ivar">@pointer</span> = <span class="ruby-value">0</span>
<span class="ruby-ivar">@contents</span> = [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'..'</span>, ] <span class="ruby-operator">+</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@path</span>).<span class="ruby-identifier">values</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000020">
<a name="M000020"></a><b>open</b>(string, &amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L93" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000020_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 93</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">string</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">file</span>) }
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000022">
<a name="M000022"></a><b>pwd</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000022_source')" id="l_M000022_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L105" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000022_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 105</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pwd</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">current_dir</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000021">
<a name="M000021"></a><b>tmpdir</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L101" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000021_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 101</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tmpdir</span>
<span class="ruby-value str">'/tmp'</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000003">
<a name="M000003"></a><b>close</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L13" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000003_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 13</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
<span class="ruby-ivar">@open</span> = <span class="ruby-keyword kw">false</span>
<span class="ruby-ivar">@pointer</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-ivar">@contents</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000005">
<a name="M000005"></a><b>each</b>(&amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L20" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000005_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 20</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">f</span> = <span class="ruby-identifier">read</span>
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">f</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000006">
<a name="M000006"></a><b>path</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L26" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000006_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 26</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>
<span class="ruby-ivar">@path</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000007">
<a name="M000007"></a><b>pos</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L30" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000007_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pos</span>
<span class="ruby-ivar">@pointer</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000008">
<a name="M000008"></a><b>pos=</b>(integer)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L34" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000008_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pos=</span>(<span class="ruby-identifier">integer</span>)
<span class="ruby-ivar">@pointer</span> = <span class="ruby-identifier">integer</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000009">
<a name="M000009"></a><b>read</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L38" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000009_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 38</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">&quot;closed directory&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pointer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">n</span> = <span class="ruby-ivar">@contents</span>[<span class="ruby-ivar">@pointer</span>]
<span class="ruby-ivar">@pointer</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span>, <span class="ruby-value str">''</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000010">
<a name="M000010"></a><b>rewind</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L45" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000010_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 45</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rewind</span>
<span class="ruby-ivar">@pointer</span> = <span class="ruby-value">0</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000011">
<a name="M000011"></a><b>seek</b>(integer)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000011_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 49</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seek</span>(<span class="ruby-identifier">integer</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">&quot;closed directory&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pointer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
<span class="ruby-ivar">@pointer</span> = <span class="ruby-identifier">integer</span>
<span class="ruby-ivar">@contents</span>[<span class="ruby-identifier">integer</span>]
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

340
classes/FakeFS/FakeDir.html Normal file
View File

@ -0,0 +1,340 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FakeDir</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::FakeDir
<span class="parent">&lt;
Hash
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/fake/dir_rb.html">lib/fakefs/fake/dir.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000026">clone</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000028">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000024">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000025">inspect</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000023">new</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000027">to_s</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>parent</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>ctime</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>mtime</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000023">
<a name="M000023"></a><b>new</b>(name = nil, parent = nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000023_source')" id="l_M000023_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L6" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000023_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 6</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">parent</span>
<span class="ruby-ivar">@ctime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-ivar">@mtime</span> = <span class="ruby-ivar">@ctime</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000026">
<a name="M000026"></a><b>clone</b>(parent = nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L21" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000026_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 21</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>(<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
<span class="ruby-identifier">clone</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-keyword kw">self</span>))
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">clone</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>
<span class="ruby-identifier">clone</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000028">
<a name="M000028"></a><b>delete</b>(node = self)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L40" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000028_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 40</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">node</span> = <span class="ruby-keyword kw">self</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000024">
<a name="M000024"></a><b>entry</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000024_source')" id="l_M000024_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L13" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000024_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 13</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entry</span>
<span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000025">
<a name="M000025"></a><b>inspect</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000025_source')" id="l_M000025_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L17" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000025_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 17</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
<span class="ruby-node">&quot;(FakeDir name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{size})&quot;</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000027">
<a name="M000027"></a><b>to_s</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000027_source')" id="l_M000027_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L30" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000027_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'.'</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">parent</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'.'</span>
<span class="ruby-node">&quot;#{File::PATH_SEPARATOR}#{name}&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">name</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FakeFile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::FakeFile
<span class="parent">&lt;
<a href="../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/fake/file_rb.html">lib/fakefs/fake/file.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000038">clone</a>,</li>
<li><a href="#M000034">content</a>,</li>
<li><a href="#M000035">content=</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000042">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000039">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000040">inspect</a></li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li><a href="#M000037">link</a>,</li>
<li><a href="#M000036">links</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000033">new</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000041">to_s</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">CLASS</span> <a href="FakeFile/Inode.html">FakeFS::FakeFile::Inode</a></li>
</ul>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>parent</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>content</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>ctime</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>mtime</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>inode</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000033">
<a name="M000033"></a><b>new</b>(name = nil, parent = nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000033_source')" id="l_M000033_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L31" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000033_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 31</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">parent</span>
<span class="ruby-ivar">@inode</span> = <span class="ruby-constant">Inode</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
<span class="ruby-ivar">@ctime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-ivar">@mtime</span> = <span class="ruby-ivar">@ctime</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000038">
<a name="M000038"></a><b>clone</b>(parent = nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000038_source')" id="l_M000038_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L57" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000038_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 57</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>(<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
<span class="ruby-identifier">clone</span> = <span class="ruby-keyword kw">super</span>()
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">inode</span> = <span class="ruby-identifier">inode</span>.<span class="ruby-identifier">clone</span>
<span class="ruby-identifier">clone</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000034">
<a name="M000034"></a><b>content</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000034_source')" id="l_M000034_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L41" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000034_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content</span>
<span class="ruby-ivar">@inode</span>.<span class="ruby-identifier">content</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000035">
<a name="M000035"></a><b>content=</b>(str)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000035_source')" id="l_M000035_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L45" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000035_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 45</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content=</span>(<span class="ruby-identifier">str</span>)
<span class="ruby-ivar">@inode</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">str</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000042">
<a name="M000042"></a><b>delete</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L76" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000042_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 76</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>
<span class="ruby-identifier">inode</span>.<span class="ruby-identifier">unlink</span>(<span class="ruby-keyword kw">self</span>)
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000039">
<a name="M000039"></a><b>entry</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000039_source')" id="l_M000039_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L64" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000039_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 64</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entry</span>
<span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000040">
<a name="M000040"></a><b>inspect</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L68" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000040_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
<span class="ruby-node">&quot;(FakeFile name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{content.size})&quot;</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000037">
<a name="M000037"></a><b>link</b>(other_file)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000037_source')" id="l_M000037_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L53" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000037_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 53</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">other_file</span>)
<span class="ruby-ivar">@inode</span>.<span class="ruby-identifier">link</span>(<span class="ruby-identifier">other_file</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000036">
<a name="M000036"></a><b>links</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000036_source')" id="l_M000036_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000036_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 49</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">links</span>
<span class="ruby-ivar">@inode</span>.<span class="ruby-identifier">links</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000041">
<a name="M000041"></a><b>to_s</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L72" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000041_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FakeFile::Inode</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::FakeFile::Inode
<span class="parent">&lt;
<a href="../../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/fakefs/fake/file_rb.html">lib/fakefs/fake/file.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000032">clone</a></li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li><a href="#M000030">link</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000029">new</a></li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li><a href="#M000031">unlink</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>content</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>links</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000029">
<a name="M000029"></a><b>new</b>(file_owner)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L7" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000029_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 7</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_owner</span>)
<span class="ruby-ivar">@content</span> = <span class="ruby-value str">&quot;&quot;</span>
<span class="ruby-ivar">@links</span> = [<span class="ruby-identifier">file_owner</span>]
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000032">
<a name="M000032"></a><b>clone</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000032_source')" id="l_M000032_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L24" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000032_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 24</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>
<span class="ruby-identifier">clone</span> = <span class="ruby-keyword kw">super</span>
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-identifier">clone</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000030">
<a name="M000030"></a><b>link</b>(file)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L15" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000030_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 15</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">links</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">links</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">inode</span> = <span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000031">
<a name="M000031"></a><b>unlink</b>(file)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000031_source')" id="l_M000031_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/file.rb#L20" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000031_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/file.rb, line 20</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unlink</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">links</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,270 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FakeSymlink</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::FakeSymlink
<span class="parent">&lt;
<a href="../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/fake/symlink_rb.html">lib/fakefs/fake/symlink.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000046">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000045">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000044">inspect</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000043">new</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000047">respond_to?</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>target</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000043">
<a name="M000043"></a><b>new</b>(target)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000043_source')" id="l_M000043_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/2877f7d4c19cb4f18a3d43dc79bc8189976e3634/lib/fakefs/fake/symlink.rb#L6" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000043_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/symlink.rb, line 6</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">target</span>)
<span class="ruby-ivar">@target</span> = <span class="ruby-identifier">target</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000046">
<a name="M000046"></a><b>delete</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000046_source')" id="l_M000046_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/2877f7d4c19cb4f18a3d43dc79bc8189976e3634/lib/fakefs/fake/symlink.rb#L18" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000046_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/symlink.rb, line 18</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000045">
<a name="M000045"></a><b>entry</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000045_source')" id="l_M000045_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/2877f7d4c19cb4f18a3d43dc79bc8189976e3634/lib/fakefs/fake/symlink.rb#L14" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000045_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/symlink.rb, line 14</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entry</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">target</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000044">
<a name="M000044"></a><b>inspect</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000044_source')" id="l_M000044_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/2877f7d4c19cb4f18a3d43dc79bc8189976e3634/lib/fakefs/fake/symlink.rb#L10" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000044_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/symlink.rb, line 10</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
<span class="ruby-node">&quot;symlink(#{target.split('/').last})&quot;</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000047">
<a name="M000047"></a><b>respond_to?</b>(method)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/2877f7d4c19cb4f18a3d43dc79bc8189976e3634/lib/fakefs/fake/symlink.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000047_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/symlink.rb, line 22</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>)
<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

1578
classes/FakeFS/File.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::File::Stat</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::File::Stat
<span class="parent">&lt;
<a href="../../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/fakefs/file_rb.html">lib/fakefs/file.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000086">directory?</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000084">new</a>,</li>
<li><a href="#M000087">nlink</a></li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li><a href="#M000089">size</a>,</li>
<li><a href="#M000085">symlink?</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>ctime</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>mtime</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000084">
<a name="M000084"></a><b>new</b>(file, __lstat = false)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/82db05e85d1a486fbdb671af4b1d93085e515c82/lib/fakefs/file.rb#L192" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000084_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 192</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">__lstat</span> = <span class="ruby-keyword kw">false</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-node">&quot;No such file or directory - #{file}&quot;</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-ivar">@file</span> = <span class="ruby-identifier">file</span>
<span class="ruby-ivar">@fake_file</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-ivar">@__lstat</span> = <span class="ruby-identifier">__lstat</span>
<span class="ruby-ivar">@ctime</span> = <span class="ruby-ivar">@fake_file</span>.<span class="ruby-identifier">ctime</span>
<span class="ruby-ivar">@mtime</span> = <span class="ruby-ivar">@fake_file</span>.<span class="ruby-identifier">mtime</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000086">
<a name="M000086"></a><b>directory?</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/82db05e85d1a486fbdb671af4b1d93085e515c82/lib/fakefs/file.rb#L208" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000086_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 208</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directory?</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000087">
<a name="M000087"></a><b>nlink</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/82db05e85d1a486fbdb671af4b1d93085e515c82/lib/fakefs/file.rb#L212" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000087_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 212</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nlink</span>
<span class="ruby-ivar">@fake_file</span>.<span class="ruby-identifier">links</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000089">
<a name="M000089"></a><b>size</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/82db05e85d1a486fbdb671af4b1d93085e515c82/lib/fakefs/file.rb#L216" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000089_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 216</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@__lstat</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">symlink?</span>
<span class="ruby-ivar">@fake_file</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000085">
<a name="M000085"></a><b>symlink?</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/82db05e85d1a486fbdb671af4b1d93085e515c82/lib/fakefs/file.rb#L204" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000085_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 204</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">symlink?</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,506 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FileSystem</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
FakeFS::FileSystem
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/file_system_rb.html">lib/fakefs/file_system.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000063">add</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000073">chdir</a>,</li>
<li><a href="#M000056">clear</a>,</li>
<li><a href="#M000064">clone</a>,</li>
<li><a href="#M000078">current_dir</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000072">delete</a>,</li>
<li><a href="#M000054">dir_levels</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000057">files</a>,</li>
<li><a href="#M000058">find</a>,</li>
<li><a href="#M000055">fs</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000077">normalize_path</a></li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li><a href="#M000074">path_parts</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000063">
<a name="M000063"></a><b>add</b>(path, object=FakeDir.new)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L35" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000063_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 35</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">object</span>=<span class="ruby-constant">FakeDir</span>.<span class="ruby-identifier">new</span>)
<span class="ruby-identifier">parts</span> = <span class="ruby-identifier">path_parts</span>(<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">path</span>))
<span class="ruby-identifier">d</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">fs</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dir</span>, <span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">dir</span>[<span class="ruby-identifier">part</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">FakeDir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">part</span>, <span class="ruby-identifier">dir</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">last</span>
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">d</span>
<span class="ruby-identifier">d</span>[<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">last</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">object</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000073">
<a name="M000073"></a><b>chdir</b>(dir, &amp;blk)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L74" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000073_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 74</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
<span class="ruby-identifier">new_dir</span> = <span class="ruby-identifier">find</span>(<span class="ruby-identifier">dir</span>)
<span class="ruby-identifier">dir_levels</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">dir</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blk</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">dir</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">new_dir</span>
<span class="ruby-identifier">dir_levels</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">dir</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">blk</span>
<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blk</span>
<span class="ruby-keyword kw">ensure</span>
<span class="ruby-identifier">dir_levels</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blk</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000056">
<a name="M000056"></a><b>clear</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L13" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000056_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 13</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
<span class="ruby-ivar">@dir_levels</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-ivar">@fs</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000064">
<a name="M000064"></a><b>clone</b>(path)
</div>
<div class="description">
<p>
copies directories and files from the real filesystem into our fake one
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000064_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 49</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">pattern</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-value str">'**'</span>, <span class="ruby-value str">'*'</span>)
<span class="ruby-identifier">files</span> = <span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">?</span> [<span class="ruby-identifier">path</span>] <span class="ruby-operator">:</span> [<span class="ruby-identifier">path</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RealDir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-constant">RealFile</span><span class="ruby-operator">::</span><span class="ruby-constant">FNM_DOTMATCH</span>)
<span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">f</span>))
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">f</span>, <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">WRITE_ONLY</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">g</span>.<span class="ruby-identifier">print</span> <span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">f</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">read</span> }
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">ln_s</span>()
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000078">
<a name="M000078"></a><b>current_dir</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L99" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000078_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 99</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_dir</span>
<span class="ruby-identifier">find</span>(<span class="ruby-identifier">normalize_path</span>(<span class="ruby-value str">'.'</span>))
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000072">
<a name="M000072"></a><b>delete</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L68" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000072_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">delete</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000054">
<a name="M000054"></a><b>dir_levels</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000054_source')" id="l_M000054_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000054_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 5</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dir_levels</span>
<span class="ruby-ivar">@dir_levels</span> <span class="ruby-operator">||=</span> []
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000057">
<a name="M000057"></a><b>files</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L18" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000057_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 18</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">files</span>
<span class="ruby-identifier">fs</span>.<span class="ruby-identifier">values</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000058">
<a name="M000058"></a><b>find</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000058_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 22</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">parts</span> = <span class="ruby-identifier">path_parts</span>(<span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">path</span>))
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fs</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-comment cmt"># '/'</span>
<span class="ruby-identifier">entries</span> = <span class="ruby-identifier">find_recurser</span>(<span class="ruby-identifier">fs</span>, <span class="ruby-identifier">parts</span>).<span class="ruby-identifier">flatten</span>
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">length</span>
<span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword kw">else</span> <span class="ruby-identifier">entries</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000055">
<a name="M000055"></a><b>fs</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L9" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000055_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 9</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fs</span>
<span class="ruby-ivar">@fs</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">FakeDir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'.'</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000077">
<a name="M000077"></a><b>normalize_path</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L90" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000077_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 90</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">absolute?</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">parts</span> = <span class="ruby-identifier">dir_levels</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">path</span>]
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">parts</span>))
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000074">
<a name="M000074"></a><b>path_parts</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25c3b4e632aa9b7e6c46a56a1d3acd0ac5f892ad/lib/fakefs/file_system.rb#L86" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000074_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_system.rb, line 86</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path_parts</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>).<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">empty?</span> }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FileTest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
FakeFS::FileTest
<span class="parent">&lt;
<a href="../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/file_test_rb.html">lib/fakefs/file_test.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000118">exist?</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000118">
<a name="M000118"></a><b>exist?</b>(file_name)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000118_source')" id="l_M000118_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/50193f2a753e42b1b8a66fc7adae457b6d008b8d/lib/fakefs/file_test.rb#L3" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000118_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file_test.rb, line 3</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">file_name</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">file_name</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,640 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::FileUtils</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
FakeFS::FileUtils
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/fileutils_rb.html">lib/fakefs/fileutils.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000137">cd</a>,</li>
<li><a href="#M000138">chdir</a>,</li>
<li><a href="#M000134">chown</a>,</li>
<li><a href="#M000135">chown_R</a>,</li>
<li><a href="#M000128">cp</a>,</li>
<li><a href="#M000129">cp_r</a></li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li><a href="#M000126">ln_s</a>,</li>
<li><a href="#M000127">ln_sf</a></li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li><a href="#M000119">mkdir_p</a>,</li>
<li><a href="#M000120">mkpath</a>,</li>
<li><a href="#M000133">mv</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000122">rm</a>,</li>
<li><a href="#M000125">rm_f</a>,</li>
<li><a href="#M000124">rm_r</a>,</li>
<li><a href="#M000123">rm_rf</a>,</li>
<li><a href="#M000121">rmdir</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000136">touch</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000137">
<a name="M000137"></a><b>cd</b>(dir)
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000138">chdir</a>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000137_source')" id="l_M000137_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L124" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000137_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 124</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cd</span>(<span class="ruby-identifier">dir</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000138">
<a name="M000138"></a><b>chdir</b>(dir)
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000137">cd</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000134">
<a name="M000134"></a><b>chown</b>(user, group, list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000134_source')" id="l_M000134_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L98" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000134_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 98</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chown</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">group</span>, <span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-identifier">list</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">list</span>)
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
<span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">f</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">list</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000135">
<a name="M000135"></a><b>chown_R</b>(user, group, list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000135_source')" id="l_M000135_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L108" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000135_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 108</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chown_R</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">group</span>, <span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-identifier">chown</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">group</span>, <span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000128">
<a name="M000128"></a><b>cp</b>(src, dest)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000128_source')" id="l_M000128_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L41" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000128_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cp</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span>)
<span class="ruby-identifier">dst_file</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dest</span>)
<span class="ruby-identifier">src_file</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">src_file</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">src</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">src_file</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EISDIR</span>, <span class="ruby-identifier">src</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dst_file</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">dst_file</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dest</span>, <span class="ruby-identifier">src</span>), <span class="ruby-identifier">src_file</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>(<span class="ruby-identifier">dst_file</span>))
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">dest</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">dest</span>, <span class="ruby-identifier">src_file</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000129">
<a name="M000129"></a><b>cp_r</b>(src, dest)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000129_source')" id="l_M000129_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L61" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000129_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 61</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cp_r</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span>)
<span class="ruby-comment cmt"># This error sucks, but it conforms to the original Ruby</span>
<span class="ruby-comment cmt"># method.</span>
<span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;unknown file type: #{src}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dir</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">new_dir</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dest</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_dir</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">dest</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EEXIST</span>, <span class="ruby-identifier">dest</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">new_dir</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dest</span><span class="ruby-operator">+</span><span class="ruby-value str">'/../'</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">dest</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt"># This last bit is a total abuse and should be thought hard</span>
<span class="ruby-comment cmt"># about and cleaned up.</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_dir</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'/.'</span>
<span class="ruby-identifier">dir</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">new_dir</span>[<span class="ruby-identifier">f</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">clone</span>(<span class="ruby-identifier">new_dir</span>) }
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">new_dir</span>[<span class="ruby-identifier">dir</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>(<span class="ruby-identifier">new_dir</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">dest</span>, <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000126">
<a name="M000126"></a><b>ln_s</b>(target, path, options = {})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000126_source')" id="l_M000126_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L32" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000126_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 32</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ln_s</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-identifier">options</span> = { <span class="ruby-identifier">:force</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
(<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:force</span>]) <span class="ruby-operator">?</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EEXIST</span>, <span class="ruby-identifier">path</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">path</span>, <span class="ruby-constant">FakeSymlink</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">target</span>))
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000127">
<a name="M000127"></a><b>ln_sf</b>(target, path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000127_source')" id="l_M000127_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L37" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000127_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 37</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ln_sf</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">path</span>)
<span class="ruby-identifier">ln_s</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">path</span>, { <span class="ruby-identifier">:force</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span> })
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000119">
<a name="M000119"></a><b>mkdir_p</b>(path, options = {})
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000120">mkpath</a>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000119_source')" id="l_M000119_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000119_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 5</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">path</span>, <span class="ruby-constant">FakeDir</span>.<span class="ruby-identifier">new</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000120">
<a name="M000120"></a><b>mkpath</b>(path, options = {})
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000119">mkdir_p</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000133">
<a name="M000133"></a><b>mv</b>(src, dest, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000133_source')" id="l_M000133_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L89" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000133_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 89</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mv</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">dest</span>, <span class="ruby-identifier">target</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>)
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">src</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000122">
<a name="M000122"></a><b>rm</b>(list, options = {})
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000123">rm_rf</a>
<a href="FileUtils.html#M000124">rm_r</a>
<a href="FileUtils.html#M000125">rm_f</a>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000122_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 22</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rm</span>(<span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">list</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000125">
<a name="M000125"></a><b>rm_f</b>(list, options = {})
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000122">rm</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000124">
<a name="M000124"></a><b>rm_r</b>(list, options = {})
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000122">rm</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000123">
<a name="M000123"></a><b>rm_rf</b>(list, options = {})
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000122">rm</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000121">
<a name="M000121"></a><b>rmdir</b>(list, options = {})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L10" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000121_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 10</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rmdir</span>(<span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-identifier">list</span> = [ <span class="ruby-identifier">list</span> ] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">l</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>)
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">pop</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-node">&quot;No such file or directory - #{l}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">||</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>))
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">l</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">l</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOTEMPTY</span>, <span class="ruby-identifier">l</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">l</span>).<span class="ruby-identifier">values</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">rm</span>(<span class="ruby-identifier">l</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000136">
<a name="M000136"></a><b>touch</b>(list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000136_source')" id="l_M000136_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c2a9c13345ab2ec7a259401d9916e3aecc88489d/lib/fakefs/fileutils.rb#L112" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000136_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 112</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">touch</span>(<span class="ruby-identifier">list</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">list</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">directory</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">f</span>)
<span class="ruby-comment cmt"># FIXME this explicit check for '.' shouldn't need to happen</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">directory</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">directory</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'.'</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">f</span>, <span class="ruby-constant">FakeFile</span>.<span class="ruby-identifier">new</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">f</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::SpecHelpers</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
FakeFS::SpecHelpers
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/spec_helpers_rb.html">lib/fakefs/spec_helpers.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000130">extended</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000131">included</a></li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li><a href="#M000132">use_fakefs</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000130">
<a name="M000130"></a><b>extended</b>(example_group)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000130_source')" id="l_M000130_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/85d4fa117317385f8e2aa5c441b23ff5f84239c3/lib/fakefs/spec_helpers.rb#L27" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000130_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/spec_helpers.rb, line 27</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extended</span>(<span class="ruby-identifier">example_group</span>)
<span class="ruby-identifier">example_group</span>.<span class="ruby-identifier">use_fakefs</span>(<span class="ruby-identifier">example_group</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000131">
<a name="M000131"></a><b>included</b>(example_group)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000131_source')" id="l_M000131_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/85d4fa117317385f8e2aa5c441b23ff5f84239c3/lib/fakefs/spec_helpers.rb#L31" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000131_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/spec_helpers.rb, line 31</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">example_group</span>)
<span class="ruby-identifier">example_group</span>.<span class="ruby-identifier">extend</span> <span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000132">
<a name="M000132"></a><b>use_fakefs</b>(describe_block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000132_source')" id="l_M000132_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/85d4fa117317385f8e2aa5c441b23ff5f84239c3/lib/fakefs/spec_helpers.rb#L35" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000132_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/spec_helpers.rb, line 35</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_fakefs</span>(<span class="ruby-identifier">describe_block</span>)
<span class="ruby-identifier">describe_block</span>.<span class="ruby-identifier">before</span> <span class="ruby-identifier">:each</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-constant">FakeFS</span>.<span class="ruby-identifier">activate!</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">describe_block</span>.<span class="ruby-identifier">after</span> <span class="ruby-identifier">:each</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-constant">FakeFS</span>.<span class="ruby-identifier">deactivate!</span>
<span class="ruby-constant">FakeFS</span><span class="ruby-operator">::</span><span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">clear</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

109
classes/FakeFS/Version.html Normal file
View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>FakeFS::Version</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
FakeFS::Version
</h1>
<ul class="files">
<li><a href="../../files/lib/fakefs/version_rb.html">lib/fakefs/version.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000139">to_s</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">VERSION</td>
<td>=</td>
<td class="attr-value">&quot;0.3.1&quot;</td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000139">
<a name="M000139"></a><b>to_s</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000139_source')" id="l_M000139_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c59eb01b95e181108645184244000da2976633a6/lib/fakefs/version.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000139_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/version.rb, line 5</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-constant">VERSION</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

105
classes/Object.html Normal file
View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Object</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
Object
<span class="parent">&lt;
<a href="Object.html">Object</a>
</span>
</h1>
<ul class="files">
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000004">FakeFS</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000004">
<a name="M000004"></a><b>FakeFS</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/491da764d1500fbfcbf8f9e2242c07593af57a29/lib/fakefs/base.rb#L38" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000004_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/base.rb, line 38</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">FakeFS</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-operator">::</span><span class="ruby-constant">FakeFS</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-operator">::</span><span class="ruby-constant">FakeFS</span>.<span class="ruby-identifier">activate!</span>
<span class="ruby-keyword kw">yield</span>
<span class="ruby-keyword kw">ensure</span>
<span class="ruby-operator">::</span><span class="ruby-constant">FakeFS</span>.<span class="ruby-identifier">deactivate!</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

1
created.rid Normal file
View File

@ -0,0 +1 @@
Sat, 18 Dec 2010 14:27:59 -0500

278
css/main.css Executable file
View File

@ -0,0 +1,278 @@
body {
font-family: "Helvetica Neue", Arial, sans-serif;
background: #FFF;
color: #000;
margin: 0px;
font-size: 0.82em;
line-height: 1.25em;
}
a {
color: #00F;
text-decoration: none;
}
a:hover {
color: #333;
background: #FE8;
}
p {
margin-bottom: 1em;
}
h1 {
font-size: 2.1em;
font-weight: normal;
line-height: 1.2em;
margin: 1.4em 0 0.7em 0;
}
h2 {
font-size: 1.6em;
margin: 1.8em 0 0.8em 0;
font-weight: normal;
line-height: 1.2em;
}
h3 {
font-size: 1.4em;
color:#555;
margin: 1.4em 0 0.7em 0;
font-weight: normal;
}
h4 {
margin: 1.4em 0 0.5em 0;
font-size: 1em;
}
table
{
margin-bottom: 1em;
}
td, th
{
padding: 0 0.7em 0.3em 0;
}
th
{
font-weight: bold;
}
.clear
{
clear: both;
width: 0; height: 0;
}
dt
{
margin-bottom: 0.3em;
font-weight: bold;
}
dd
{
margin-left: 2em;
margin-bottom: 1em;
}
dd p
{
margin-top: 0.6em;
}
li
{
margin: 0 0 0.5em 2em;
}
ul li
{
list-style: disc;
}
ol li
{
list-style: decimal;
}
.banner
{
background: #EDF3FE;
border-bottom: 1px solid #ccc;
padding: 1em 2em 0.5em 2em;
}
.banner h1
{
font-size: 1.2em;
margin: 0;
}
.banner h1 .type
{
font-size: 0.833em;
display:block;
}
.banner h1 .type,
.banner h1 .parent
{
color: #666;
}
.banner ul
{
margin-top: 0.3em;
margin-bottom: 0;
font-size: 0.85em;
}
.banner li
{
list-style: none;
margin-left: 0;
margin-bottom: 0;
}
pre
{
margin-bottom: 1em;
}
.methods dt
{
width: 1em;
font-size: 1.5em;
color:#AAA;
position: absolute;
font-weight: normal;
margin: 0;
}
.methods dd
{
margin-left: 2.5em;
min-height: 1.8em;
-height: 1.8em;
padding-bottom: 0.8em;
}
.methods ul li
{
margin-right: 0.7em;
margin-left: 0;
list-style: none;
display: inline;
}
#content {
margin: 2em;
margin-left: 3.5em;
margin-right: 3.5em;
}
.sectiontitle {
margin-top: 2em;
margin-bottom: 1.3em;
margin-left: -1.2em;
font-size: 1.2em;
padding: 0 0 0.25em 0;
font-weight: bold;
border-bottom: 1px solid #000;
}
.attr-rw {
padding-right: 1em;
text-align: center;
color: #055;
}
.attr-name {
font-weight: bold;
padding-right: 1em;
}
.attr-desc {
}
tt {
font-size: 1.15em;
}
.attr-value {
font-family: monospace;
padding-left: 1em;
font-size: 1.15em;
}
.dyn-source {
display: none;
background: #fffde8;
color: #000;
border: #ffe0bb dotted 1px;
margin: 0.5em 2em 0.5em 0;
padding: 0.5em;
}
.dyn-source .cmt {
color: #00F;
font-style: italic;
}
.dyn-source .kw {
color: #070;
font-weight: bold;
}
.description pre {
padding: 0.5em;
border: #ffe0bb dotted 1px;
background: #fffde8;
}
.method {
margin-bottom: 2em;
}
.method .description,
.method .sourcecode
{
margin-left: 1.2em;
}
.method h4
{
border-bottom: 1px dotted #999;
padding: 0 0 0.2em 0;
margin-bottom: 0.8em;
font-size: 1.1em;
color:#333;
}
.method .title {
border-bottom: 1px dotted #666;
padding: 0 0 0.15em 0;
margin: 0 0 0.5em 0;
font-size: 1.2em;
line-height: 1.25em;
}
.method .sourcecode p.source-link {
text-indent: 0em;
margin-top: 0.5em;
}
.method .aka {
margin-top: 0.3em;
margin-left: 1em;
font-style: italic;
text-indent: 2em;
}
.method .source-link
{
font-size: 0.85em;
}

383
css/panel.css Executable file
View File

@ -0,0 +1,383 @@
/* Panel (begin) */
.panel
{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #FFF;
z-index: 2;
font-family: "Helvetica Neue", "Arial", sans-serif;
//zoom: 1;
}
.panel_tree .results,
.panel_results .tree
{
display: none;
}
/* Header with search box (begin) */
.panel .header
{
width: 100%;
height: 29px;
border-bottom: 1px solid #666;
position: relative;
left: 0; top: 0;
background: #e8e8e8;
}
.panel .header div
{
margin: 0 7px;
}
.panel .header table
{
height: 29px;
width: 100%;
}
.panel .header table td
{
vertical-align: middle;
text-align: middle;
}
.panel .header label
{
position: absolute;
font-size: 12px;
line-height: 29px;
margin-left: 3px;
color: #999;
cursor: text;
}
.panel .header table input
{
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
display: inline-block;
-webkit-appearance: searchfield;
height: 22px;
//height: auto;
}
/* Header with search box (end) */
/* Results (begin) */
.panel .result
{
position: absolute;
top: 30px;
bottom: 0;
left: 0;
width: 100%;
//height: expression((this.parentNode.offsetHeight - 31));
overflow-y: scroll;
overflow-x: hidden;
-overflow-y: hidden;
background: #EDF3FE url(../i/results_bg.png);
z-index: 2;
//zoom:1;
}
.panel .result ul
{
font-size: 0.8em;
width: 100%;
background: #EDF3FE url(../i/results_bg.png);
//zoom:1;
}
.panel .result ul li
{
height: 46px;
-height: 50px;
//display: inline;
//width: 100%;
//zoom: 1;
overflow: hidden;
padding: 4px 10px 0 10px;
cursor: pointer;
}
.panel .result ul li h1
{
font-size: 13px;
font-weight: normal;
color: #333;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .result ul li p
{
font-size: 11px;
color: #333;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .result ul li h1 i,
.panel .result ul li p.snippet
{
color: #999;
}
.panel .result ul li b
{
color: #000;
}
.panel .result ul li.current
{
background: #3875D7;
}
.panel .result ul li.current h1,
.panel .result ul li.current p
{
color: #DDD;
}
.panel .result ul li.current h1 i,
.panel .result ul li.current p.snippet
{
color: #AAA;
}
.panel .result ul li.current b
{
color: #FFF;
}
.panel .result ul li:hover,
.panel .result ul li.selected
{
background: #d0d0d0;
}
.panel .result ul li.current:hover
{
background: #2965C0;
}
.panel .result ul li .badge
{
margin-right: 0.4em;
margin-left: -0.2em;
padding: 0 0.2em;
color: #000;
}
.panel .result ul li .badge_1
{
background: #ACDBF4;
}
.panel .result ul li.current .badge_1
{
background: #97BFD7;
}
.panel .result ul li .badge_2
{
background: #ACF3C3;
}
.panel .result ul li.current .badge_2
{
background: #98D7AC;
}
.panel .result ul li .badge_3
{
background: #E0F3AC;
}
.panel .result ul li.current .badge_3
{
background: #C4D798;
}
.panel .result ul li .badge_4
{
background: #D7CA98;
}
.panel .result ul li.current .badge_4
{
background: #A6B0AC;
}
.panel .result ul li .badge_5
{
background: #F3C8AC;
}
.panel .result ul li.current .badge_5
{
background: #D7B198;
}
.panel .result ul li .badge_6
{
background: #F3ACC3;
}
.panel .result ul li.current .badge_6
{
background: #D798AB;
}
/* Results (end) */
/* Tree (begin) */ /**/
.panel .tree
{
position: absolute;
top: 30px;
bottom: 0;
left: 0;
width: 100%;
//zoom: 1;
//height: expression((this.parentNode.offsetHeight - 31));
overflow-y: scroll;
overflow-x: hidden;
-overflow-y: hidden;
background: #EDF3FE url(../i/tree_bg.png);
z-index: 30;
}
.panel .tree ul
{
background: #EDF3FE url(../i/tree_bg.png);
}
.panel .tree li
{
cursor: pointer;
overflow: hidden;
//height: 23px;
//display: inline;
//zoom: 1;
//width: 100%;
}
.panel .tree li .content
{
padding-left: 18px;
padding-top: 5px;
height: 18px;
overflow: hidden;
position: relative;
}
.panel .tree li .icon
{
width: 10px;
height: 9px;
background: url(../i/arrows.png);
background-position: 0 -9px;
position: absolute;
left: 1px;
top: 8px;
cursor: default;
}
.panel .tree li.closed .icon
{
background-position: 0 0;
}
.panel .tree ul li h1
{
font-size: 13px;
font-weight: normal;
color: #000;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .tree ul li p
{
font-size: 11px;
color: #666;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .tree ul li h1 i
{
color: #999;
font-style: normal;
}
.panel .tree ul li.empty
{
cursor: text;
}
.panel .tree ul li.empty h1,
.panel .tree ul li.empty p
{
color: #666;
font-style: italic;
}
.panel .tree ul li.current
{
background: #3875D7;
}
.panel .tree ul li.current .icon
{
background-position: -10px -9px;
}
.panel .tree ul li.current.closed .icon
{
background-position: -10px 0;
}
.panel .tree ul li.current h1
{
color: #FFF;
}
.panel .tree ul li.current p
{
color: #CCC;
}
.panel .tree ul li.current.empty h1,
.panel .tree ul li.current.empty p
{
color: #999;
}
.panel .tree ul li:hover
{
background: #d0d0d0;
}
.panel .tree ul li.current:hover
{
background: #2965C0;
}
.panel .tree .stopper
{
display: none;
}
/* Tree (end) */ /**/
/* Panel (end) */

53
css/reset.css Executable file
View File

@ -0,0 +1,53 @@
/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}

View File

@ -1,83 +0,0 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{fakefs}
s.version = "0.4.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Chris Wanstrath", "Scott Taylor", "Jeff Hodges", "Pat Nakajima"]
s.date = %q{2011-09-05}
s.description = %q{A fake filesystem. Use it in your tests.}
s.email = %q{chris@ozmm.org}
s.extra_rdoc_files = [
"LICENSE",
"README.markdown"
]
s.files = [
".autotest",
".rspec",
"CONTRIBUTORS",
"Gemfile",
"LICENSE",
"README.markdown",
"Rakefile",
"fakefs.gemspec",
"lib/fakefs.rb",
"lib/fakefs/base.rb",
"lib/fakefs/dir.rb",
"lib/fakefs/fake/dir.rb",
"lib/fakefs/fake/file.rb",
"lib/fakefs/fake/symlink.rb",
"lib/fakefs/file.rb",
"lib/fakefs/file_system.rb",
"lib/fakefs/file_test.rb",
"lib/fakefs/fileutils.rb",
"lib/fakefs/safe.rb",
"lib/fakefs/spec_helpers.rb",
"lib/fakefs/version.rb",
"spec/fakefs/spec_helpers_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb",
"test/fake/file/join_test.rb",
"test/fake/file/lstat_test.rb",
"test/fake/file/stat_test.rb",
"test/fake/file/sysseek_test.rb",
"test/fake/file/syswrite_test.rb",
"test/fake/file_test.rb",
"test/fake/symlink_test.rb",
"test/fakefs_test.rb",
"test/file/stat_test.rb",
"test/safe_test.rb",
"test/test_helper.rb",
"test/verify.rb"
]
s.homepage = %q{http://github.com/defunkt/fakefs}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{A fake filesystem. Use it in your tests.}
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rspec>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
s.add_development_dependency(%q<sdoc-helpers>, [">= 0"])
s.add_development_dependency(%q<rdiscount>, [">= 0"])
else
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<sdoc-helpers>, [">= 0"])
s.add_dependency(%q<rdiscount>, [">= 0"])
end
else
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<sdoc-helpers>, [">= 0"])
s.add_dependency(%q<rdiscount>, [">= 0"])
end
end

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

121
files/CONTRIBUTORS.html Normal file
View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CONTRIBUTORS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
CONTRIBUTORS
</h1>
<ul class="files">
<li>CONTRIBUTORS</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<ul>
<li>Chris Wanstrath
</li>
<li>Scott Taylor
</li>
<li>Jeff Hodges
</li>
<li>Pat Nakajima
</li>
<li>Myles Eftos
</li>
<li>Matt Freels
</li>
<li>Nick Quaranto
</li>
<li>Tymon Tobolski
</li>
<li>Ben Mabey
</li>
<li>Jon Yurek
</li>
<li>Scott Barron
</li>
<li>dmathieu
</li>
<li>Rob Sanheim
</li>
<li>David Reese
</li>
<li>msassak
</li>
<li>Sam Goldstein
</li>
<li>jameswilding
</li>
<li>Greg Campbell
</li>
<li>Thiago Marano
</li>
<li>Víctor Martínez
</li>
<li>Victor Costan
</li>
</ul>
</div>
</div>
</div>
</body>
</html>

81
files/LICENSE.html Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>LICENSE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
LICENSE
</h1>
<ul class="files">
<li>LICENSE</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p>
Copyright &#169; 2009 Chris Wanstrath
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
&#8220;Software&#8221;), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
</div>
</div>
</div>
</body>
</html>

234
files/README_markdown.html Normal file
View File

@ -0,0 +1,234 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>README.markdown</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
README.markdown
</h1>
<ul class="files">
<li>README.markdown</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p>
<a href="../classes/FakeFS.html">FakeFS</a>
</p>
<h6></h6>
<p>
Mocha is great. But when your library is all about manipulating the
filesystem, you really want to test the behavior and not the
implementation.
</p>
<p>
If you&#8217;re mocking and stubbing every call to FileUtils or File,
you&#8217;re tightly coupling your tests with the implementation.
</p>
<pre>
def test_creates_directory
FileUtils.expects(:mkdir).with(&quot;directory&quot;).once
Library.add &quot;directory&quot;
end
</pre>
<p>
The above test will break if we decide to use `mkdir_p` in our code.
Refactoring code shouldn&#8217;t necessitate refactoring tests.
</p>
<p>
With FakeFS:
</p>
<pre>
def test_creates_directory
Library.add &quot;directory&quot;
assert File.directory?(&quot;directory&quot;)
end
</pre>
<p>
Woot.
</p>
<p>
Usage
</p>
<hr size="3"></hr><pre>
require 'fakefs'
# That's it.
</pre>
<p>
Don&#8217;t Fake the FS Immediately
</p>
<hr size="10"></hr><pre>
require 'fakefs/safe'
FakeFS.activate!
# your code
FakeFS.deactivate!
# or
FakeFS do
# your code
end
</pre>
<p>
RSpec
</p>
<hr size="3"></hr><p>
The above approach works with RSpec as well. In addition you may include <a
href="../classes/FakeFS/SpecHelpers.html">FakeFS::SpecHelpers</a> to turn
<a href="../classes/FakeFS.html">FakeFS</a> on and off in a given example
group:
</p>
<pre>
require 'fakefs/spec_helpers'
describe &quot;my spec&quot; do
include FakeFS::SpecHelpers
end
</pre>
<p>
See `<a
href="lib/fakefs/spec_helpers_rb.html">lib/fakefs/spec_helpers.rb</a>` for
more info.
</p>
<p>
How is this different than MockFS?
</p>
<hr size="10"></hr><p>
<a href="../classes/FakeFS.html">FakeFS</a> provides a test suite and works
with symlinks. It&#8217;s also strictly a test-time dependency: your actual
library does not need to use or know about <a
href="../classes/FakeFS.html">FakeFS</a>.
</p>
<p>
Caveats
</p>
<hr size="5"></hr><p>
<a href="../classes/FakeFS.html">FakeFS</a> internally uses the `Pathname`
and `FileUtils` constants. If you use these in your app, be certain
you&#8217;re properly requiring them and not counting on FakeFS&#8217; own
require.
</p>
<p>
Speed?
</p>
<hr size="4"></hr><p>
<<a href="http://gist.github.com/156091">gist.github.com/156091</a>>
</p>
<p>
Installation
</p>
<hr size="10"></hr><p>
### [Gemcutter](<a href="http://gemcutter.org/">gemcutter.org/</a>)
</p>
<pre>
$ gem install fakefs
</pre>
<p>
### [Rip](<a href="http://hellorip.com">hellorip.com</a>)
</p>
<pre>
$ rip install git://github.com/defunkt/fakefs.git
</pre>
<p>
Contributing
</p>
<hr size="10"></hr><p>
Once you&#8217;ve made your great commits:
</p>
<ol>
<li>[Fork][0] <a href="../classes/FakeFS.html">FakeFS</a>
</li>
<li>Create a topic branch - `git checkout -b my_branch`
</li>
<li>Push to your branch - `git push origin my_branch`
</li>
<li>Create an [Issue][1] with a link to your branch
</li>
<li>That&#8217;s it!
</li>
</ol>
<p>
Meta
</p>
<hr size="2"></hr><ul>
<li>Code: `git clone git://github.com/defunkt/fakefs.git`
</li>
<li>Home: <<a
href="http://github.com/defunkt/fakefs">github.com/defunkt/fakefs</a>>
</li>
<li>Docs: <<a
href="http://defunkt.github.com/fakefs">defunkt.github.com/fakefs</a>>
</li>
<li>Bugs: <<a
href="http://github.com/defunkt/fakefs/issues">github.com/defunkt/fakefs/issues</a>>
</li>
<li>List: <<a
href="http://groups.google.com/group/fakefs">groups.google.com/group/fakefs</a>>
</li>
<li>Test: <<a
href="http://runcoderun.com/defunkt/fakefs">runcoderun.com/defunkt/fakefs</a>>
</li>
<li>Gems: <<a
href="http://gemcutter.org/gems/fakefs">gemcutter.org/gems/fakefs</a>>
</li>
</ul>
<p>
[0]: <a href="http://help.github.com/forking/">help.github.com/forking/</a>
[1]: <a
href="http://github.com/defunkt/fakefs/issues">github.com/defunkt/fakefs/issues</a>
</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>base.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
base.rb
</h1>
<ul class="files">
<li>lib/fakefs/base.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
<li><span class="type">CLASS</span> <a href="../../../classes/Object.html">Object</a></li>
</ul>
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">RealFile</td>
<td>=</td>
<td class="attr-value">File</td>
</tr>
<tr valign='top'>
<td class="attr-name">RealFileTest</td>
<td>=</td>
<td class="attr-value">FileTest</td>
</tr>
<tr valign='top'>
<td class="attr-name">RealFileUtils</td>
<td>=</td>
<td class="attr-value">FileUtils</td>
</tr>
<tr valign='top'>
<td class="attr-name">RealDir</td>
<td>=</td>
<td class="attr-value">Dir</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>dir.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
dir.rb
</h1>
<ul class="files">
<li>lib/fakefs/dir.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>dir.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
dir.rb
</h1>
<ul class="files">
<li>lib/fakefs/fake/dir.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>file.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
file.rb
</h1>
<ul class="files">
<li>lib/fakefs/fake/file.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>symlink.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
symlink.rb
</h1>
<ul class="files">
<li>lib/fakefs/fake/symlink.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>file.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
file.rb
</h1>
<ul class="files">
<li>lib/fakefs/file.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Required Files</div>
<ul>
<li>stringio</li>
</ul>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>file_system.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
file_system.rb
</h1>
<ul class="files">
<li>lib/fakefs/file_system.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>file_test.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
file_test.rb
</h1>
<ul class="files">
<li>lib/fakefs/file_test.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>fileutils.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
fileutils.rb
</h1>
<ul class="files">
<li>lib/fakefs/fileutils.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>safe.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
safe.rb
</h1>
<ul class="files">
<li>lib/fakefs/safe.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Required Files</div>
<ul>
<li>fileutils</li>
<li>pathname</li>
<li>fakefs/base</li>
<li>fakefs/fake/file</li>
<li>fakefs/fake/dir</li>
<li>fakefs/fake/symlink</li>
<li>fakefs/file_system</li>
<li>fakefs/fileutils</li>
<li>fakefs/file</li>
<li>fakefs/file_test</li>
<li>fakefs/dir</li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>spec_helpers.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
spec_helpers.rb
</h1>
<ul class="files">
<li>lib/fakefs/spec_helpers.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p>
<a href="../../../classes/FakeFS/SpecHelpers.html">FakeFS::SpecHelpers</a>
provides a simple macro for RSpec example groups to turn <a
href="../../../classes/FakeFS.html">FakeFS</a> on and off. To use it simply
require &#8216;fakefs/spec_helpers&#8217;, then include <a
href="../../../classes/FakeFS/SpecHelpers.html">FakeFS::SpecHelpers</a>
into any example groups that you wish to use <a
href="../../../classes/FakeFS.html">FakeFS</a> in. For example:
</p>
<pre>
require 'fakefs/spec_helpers'
describe &quot;Some specs that deal with files&quot; do
include FakeFS::SpecHelpers
...
end
</pre>
<p>
Alternatively, you can include <a
href="../../../classes/FakeFS/SpecHelpers.html">FakeFS::SpecHelpers</a> in
all your example groups using RSpec&#8217;s configuration block in your
spec helper:
</p>
<pre>
require 'fakefs/spec_helpers'
Spec::Runner.configure do |config|
config.include FakeFS::SpecHelpers
end
</pre>
<p>
If you do the above then use_fakefs will be available in all of your
example groups.
</p>
</div>
<div class="sectiontitle">Required Files</div>
<ul>
<li>fakefs/safe</li>
</ul>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>version.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
version.rb
</h1>
<ul class="files">
<li>lib/fakefs/version.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/FakeFS.html">FakeFS</a></li>
</ul>
</div>
</div>
</body>
</html>

59
files/lib/fakefs_rb.html Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>fakefs.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
fakefs.rb
</h1>
<ul class="files">
<li>lib/fakefs.rb</li>
<li>Last modified: Sat Dec 18 14:27:23 -0500 2010</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Required Files</div>
<ul>
<li>fakefs/safe</li>
</ul>
</div>
</div>
</body>
</html>

BIN
i/arrows.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

BIN
i/results_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
i/tree_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

14
index.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RDoc Documentation</title>
</head>
<frameset cols="300,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
<frame src="panel/index.html" title="Search" name="panel" />
<frame src="files/README_markdown.html" name="docwin" />
</frameset>
</html>

19
js/jquery-1.3.2.min.js vendored Executable file

File diff suppressed because one or more lines are too long

593
js/jquery-effect.js vendored Normal file
View File

@ -0,0 +1,593 @@
/*
* jQuery UI Effects 1.6rc6
*
* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/
*/
;(function($) {
$.effects = $.effects || {}; //Add the 'effects' scope
$.extend($.effects, {
version: "1.6rc6",
// Saves a set of properties in a data storage
save: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
}
},
// Restores a set of previously saved properties from a data storage
restore: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
}
},
setMode: function(el, mode) {
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
return mode;
},
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
var y, x;
switch (origin[0]) {
case 'top': y = 0; break;
case 'middle': y = 0.5; break;
case 'bottom': y = 1; break;
default: y = origin[0] / original.height;
};
switch (origin[1]) {
case 'left': x = 0; break;
case 'center': x = 0.5; break;
case 'right': x = 1; break;
default: x = origin[1] / original.width;
};
return {x: x, y: y};
},
// Wraps the element around a wrapper that copies position properties
createWrapper: function(element) {
//if the element is already wrapped, return it
if (element.parent().is('.ui-effects-wrapper'))
return element.parent();
//Cache width,height and float properties of the element, and create a wrapper around it
var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
var wrapper = element.parent();
//Transfer the positioning of the element to the wrapper
if (element.css('position') == 'static') {
wrapper.css({ position: 'relative' });
element.css({ position: 'relative'} );
} else {
var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
element.css({position: 'relative', top: 0, left: 0 });
}
wrapper.css(props);
return wrapper;
},
removeWrapper: function(element) {
if (element.parent().is('.ui-effects-wrapper'))
return element.parent().replaceWith(element);
return element;
},
setTransition: function(element, list, factor, value) {
value = value || {};
$.each(list, function(i, x){
unit = element.cssUnit(x);
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
});
return value;
},
//Base function to animate from one class to another in a seamless transition
animateClass: function(value, duration, easing, callback) {
var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
var ea = (typeof easing == "string" ? easing : null);
return this.each(function() {
var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
//Let's get a style offset
var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
// The main function to form the object for animation
for(var n in newStyle) {
if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
) offset[n] = newStyle[n];
}
that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
// Change style attribute back to original. For stupid IE, we need to clear the damn object.
if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
if(cb) cb.apply(this, arguments);
});
});
}
});
function _normalizeArguments(a, m) {
var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
var speed = a[1] && a[1].constructor != Object ? a[1] : o.duration; //either comes from options.duration or the second argument
speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
var callback = o.callback || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
return [a[0], o, speed, callback];
}
//Extend the methods of jQuery
$.fn.extend({
//Save old methods
_show: $.fn.show,
_hide: $.fn.hide,
__toggle: $.fn.toggle,
_addClass: $.fn.addClass,
_removeClass: $.fn.removeClass,
_toggleClass: $.fn.toggleClass,
// New effect methods
effect: function(fx, options, speed, callback) {
return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
},
show: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
return this._show.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
}
},
hide: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
return this._hide.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
}
},
toggle: function(){
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function))
return this.__toggle.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
}
},
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
},
removeClass: function(classNames,speed,easing,callback) {
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
},
toggleClass: function(classNames,speed,easing,callback) {
return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
},
morph: function(remove,add,speed,easing,callback) {
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
},
switchClass: function() {
return this.morph.apply(this, arguments);
},
// helper functions
cssUnit: function(key) {
var style = this.css(key), val = [];
$.each( ['em','px','%','pt'], function(i, unit){
if(style.indexOf(unit) > 0)
val = [parseFloat(style), unit];
});
return val;
}
});
/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/
// We override the animation for all of these color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
$.fx.step[attr] = function(fx) {
if ( fx.state == 0 ) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
}
fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
].join(",") + ")";
};
});
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length == 3 )
return color;
// Look for rgb(num,num,num)
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
// Look for rgb(num%,num%,num%)
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
// Look for #a0b1c2
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
// Look for #fff
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
return colors['transparent'];
// Otherwise, we're most likely dealing with a named color
return colors[$.trim(color).toLowerCase()];
}
function getColor(elem, attr) {
var color;
do {
color = $.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0],
transparent: [255,255,255]
};
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
$.easing.jswing = $.easing.swing;
$.extend($.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert($.easing.default);
return $.easing[$.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
})(jQuery);
/*
* jQuery UI Effects Highlight 1.6rc6
*
* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Highlight
*
* Depends:
* effects.core.js
*/
(function($) {
$.effects.highlight = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
// Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var color = o.options.color || "#ffff99"; // Default highlight color
var oldColor = el.css("backgroundColor");
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
// Animation
var animation = {backgroundColor: oldColor };
if (mode == "hide") animation['opacity'] = 0;
// Animate
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == "hide") el.hide();
$.effects.restore(el, props);
if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
if(o.callback) o.callback.apply(this, arguments);
el.dequeue();
}});
});
};
})(jQuery);

22
js/main.js Executable file
View File

@ -0,0 +1,22 @@
function toggleSource( id )
{
var $src = $('#' + id).toggle();
$('#l_' + id).html($src.css('display') == 'none' ? 'show' : 'hide');
}
function openCode( url )
{
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
}
window.highlight = function(url) {
var hash = url.match(/#([^#]+)$/)
if(hash) {
$('a[name=' + hash[1] + ']').parent().effect('highlight', {}, 'slow')
}
}
$(function() {
highlight('#' + location.hash);
});

628
js/searchdoc.js Executable file
View File

@ -0,0 +1,628 @@
Searchdoc = {};
// navigation.js ------------------------------------------
Searchdoc.Navigation = new function() {
this.initNavigation = function() {
var _this = this;
$(document).keydown(function(e) {
_this.onkeydown(e);
}).keyup(function(e) {
_this.onkeyup(e);
});
this.navigationActive = true;
}
this.setNavigationActive = function(state) {
this.navigationActive = state;
this.clearMoveTimeout();
}
this.onkeyup = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
case 38: //Event.KEY_UP:
case 39: //Event.KEY_RIGHT:
case 40: //Event.KEY_DOWN:
case 73: // i - qwerty
case 74: // j
case 75: // k
case 76: // l
case 67: // c - dvorak
case 72: // h
case 84: // t
case 78: // n
this.clearMoveTimeout();
break;
}
}
this.onkeydown = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
case 74: // j (qwerty)
case 72: // h (dvorak)
if (this.moveLeft()) e.preventDefault();
break;
case 38: //Event.KEY_UP:
case 73: // i (qwerty)
case 67: // c (dvorak)
if (e.keyCode == 38 || e.ctrlKey) {
if (this.moveUp()) e.preventDefault();
this.startMoveTimeout(false);
}
break;
case 39: //Event.KEY_RIGHT:
case 76: // l (qwerty)
case 78: // n (dvorak)
if (this.moveRight()) e.preventDefault();
break;
case 40: //Event.KEY_DOWN:
case 75: // k (qwerty)
case 84: // t (dvorak)
if (e.keyCode == 40 || e.ctrlKey) {
if (this.moveDown()) e.preventDefault();
this.startMoveTimeout(true);
}
break;
case 9: //Event.KEY_TAB:
case 13: //Event.KEY_RETURN:
if (this.$current) this.select(this.$current);
break;
}
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
}
this.clearMoveTimeout = function() {
clearTimeout(this.moveTimeout);
this.moveTimeout = null;
}
this.startMoveTimeout = function(isDown) {
if (!$.browser.mozilla && !$.browser.opera) return;
if (this.moveTimeout) this.clearMoveTimeout();
var _this = this;
var go = function() {
if (!_this.moveTimeout) return;
_this[isDown ? 'moveDown' : 'moveUp']();
_this.moveTimout = setTimeout(go, 100);
}
this.moveTimeout = setTimeout(go, 200);
}
this.moveRight = function() {
}
this.moveLeft = function() {
}
this.move = function(isDown) {
}
this.moveUp = function() {
return this.move(false);
}
this.moveDown = function() {
return this.move(true);
}
}
// scrollIntoView.js --------------------------------------
function scrollIntoView(element, view) {
var offset, viewHeight, viewScroll, height;
offset = element.offsetTop;
height = element.offsetHeight;
viewHeight = view.offsetHeight;
viewScroll = view.scrollTop;
if (offset - viewScroll + height > viewHeight) {
view.scrollTop = offset - viewHeight + height;
}
if (offset < viewScroll) {
view.scrollTop = offset;
}
}
// searcher.js --------------------------------------------
Searchdoc.Searcher = function(data) {
this.data = data;
this.handlers = [];
}
Searchdoc.Searcher.prototype = new function() {
var CHUNK_SIZE = 1000, // search is performed in chunks of 1000 for non-bloking user input
MAX_RESULTS = 100, // do not try to find more than 100 results
huid = 1, suid = 1,
runs = 0;
this.find = function(query) {
var queries = splitQuery(query),
regexps = buildRegexps(queries),
highlighters = buildHilighters(queries),
state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++},
_this = this;
this.currentSuid = state.n;
if (!query) return;
var run = function() {
// stop current search thread if new search started
if (state.n != _this.currentSuid) return;
var results = performSearch(_this.data, regexps, queries, highlighters, state),
hasMore = (state.limit > 0 && state.pass < 3);
triggerResults.call(_this, results, !hasMore);
if (hasMore) {
setTimeout(run, 2);
}
runs++;
};
runs = 0;
// start search thread
run();
}
/* ----- Events ------ */
this.ready = function(fn) {
fn.huid = huid;
this.handlers.push(fn);
}
/* ----- Utilities ------ */
function splitQuery(query) {
return jQuery.grep(query.split(/(\s+|\(\)?)/), function(string) { return string.match(/\S/) });
}
function buildRegexps(queries) {
return jQuery.map(queries, function(query) { return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i') });
}
function buildHilighters(queries) {
return jQuery.map(queries, function(query) {
return jQuery.map( query.split(''), function(l, i){ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2) } ).join('')
});
}
// function longMatchRegexp(index, longIndex, regexps) {
// for (var i = regexps.length - 1; i >= 0; i--){
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
// };
// return true;
// }
/* ----- Mathchers ------ */
function matchPass1(index, longIndex, queries, regexps) {
if (index.indexOf(queries[0]) != 0) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
function matchPass2(index, longIndex, queries, regexps) {
if (index.indexOf(queries[0]) == -1) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
function matchPassRegexp(index, longIndex, queries, regexps) {
if (!index.match(regexps[0])) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
/* ----- Highlighters ------ */
function highlightRegexp(info, queries, regexps, highlighters) {
var result = createResult(info);
for (var i=0, l = regexps.length; i < l; i++) {
result.title = result.title.replace(regexps[i], highlighters[i]);
if (i > 0)
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
};
return result;
}
function hltSubstring(string, pos, length) {
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
}
function highlightQuery(info, queries, regexps, highlighters) {
var result = createResult(info), pos = 0, lcTitle = result.title.toLowerCase();
pos = lcTitle.indexOf(queries[0]);
if (pos != -1) {
result.title = hltSubstring(result.title, pos, queries[0].length);
}
for (var i=1, l = regexps.length; i < l; i++) {
result.title = result.title.replace(regexps[i], highlighters[i]);
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
};
return result;
}
function createResult(info) {
var result = {};
result.title = info[0];
result.namespace = info[1];
result.path = info[2];
result.params = info[3];
result.snippet = info[4];
result.badge = info[6];
return result;
}
/* ----- Searching ------ */
function performSearch(data, regexps, queries, highlighters, state) {
var searchIndex = data.searchIndex, // search by title first and then by source
longSearchIndex = data.longSearchIndex,
info = data.info,
result = [],
i = state.from,
l = searchIndex.length,
togo = CHUNK_SIZE,
matchFunc, hltFunc;
while (state.pass < 3 && state.limit > 0 && togo > 0) {
if (state.pass == 0) {
matchFunc = matchPass1;
hltFunc = highlightQuery;
} else if (state.pass == 1) {
matchFunc = matchPass2;
hltFunc = highlightQuery;
} else if (state.pass == 2) {
matchFunc = matchPassRegexp;
hltFunc = highlightRegexp;
}
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
if (info[i].n == state.n) continue;
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
info[i].n = state.n;
result.push(hltFunc(info[i], queries, regexps, highlighters));
state.limit--;
}
};
if (searchIndex.length <= i) {
state.pass++;
i = state.from = 0;
} else {
state.from = i;
}
}
return result;
}
function triggerResults(results, isLast) {
jQuery.each(this.handlers, function(i, fn) { fn.call(this, results, isLast) })
}
}
// panel.js -----------------------------------------------
Searchdoc.Panel = function(element, data, tree, frame) {
this.$element = $(element);
this.$input = $('input', element).eq(0);
this.$result = $('.result ul', element).eq(0);
this.frame = frame;
this.$current = null;
this.$view = this.$result.parent();
this.data = data;
this.searcher = new Searchdoc.Searcher(data.index);
this.tree = new Searchdoc.Tree($('.tree', element), tree, this);
this.init();
}
Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
var suid = 1;
this.init = function() {
var _this = this;
var observer = function() {
_this.search(_this.$input[0].value);
};
this.$input.keyup(observer);
this.$input.click(observer); // mac's clear field
this.searcher.ready(function(results, isLast) {
_this.addResults(results, isLast);
})
this.$result.click(function(e) {
_this.$current.removeClass('current');
_this.$current = $(e.target).closest('li').addClass('current');
_this.select();
_this.$input.focus();
});
this.initNavigation();
this.setNavigationActive(false);
}
this.search = function(value, selectFirstMatch) {
value = jQuery.trim(value).toLowerCase();
this.selectFirstMatch = selectFirstMatch;
if (value) {
this.$element.removeClass('panel_tree').addClass('panel_results');
this.tree.setNavigationActive(false);
this.setNavigationActive(true);
} else {
this.$element.addClass('panel_tree').removeClass('panel_results');
this.tree.setNavigationActive(true);
this.setNavigationActive(false);
}
if (value != this.lastQuery) {
this.lastQuery = value;
this.firstRun = true;
this.searcher.find(value);
}
}
this.addResults = function(results, isLast) {
var target = this.$result.get(0);
if (this.firstRun && (results.length > 0 || isLast)) {
this.$current = null;
this.$result.empty();
}
for (var i=0, l = results.length; i < l; i++) {
target.appendChild(renderItem.call(this, results[i]));
};
if (this.firstRun && results.length > 0) {
this.firstRun = false;
this.$current = $(target.firstChild);
this.$current.addClass('current');
if (this.selectFirstMatch) this.select();
scrollIntoView(this.$current[0], this.$view[0])
}
if (jQuery.browser.msie) this.$element[0].className += '';
}
this.open = function(src) {
this.frame.location.href = '../' + src;
if (this.frame.highlight) this.frame.highlight(src);
}
this.select = function() {
this.open(this.$current.data('path'));
}
this.move = function(isDown) {
if (!this.$current) return;
var $next = this.$current[isDown ? 'next' : 'prev']();
if ($next.length) {
this.$current.removeClass('current');
$next.addClass('current');
scrollIntoView($next[0], this.$view[0]);
this.$current = $next;
}
return true;
}
function renderItem(result) {
var li = document.createElement('li'),
html = '', badge = result.badge;
html += '<h1>' + hlt(result.title);
if (result.params) html += '<i>' + result.params + '</i>';
html += '</h1>';
html += '<p>';
if (typeof badge != 'undefined') {
html += '<span class="badge badge_' + (badge % 6 + 1) + '">' + escapeHTML(this.data.badges[badge] || 'unknown') + '</span>';
}
html += hlt(result.namespace) + '</p>';
if (result.snippet) html += '<p class="snippet">' + escapeHTML(result.snippet) + '</p>';
li.innerHTML = html;
jQuery.data(li, 'path', result.path);
return li;
}
function hlt(html) {
return escapeHTML(html).replace(/\u0001/g, '<b>').replace(/\u0002/g, '</b>')
}
function escapeHTML(html) {
return html.replace(/[&<>]/g, function(c) {
return '&#' + c.charCodeAt(0) + ';';
});
}
});
// tree.js ------------------------------------------------
Searchdoc.Tree = function(element, tree, panel) {
this.$element = $(element);
this.$list = $('ul', element);
this.tree = tree;
this.panel = panel;
this.init();
}
Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
this.init = function() {
var stopper = document.createElement('li');
stopper.className = 'stopper';
this.$list[0].appendChild(stopper);
for (var i=0, l = this.tree.length; i < l; i++) {
buildAndAppendItem.call(this, this.tree[i], 0, stopper);
};
var _this = this;
this.$list.click(function(e) {
var $target = $(e.target),
$li = $target.closest('li');
if ($target.hasClass('icon')) {
_this.toggle($li);
} else {
_this.select($li);
}
})
this.initNavigation();
if (jQuery.browser.msie) document.body.className += '';
}
this.select = function($li) {
this.highlight($li);
var path = $li[0].searchdoc_tree_data.path;
if (path) this.panel.open(path);
}
this.highlight = function($li) {
if (this.$current) this.$current.removeClass('current');
this.$current = $li.addClass('current');
}
this.toggle = function($li) {
var closed = !$li.hasClass('closed'),
children = $li[0].searchdoc_tree_data.children;
$li.toggleClass('closed');
for (var i=0, l = children.length; i < l; i++) {
toggleVis.call(this, $(children[i].li), !closed);
};
}
this.moveRight = function() {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return;
}
if (this.$current.hasClass('closed')) {
this.toggle(this.$current);
}
}
this.moveLeft = function() {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return;
}
if (!this.$current.hasClass('closed')) {
this.toggle(this.$current);
} else {
var level = this.$current[0].searchdoc_tree_data.level;
if (level == 0) return;
var $next = this.$current.prevAll('li.level_' + (level - 1) + ':visible:first');
this.$current.removeClass('current');
$next.addClass('current');
scrollIntoView($next[0], this.$element[0]);
this.$current = $next;
}
}
this.move = function(isDown) {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return true;
}
var next = this.$current[0];
if (isDown) {
do {
next = next.nextSibling;
if (next && next.style && next.style.display != 'none') break;
} while(next);
} else {
do {
next = next.previousSibling;
if (next && next.style && next.style.display != 'none') break;
} while(next);
}
if (next && next.className.indexOf('stopper') == -1) {
this.$current.removeClass('current');
$(next).addClass('current');
scrollIntoView(next, this.$element[0]);
this.$current = $(next);
}
return true;
}
function toggleVis($li, show) {
var closed = $li.hasClass('closed'),
children = $li[0].searchdoc_tree_data.children;
$li.css('display', show ? '' : 'none')
if (!show && this.$current && $li[0] == this.$current[0]) {
this.$current.removeClass('current');
this.$current = null;
}
for (var i=0, l = children.length; i < l; i++) {
toggleVis.call(this, $(children[i].li), show && !closed);
};
}
function buildAndAppendItem(item, level, before) {
var li = renderItem(item, level),
list = this.$list[0];
item.li = li;
list.insertBefore(li, before);
for (var i=0, l = item[3].length; i < l; i++) {
buildAndAppendItem.call(this, item[3][i], level + 1, before);
};
return li;
}
function renderItem(item, level) {
var li = document.createElement('li'),
cnt = document.createElement('div'),
h1 = document.createElement('h1'),
p = document.createElement('p'),
icon, i;
li.appendChild(cnt);
li.style.paddingLeft = getOffset(level);
cnt.className = 'content';
if (!item[1]) li.className = 'empty ';
cnt.appendChild(h1);
// cnt.appendChild(p);
h1.appendChild(document.createTextNode(item[0]));
// p.appendChild(document.createTextNode(item[4]));
if (item[2]) {
i = document.createElement('i');
i.appendChild(document.createTextNode(item[2]));
h1.appendChild(i);
}
if (item[3].length > 0) {
icon = document.createElement('div');
icon.className = 'icon';
cnt.appendChild(icon);
}
// user direct assignement instead of $()
// it's 8x faster
// $(li).data('path', item[1])
// .data('children', item[3])
// .data('level', level)
// .css('display', level == 0 ? '' : 'none')
// .addClass('level_' + level)
// .addClass('closed');
li.searchdoc_tree_data = {
path: item[1],
children: item[3],
level: level
}
li.style.display = level == 0 ? '' : 'none';
li.className += 'level_' + level + ' closed';
return li;
}
function getOffset(level) {
return 5 + 18*level + 'px';
}
});

View File

@ -1,3 +0,0 @@
require 'fakefs/safe'
FakeFS.activate!

View File

@ -1,45 +0,0 @@
RealFile = File
RealFileTest = FileTest
RealFileUtils = FileUtils
RealDir = Dir
module FakeFS
def self.activate!
Object.class_eval do
remove_const(:Dir)
remove_const(:File)
remove_const(:FileTest)
remove_const(:FileUtils)
const_set(:Dir, FakeFS::Dir)
const_set(:File, FakeFS::File)
const_set(:FileUtils, FakeFS::FileUtils)
const_set(:FileTest, FakeFS::FileTest)
end
true
end
def self.deactivate!
Object.class_eval do
remove_const(:Dir)
remove_const(:File)
remove_const(:FileTest)
remove_const(:FileUtils)
const_set(:Dir, RealDir)
const_set(:File, RealFile)
const_set(:FileTest, RealFileTest)
const_set(:FileUtils, RealFileUtils)
end
true
end
end
def FakeFS
return ::FakeFS unless block_given?
::FakeFS.activate!
yield
ensure
::FakeFS.deactivate!
end

View File

@ -1,184 +0,0 @@
module FakeFS
class Dir
include Enumerable
def self._check_for_valid_file(path)
raise Errno::ENOENT, "No such file or directory - #{path}" unless FileSystem.find(path)
end
def initialize(string)
self.class._check_for_valid_file(string)
@path = string
@open = true
@pointer = 0
@contents = [ '.', '..', ] + FileSystem.find(@path).values
end
def close
@open = false
@pointer = nil
@contents = nil
nil
end
def each(&block)
while f = read
yield f
end
end
def path
@path
end
def pos
@pointer
end
def pos=(integer)
@pointer = integer
end
def read
raise IOError, "closed directory" if @pointer == nil
n = @contents[@pointer]
@pointer += 1
n.to_s.gsub(path + '/', '') if n
end
def rewind
@pointer = 0
end
def seek(integer)
raise IOError, "closed directory" if @pointer == nil
@pointer = integer
@contents[integer]
end
def self.[](*pattern)
glob pattern
end
def self.exists?(path)
File.exists?(path) && File.directory?(path)
end
def self.chdir(dir, &blk)
FileSystem.chdir(dir, &blk)
end
def self.chroot(string)
raise NotImplementedError
end
def self.delete(string)
_check_for_valid_file(string)
raise Errno::ENOTEMPTY, "Directory not empty - #{string}" unless FileSystem.find(string).values.empty?
FileSystem.delete(string)
end
def self.entries(dirname)
_check_for_valid_file(dirname)
Dir.new(dirname).map { |file| File.basename(file) }
end
def self.foreach(dirname, &block)
Dir.open(dirname) { |file| yield file }
end
def self.glob(pattern, &block)
matches_for_pattern = lambda { |matcher| [FileSystem.find(matcher) || []].flatten.map{|e| e.to_s}.sort }
if pattern.is_a? Array
files = pattern.collect { |matcher| matches_for_pattern.call matcher }.flatten
else
files = matches_for_pattern.call pattern
end
return block_given? ? files.each { |file| block.call(file) } : files
end
def self.mkdir(string, integer = 0)
parent = string.split('/')
parent.pop
joined_parent_path = parent.join
_check_for_valid_file(joined_parent_path) unless joined_parent_path == ""
raise Errno::EEXIST, "File exists - #{string}" if File.exists?(string)
FileUtils.mkdir_p(string)
end
def self.open(string, &block)
if block_given?
Dir.new(string).each { |file| yield(file) }
else
Dir.new(string)
end
end
def self.tmpdir
'/tmp'
end
def self.pwd
FileSystem.current_dir.to_s
end
# This code has been borrowed from Rubinius
def self.mktmpdir(prefix_suffix = nil, tmpdir = nil)
case prefix_suffix
when nil
prefix = "d"
suffix = ""
when String
prefix = prefix_suffix
suffix = ""
when Array
prefix = prefix_suffix[0]
suffix = prefix_suffix[1]
else
raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
end
t = Time.now.strftime("%Y%m%d")
n = nil
begin
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
path << "-#{n}" if n
path << suffix
mkdir(path, 0700)
rescue Errno::EEXIST
n ||= 0
n += 1
retry
end
if block_given?
begin
yield path
ensure
require 'fileutils'
# This here was using FileUtils.remove_entry_secure instead of just
# .rm_r. However, the security concerns that apply to
# .rm_r/.remove_entry_secure shouldn't apply to a test fake
# filesystem. :^)
FileUtils.rm_r path
end
else
path
end
end
class << self
alias_method :getwd, :pwd
alias_method :rmdir, :delete
alias_method :unlink, :delete
end
end
end

View File

@ -1,49 +0,0 @@
module FakeFS
class FakeDir < Hash
attr_accessor :name, :parent
attr_reader :ctime, :mtime, :atime
def initialize(name = nil, parent = nil)
@name = name
@parent = parent
@ctime = Time.now
@mtime = @ctime
@atime = @ctime
end
def entry
self
end
def inspect
"(FakeDir name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{size})"
end
def clone(parent = nil)
clone = Marshal.load(Marshal.dump(self))
clone.each do |key, value|
value.parent = clone
end
clone.parent = parent if parent
clone
end
def to_s
if parent && parent.to_s != '.'
File.join(parent.to_s, name)
elsif parent && parent.to_s == '.'
"#{File::PATH_SEPARATOR}#{name}"
else
name
end
end
def delete(node = self)
if node == self
parent.delete(self)
else
super(node.name)
end
end
end
end

View File

@ -1,82 +0,0 @@
module FakeFS
class FakeFile
attr_accessor :name, :parent, :content, :mtime, :atime
attr_reader :ctime
class Inode
def initialize(file_owner)
@content = ""
@links = [file_owner]
end
attr_accessor :content
attr_accessor :links
def link(file)
links << file unless links.include?(file)
file.inode = self
end
def unlink(file)
links.delete(file)
end
def clone
clone = super
clone.content = content.dup
clone
end
end
def initialize(name = nil, parent = nil)
@name = name
@parent = parent
@inode = Inode.new(self)
@ctime = Time.now
@mtime = @ctime
@atime = @ctime
end
attr_accessor :inode
def content
@inode.content
end
def content=(str)
@inode.content = str
end
def links
@inode.links
end
def link(other_file)
@inode.link(other_file)
end
def clone(parent = nil)
clone = super()
clone.parent = parent if parent
clone.inode = inode.clone
clone
end
def entry
self
end
def inspect
"(FakeFile name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{content.size})"
end
def to_s
File.join(parent.to_s, name)
end
def delete
inode.unlink(self)
parent.delete(self)
end
end
end

View File

@ -1,35 +0,0 @@
module FakeFS
class FakeSymlink
attr_accessor :name, :target, :parent
def initialize(target)
@target = target
end
def inspect
"symlink(#{target.split('/').last})"
end
def entry
FileSystem.find(target)
end
def delete
parent.delete(self)
end
def to_s
File.join(parent.to_s, name)
end
def respond_to?(method)
entry.respond_to?(method)
end
private
def method_missing(*args, &block)
entry.send(*args, &block)
end
end
end

View File

@ -1,437 +0,0 @@
require 'stringio'
module FakeFS
class File < StringIO
PATH_SEPARATOR = '/'
MODES = [
READ_ONLY = "r",
READ_WRITE = "r+",
WRITE_ONLY = "w",
READ_WRITE_TRUNCATE = "w+",
APPEND_WRITE_ONLY = "a",
APPEND_READ_WRITE = "a+"
]
FILE_CREATION_MODES = MODES - [READ_ONLY, READ_WRITE]
MODE_BITMASK = RealFile::RDONLY |
RealFile::WRONLY |
RealFile::RDWR |
RealFile::APPEND |
RealFile::CREAT |
RealFile::EXCL |
RealFile::NONBLOCK |
RealFile::TRUNC |
RealFile::NOCTTY |
RealFile::SYNC
FILE_CREATION_BITMASK = RealFile::CREAT
def self.extname(path)
RealFile.extname(path)
end
def self.join(*parts)
RealFile.join(parts)
end
def self.exist?(path)
if(File.symlink?(path)) then
referent = File.expand_path(File.readlink(path), File.dirname(path))
exist?(referent)
else
!!FileSystem.find(path)
end
end
class << self
alias_method :exists?, :exist?
# Assuming that everyone can read and write files
alias_method :readable?, :exist?
alias_method :writable?, :exist?
end
def self.mtime(path)
if exists?(path)
FileSystem.find(path).mtime
else
raise Errno::ENOENT
end
end
def self.ctime(path)
if exists?(path)
FileSystem.find(path).ctime
else
raise Errno::ENOENT
end
end
def self.atime(path)
if exists?(path)
FileSystem.find(path).atime
else
raise Errno::ENOENT
end
end
def self.utime(atime, mtime, *paths)
paths.each do |path|
if exists?(path)
FileSystem.find(path).atime = atime
FileSystem.find(path).mtime = mtime
else
raise Errno::ENOENT
end
end
paths.size
end
def self.size(path)
read(path).length
end
def self.size?(path)
if exists?(path) && !size(path).zero?
true
else
nil
end
end
def self.const_missing(name)
RealFile.const_get(name)
end
def self.directory?(path)
if path.respond_to? :entry
path.entry.is_a? FakeDir
else
result = FileSystem.find(path)
result ? result.entry.is_a?(FakeDir) : false
end
end
def self.symlink?(path)
if path.respond_to? :entry
path.is_a? FakeSymlink
else
FileSystem.find(path).is_a? FakeSymlink
end
end
def self.file?(path)
if path.respond_to? :entry
path.entry.is_a? FakeFile
else
result = FileSystem.find(path)
result ? result.entry.is_a?(FakeFile) : false
end
end
def self.expand_path(*args)
RealFile.expand_path(*args)
end
def self.basename(*args)
RealFile.basename(*args)
end
def self.dirname(path)
RealFile.dirname(path)
end
def self.readlink(path)
symlink = FileSystem.find(path)
symlink.target
end
def self.read(path)
file = new(path)
if file.exists?
FileSystem.find(path).atime = Time.now
file.read
else
raise Errno::ENOENT
end
end
def self.readlines(path)
read(path).split("\n")
end
def self.rename(source, dest)
if directory?(source) && file?(dest)
raise Errno::ENOTDIR, "Not a directory - #{source} or #{dest}"
elsif file?(source) && directory?(dest)
raise Errno::EISDIR, "Is a directory - #{source} or #{dest}"
end
if target = FileSystem.find(source)
FileSystem.add(dest, target.entry.clone)
FileSystem.delete(source)
else
raise Errno::ENOENT, "No such file or directory - #{source} or #{dest}"
end
0
end
def self.link(source, dest)
if directory?(source)
raise Errno::EPERM, "Operation not permitted - #{source} or #{dest}"
end
if !exists?(source)
raise Errno::ENOENT, "No such file or directory - #{source} or #{dest}"
end
if exists?(dest)
raise Errno::EEXIST, "File exists - #{source} or #{dest}"
end
source = FileSystem.find(source)
dest = FileSystem.add(dest, source.entry.clone)
source.link(dest)
0
end
def self.delete(file_name, *additional_file_names)
if !exists?(file_name)
raise Errno::ENOENT, "No such file or directory - #{file_name}"
end
FileUtils.rm(file_name)
additional_file_names.each do |file_name|
FileUtils.rm(file_name)
end
additional_file_names.size + 1
end
class << self
alias_method :unlink, :delete
end
def self.symlink(source, dest)
FileUtils.ln_s(source, dest)
end
def self.stat(file)
File::Stat.new(file)
end
def self.lstat(file)
File::Stat.new(file, true)
end
def self.split(path)
return RealFile.split(path)
end
class Stat
attr_reader :ctime, :mtime, :atime
def initialize(file, __lstat = false)
if !File.exists?(file)
raise(Errno::ENOENT, "No such file or directory - #{file}")
end
@file = file
@fake_file = FileSystem.find(@file)
@__lstat = __lstat
@ctime = @fake_file.ctime
@mtime = @fake_file.mtime
@atime = @fake_file.atime
end
def symlink?
File.symlink?(@file)
end
def directory?
File.directory?(@file)
end
def nlink
@fake_file.links.size
end
def size
if @__lstat && symlink?
@fake_file.target.size
else
File.size(@file)
end
end
end
attr_reader :path
def initialize(path, mode = READ_ONLY, perm = nil)
@path = path
@mode = mode
@file = FileSystem.find(path)
@autoclose = true
check_modes!
file_creation_mode? ? create_missing_file : check_file_existence!
super(@file.content, mode)
end
def exists?
true
end
alias_method :tell=, :pos=
alias_method :sysread, :read
alias_method :syswrite, :write
undef_method :closed_read?
undef_method :closed_write?
undef_method :length
undef_method :size
undef_method :string
undef_method :string=
def ioctl(integer_cmd, arg)
raise NotImplementedError
end
def read_nonblock(maxlen, outbuf = nil)
raise NotImplementedError
end
def stat
self.class.stat(@path)
end
def lstat
self.class.lstat(@path)
end
def sysseek(position, whence = SEEK_SET)
seek(position, whence)
pos
end
alias_method :to_i, :fileno
def to_io
self
end
def write_nonblock(string)
raise NotImplementedError
end
def readpartial(maxlen, outbuf = nil)
raise NotImplementedError
end
def atime
self.class.atime(@path)
end
def chmod(mode_int)
raise NotImplementedError
end
def chown(owner_int, group_int)
raise NotImplementedError
end
def ctime
self.class.ctime(@path)
end
def flock(locking_constant)
#raise NotImplementedError
end
def mtime
self.class.mtime(@path)
end
if RUBY_VERSION >= "1.9"
def binmode?
raise NotImplementedError
end
def close_on_exec=(bool)
raise NotImplementedError
end
def close_on_exec?
raise NotImplementedError
end
def to_path
@path
end
end
if RUBY_VERSION >= "1.9.2"
attr_writer :autoclose
def autoclose?
@autoclose
end
alias_method :fdatasync, :flush
def size
File.size(@path)
end
end
private
def check_modes!
StringIO.new("", @mode)
end
def check_file_existence!
raise Errno::ENOENT, @path unless @file
end
def file_creation_mode?
mode_in?(FILE_CREATION_MODES) || mode_in_bitmask?(FILE_CREATION_BITMASK)
end
def mode_in?(list)
list.any? { |element| @mode.include?(element) } if @mode.respond_to?(:include?)
end
def mode_in_bitmask?(mask)
(@mode & mask) != 0 if @mode.is_a?(Integer)
end
# Create a missing file if the path is valid.
#
def create_missing_file
raise Errno::EISDIR, "Is a directory - #{path}" if File.directory?(@path)
if !File.exists?(@path) # Unnecessary check, probably.
dirname = RealFile.dirname @path
unless dirname == "."
dir = FileSystem.find dirname
unless dir.kind_of? FakeDir
raise Errno::ENOENT, "No such file or directory - #{path}"
end
end
@file = FileSystem.add(path, FakeFile.new)
end
end
end
end

View File

@ -1,141 +0,0 @@
module FakeFS
module FileSystem
extend self
def dir_levels
@dir_levels ||= []
end
def fs
@fs ||= FakeDir.new('/')
end
def clear
@dir_levels = nil
@fs = nil
end
def files
fs.values
end
def find(path)
parts = path_parts(normalize_path(path))
return fs if parts.empty? # '/'
entries = find_recurser(fs, parts).flatten
case entries.length
when 0 then nil
when 1 then entries.first
else entries
end
end
def add(path, object=FakeDir.new)
parts = path_parts(normalize_path(path))
d = parts[0...-1].inject(fs) do |dir, part|
dir[part] ||= FakeDir.new(part, dir)
end
object.name = parts.last
object.parent = d
d[parts.last] ||= object
end
# copies directories and files from the real filesystem
# into our fake one
def clone(path)
path = File.expand_path(path)
pattern = File.join(path, '**', '*')
files = RealFile.file?(path) ? [path] : [path] + RealDir.glob(pattern, RealFile::FNM_DOTMATCH)
files.each do |f|
if RealFile.file?(f)
FileUtils.mkdir_p(File.dirname(f))
File.open(f, File::WRITE_ONLY) do |g|
g.print RealFile.open(f){|h| h.read }
end
elsif RealFile.directory?(f)
FileUtils.mkdir_p(f)
elsif RealFile.symlink?(f)
FileUtils.ln_s()
end
end
end
def delete(path)
if node = FileSystem.find(path)
node.delete
true
end
end
def chdir(dir, &blk)
new_dir = find(dir)
dir_levels.push dir if blk
raise Errno::ENOENT, dir unless new_dir
dir_levels.push dir if !blk
blk.call if blk
ensure
dir_levels.pop if blk
end
def path_parts(path)
path.split(File::PATH_SEPARATOR).reject { |part| part.empty? }
end
def normalize_path(path)
if Pathname.new(path).absolute?
File.expand_path(path)
else
parts = dir_levels + [path]
File.expand_path(File.join(*parts))
end
end
def current_dir
find(normalize_path('.'))
end
private
def find_recurser(dir, parts)
return [] unless dir.respond_to? :[]
pattern , *parts = parts
matches = case pattern
when '**'
case parts
when ['*']
parts = [] # end recursion
directories_under(dir).map do |d|
d.values.select{|f| f.is_a?(FakeFile) || f.is_a?(FakeDir) }
end.flatten.uniq
when []
parts = [] # end recursion
dir.values.flatten.uniq
else
directories_under(dir)
end
else
regexp_pattern = /\A#{pattern.gsub('?','.').gsub('*', '.*').gsub(/\{(.*?)\}/) { "(#{$1.gsub(',', '|')})" }}\Z/
dir.reject {|k,v| regexp_pattern !~ k }.values
end
if parts.empty? # we're done recursing
matches
else
matches.map{|entry| find_recurser(entry, parts) }
end
end
def directories_under(dir)
children = dir.values.select{|f| f.is_a? FakeDir}
([dir] + children + children.map{|c| directories_under(c)}).flatten.uniq
end
end
end

View File

@ -1,15 +0,0 @@
module FakeFS
class FileTest
def self.exist?(file_name)
File.exist?(file_name)
end
def self.directory?(file_name)
File.directory?(file_name)
end
def self.file?(file_name)
File.file?(file_name)
end
end
end

View File

@ -1,149 +0,0 @@
module FakeFS
module FileUtils
extend self
def mkdir_p(path, options = {})
FileSystem.add(path, FakeDir.new)
end
alias_method :mkpath, :mkdir_p
alias_method :makedirs, :mkdir_p
def mkdir(path)
parent = path.split('/')
parent.pop
raise Errno::ENOENT, "No such file or directory - #{path}" unless parent.join == "" || FileSystem.find(parent.join('/'))
raise Errno::EEXIST, "File exists - #{path}" if FileSystem.find(path)
FileSystem.add(path, FakeDir.new)
end
def rmdir(list, options = {})
list = [ list ] unless list.is_a?(Array)
list.each do |l|
parent = l.split('/')
parent.pop
raise Errno::ENOENT, "No such file or directory - #{l}" unless parent.join == "" || FileSystem.find(parent.join('/'))
raise Errno::ENOENT, l unless FileSystem.find(l)
raise Errno::ENOTEMPTY, l unless FileSystem.find(l).values.empty?
rm(l)
end
end
def rm(list, options = {})
Array(list).each do |path|
FileSystem.delete(path) or raise Errno::ENOENT.new(path)
end
end
alias_method :rm_rf, :rm
alias_method :rm_r, :rm
alias_method :rm_f, :rm
def ln_s(target, path, options = {})
options = { :force => false }.merge(options)
(FileSystem.find(path) && !options[:force]) ?
raise(Errno::EEXIST, path) :
FileSystem.delete(path)
if !options[:force] && !Dir.exists?(File.dirname(path))
raise Errno::ENOENT, path
end
FileSystem.add(path, FakeSymlink.new(target))
end
def ln_sf(target, path)
ln_s(target, path, { :force => true })
end
def cp(src, dest)
dst_file = FileSystem.find(dest)
src_file = FileSystem.find(src)
if !src_file
raise Errno::ENOENT, src
end
if File.directory? src_file
raise Errno::EISDIR, src
end
if dst_file && File.directory?(dst_file)
FileSystem.add(File.join(dest, src), src_file.entry.clone(dst_file))
else
FileSystem.delete(dest)
FileSystem.add(dest, src_file.entry.clone)
end
end
def cp_r(src, dest)
# This error sucks, but it conforms to the original Ruby
# method.
raise "unknown file type: #{src}" unless dir = FileSystem.find(src)
new_dir = FileSystem.find(dest)
if new_dir && !File.directory?(dest)
raise Errno::EEXIST, dest
end
if !new_dir && !FileSystem.find(dest+'/../')
raise Errno::ENOENT, dest
end
# This last bit is a total abuse and should be thought hard
# about and cleaned up.
if new_dir
if src[-2..-1] == '/.'
dir.values.each{|f| new_dir[f.name] = f.clone(new_dir) }
else
new_dir[dir.name] = dir.entry.clone(new_dir)
end
else
FileSystem.add(dest, dir.entry.clone)
end
end
def mv(src, dest, options={})
Array(src).each do |path|
if target = FileSystem.find(path)
dest_path = File.directory?(dest) ? File.join(dest, File.basename(path)) : dest
FileSystem.add(dest_path, target.entry.clone)
FileSystem.delete(path)
else
raise Errno::ENOENT, path
end
end
end
def chown(user, group, list, options={})
list = Array(list)
list.each do |f|
unless File.exists?(f)
raise Errno::ENOENT, f
end
end
list
end
def chown_R(user, group, list, options={})
chown(user, group, list, options={})
end
def touch(list, options={})
Array(list).each do |f|
directory = File.dirname(f)
# FIXME this explicit check for '.' shouldn't need to happen
if File.exists?(directory) || directory == '.'
FileSystem.add(f, FakeFile.new)
else
raise Errno::ENOENT, f
end
end
end
def cd(dir)
FileSystem.chdir(dir)
end
alias_method :chdir, :cd
end
end

View File

@ -1,11 +0,0 @@
require 'fileutils'
require 'pathname'
require 'fakefs/base'
require 'fakefs/fake/file'
require 'fakefs/fake/dir'
require 'fakefs/fake/symlink'
require 'fakefs/file_system'
require 'fakefs/fileutils'
require 'fakefs/file'
require 'fakefs/file_test'
require 'fakefs/dir'

View File

@ -1,46 +0,0 @@
# FakeFS::SpecHelpers provides a simple macro for RSpec example groups to turn FakeFS on and off.
# To use it simply require 'fakefs/spec_helpers', then include FakeFS::SpecHelpers into any
# example groups that you wish to use FakeFS in. For example:
#
# require 'fakefs/spec_helpers'
#
# describe "Some specs that deal with files" do
# include FakeFS::SpecHelpers
# ...
# end
#
# Alternatively, you can include FakeFS::SpecHelpers in all your example groups using RSpec's
# configuration block in your spec helper:
#
# require 'fakefs/spec_helpers'
#
# Spec::Runner.configure do |config|
# config.include FakeFS::SpecHelpers
# end
#
# If you do the above then use_fakefs will be available in all of your example groups.
#
require 'fakefs/safe'
module FakeFS
module SpecHelpers
def self.extended(example_group)
example_group.use_fakefs(example_group)
end
def self.included(example_group)
example_group.extend self
end
def use_fakefs(describe_block)
describe_block.before :each do
FakeFS.activate!
end
describe_block.after :each do
FakeFS.deactivate!
FakeFS::FileSystem.clear
end
end
end
end

View File

@ -1,9 +0,0 @@
module FakeFS
module Version
VERSION = "0.4.0"
def self.to_s
VERSION
end
end
end

71
panel/index.html Executable file
View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>layout</title>
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../css/panel.css" type="text/css" media="screen" charset="utf-8" />
<script src="search_index.js" type="text/javascript" charset="utf-8"></script>
<script src="tree.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/searchdoc.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
function placeholder() {
if (jQuery.browser.safari) return;
$('#search-label').click(function() {
$('#search').focus();
$('#search-label').hide();
});
$('#search').focus(function() {
$('#search-label').hide();
});
$('#search').blur(function() {
this.value == '' && $('#search-label').show()
});
$('#search')[0].value == '' && $('#search-label').show();
}
$(function() {
placeholder();
var panel = new Searchdoc.Panel($('#panel'), search_data, tree, top.frames[1]);
$('#search').focus();
var s = window.parent.location.search.match(/\?q=([^&]+)/);
if (s) {
s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
if (s.length > 0)
{
$('#search').val(s);
panel.search(s, true);
}
}
})
//]]>
</script>
</head>
<body>
<div class="panel panel_tree" id="panel">
<div class="header">
<div>
<label for="search" id="search-label" style="display: none">Search</label>
<table>
<tr><td>
<input type="Search" placeholder="Search" autosave="searchdoc" results="10" id="search" autocomplete="off"/>
</td></tr>
</table></div>
</div>
<div class="tree">
<ul>
</ul>
</div>
<div class="result">
<ul>
</ul>
</div>
</div>
</body>
</html>

1
panel/search_index.js Normal file

File diff suppressed because one or more lines are too long

1
panel/tree.js Normal file
View File

@ -0,0 +1 @@
var tree = [["","","files",[["CONTRIBUTORS","files/CONTRIBUTORS.html","",[]],["LICENSE","files/LICENSE.html","",[]],["README.markdown","files/README_markdown.html","",[]],["","","lib",[["","","fakefs",[["base.rb","files/lib/fakefs/base_rb.html","",[]],["dir.rb","files/lib/fakefs/dir_rb.html","",[]],["","","fake",[["dir.rb","files/lib/fakefs/fake/dir_rb.html","",[]],["file.rb","files/lib/fakefs/fake/file_rb.html","",[]],["symlink.rb","files/lib/fakefs/fake/symlink_rb.html","",[]]]],["file.rb","files/lib/fakefs/file_rb.html","",[]],["file_system.rb","files/lib/fakefs/file_system_rb.html","",[]],["file_test.rb","files/lib/fakefs/file_test_rb.html","",[]],["fileutils.rb","files/lib/fakefs/fileutils_rb.html","",[]],["safe.rb","files/lib/fakefs/safe_rb.html","",[]],["spec_helpers.rb","files/lib/fakefs/spec_helpers_rb.html","",[]],["version.rb","files/lib/fakefs/version_rb.html","",[]]]],["fakefs.rb","files/lib/fakefs_rb.html","",[]]]]]],["FakeFS","classes/FakeFS.html","",[["Dir","classes/FakeFS/Dir.html"," < Object",[]],["FakeDir","classes/FakeFS/FakeDir.html"," < Hash",[]],["FakeFile","classes/FakeFS/FakeFile.html"," < Object",[["Inode","classes/FakeFS/FakeFile/Inode.html"," < Object",[]]]],["FakeSymlink","classes/FakeFS/FakeSymlink.html"," < Object",[]],["File","classes/FakeFS/File.html"," < StringIO",[["Stat","classes/FakeFS/File/Stat.html"," < Object",[]]]],["FileSystem","classes/FakeFS/FileSystem.html","",[]],["FileTest","classes/FakeFS/FileTest.html"," < Object",[]],["FileUtils","classes/FakeFS/FileUtils.html","",[]],["SpecHelpers","classes/FakeFS/SpecHelpers.html","",[]],["Version","classes/FakeFS/Version.html","",[]]]],["Object","classes/Object.html"," < Object",[]]]

View File

@ -1,57 +0,0 @@
require 'spec_helper'
module FakeFS
describe SpecHelpers do
before do
@rspec_example_group = Class.new do
def self.before(sym = :each)
yield if block_given?
end
def self.after(sym = :each)
yield if block_given?
end
end
end
describe "when extending" do
context "before each" do
it "should call it" do
@rspec_example_group.should_receive(:before).with(:each)
@rspec_example_group.extend FakeFS::SpecHelpers
end
it "should call FakeFS.activate!" do
FakeFS.should_receive(:activate!)
@rspec_example_group.extend FakeFS::SpecHelpers
end
end
context "after each" do
it "should call it" do
@rspec_example_group.should_receive(:after).with(:each)
@rspec_example_group.extend FakeFS::SpecHelpers
end
it "should deactivate fakefs" do
FakeFS.should_receive(:deactivate!)
@rspec_example_group.extend FakeFS::SpecHelpers
end
it "should clear the fakefs filesystem for the next run" do
FakeFS::FileSystem.should_receive(:clear)
@rspec_example_group.extend FakeFS::SpecHelpers
end
end
end
describe "when including" do
it "should call before :each" do
@rspec_example_group.should_receive(:before)
@rspec_example_group.class_eval do
include FakeFS::SpecHelpers
end
end
end
end
end

View File

@ -1 +0,0 @@
--color

View File

@ -1,3 +0,0 @@
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'fakefs/spec_helpers'

View File

@ -1,6 +0,0 @@
watch('test/.*_test.rb') { run_tests }
watch('lib/.*.rb') { run_tests }
def run_tests
system 'rake test'
end

View File

@ -1,19 +0,0 @@
require "test_helper"
class FileJoin < Test::Unit::TestCase
def setup
FakeFS.activate!
end
def teardown
FakeFS.deactivate!
end
[
["a", "b"], ["a/", "b"], ["a", "/b"], ["a/", "/b"], ["a", "/", "b"]
].each_with_index do |args, i|
define_method "test_file_join_#{i}" do
assert_equal RealFile.join(args), File.join(args)
end
end
end

View File

@ -1,59 +0,0 @@
require "test_helper"
class FileStat < Test::Unit::TestCase
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
end
def teardown
FakeFS.deactivate!
end
def test_calling_lstat_should_create_a_new_file_stat_object
File.open("foo", "w") do |f|
f << "bar"
end
File.open("foo") do |f|
assert_equal File::Stat, f.lstat.class
end
end
def test_lstat_should_use_correct_file
File.open("bar", "w") do |f|
f << "1"
end
File.open("bar") do |f|
assert_equal 1, f.lstat.size
end
end
def test_lstat_should_report_on_symlink_itself
File.open("foo", "w") { |f| f << "some content" }
File.symlink "foo", "my_symlink"
assert_not_equal File.lstat("my_symlink").size, File.lstat("foo").size
end
def test_should_report_on_symlink_itself_with_size_instance_method
File.open("foo", "w") { |f| f << "some content" }
File.symlink "foo", "my_symlink"
file = File.open("foo")
symlink = File.open("my_symlink")
assert_not_equal file.lstat.size, symlink.lstat.size
end
def test_symlink_size_is_size_of_path_pointed_to
File.open("a", "w") { |x| x << "foobarbazfoobarbaz" }
File.symlink "a", "one_char_symlink"
assert_equal 1, File.lstat("one_char_symlink").size
File.open("ab", "w") { |x| x << "foobarbazfoobarbaz" }
File.symlink "ab", "two_char_symlink"
assert_equal 2, File.lstat("two_char_symlink").size
end
end

View File

@ -1,39 +0,0 @@
require "test_helper"
class FileStat < Test::Unit::TestCase
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
end
def teardown
FakeFS.deactivate!
end
def test_calling_stat_should_create_a_new_file_stat_object
File.open("foo", "w") do |f|
f << "bar"
end
File.open("foo") do |f|
assert_equal File::Stat, f.stat.class
end
end
def test_stat_should_use_correct_file
File.open("bar", "w") do |f|
f << "1"
end
File.open("bar") do |f|
assert_equal 1, f.stat.size
end
end
def test_stat_should_report_on_symlink_pointer
File.open("foo", "w") { |f| f << "some content" }
File.symlink "foo", "my_symlink"
assert_equal File.stat("my_symlink").size, File.stat("foo").size
end
end

View File

@ -1,44 +0,0 @@
require "test_helper"
class FileSysSeek < Test::Unit::TestCase
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
end
def teardown
FakeFS.deactivate!
end
def test_should_seek_to_position
file = File.open("foo", "w") do |f|
f << "0123456789"
end
File.open("foo", "r") do |f|
f.sysseek(3)
assert_equal 3, f.pos
f.sysseek(0)
assert_equal 0, f.pos
end
end
def test_seek_returns_offset_into_file
File.open("foo", "w") do |f|
# 66 chars long
str = "0123456789" +
"0123456789" +
"0123456789" +
"0123456789" +
"0123456789" +
"0123456789" +
"012345"
f << str
end
f = File.open("foo")
assert_equal 53, f.sysseek(-13, IO::SEEK_END)
end
end

View File

@ -1,62 +0,0 @@
require "test_helper"
class FileSysWriteTest < Test::Unit::TestCase
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
end
def teardown
FakeFS.deactivate!
end
def test_returns_one_byte_when_written
f = File.open "foo", "w"
result = f.syswrite "a"
assert_equal 1, result
end
def test_returns_two_bytes_when_two_written
f = File.open "foo", "w"
result = f.syswrite "ab"
assert_equal 2, result
end
def test_syswrite_writes_file
f = File.open "foo", "w"
f.syswrite "abcdef"
f.close
assert_equal "abcdef", File.read("foo")
end
def test_writes_to_the_actual_position_when_called_after_buffered_io_read
File.open("foo", "w") do |file|
file.syswrite("012345678901234567890123456789")
end
file = File.open("foo", "r+")
file.read(5)
file.syswrite("abcde")
File.open("foo") do |file|
assert_equal "01234abcde", file.sysread(10)
end
end
def test_writes_all_of_the_strings_bytes_but_does_not_buffer_them
File.open("foo", "w") do |file|
file.syswrite("012345678901234567890123456789")
end
file = File.open("foo", "r+")
written = file.syswrite("abcde")
File.open("foo") do |file|
assert_equal "abcde56789", file.sysread(10)
file.seek(0)
file.fsync
assert_equal "abcde56789", file.sysread(10)
end
end
end

View File

@ -1,97 +0,0 @@
require "test_helper"
class FakeFileTest < Test::Unit::TestCase
include FakeFS
def setup
FileSystem.clear
@file = FakeFile.new
end
def test_fake_file_has_empty_content_by_default
assert_equal "", @file.content
end
def test_fake_file_can_read_and_write_to_content
@file.content = "foobar"
assert_equal "foobar", @file.content
end
def test_fake_file_has_1_link_by_default
assert_equal [@file], @file.links
end
def test_fake_file_can_create_link
other_file = FakeFile.new
@file.link(other_file)
assert_equal [@file, other_file], @file.links
end
def test_fake_file_wont_add_link_to_same_file_twice
other_file = FakeFile.new
@file.link other_file
@file.link other_file
assert_equal [@file, other_file], @file.links
end
def test_links_are_mutual
other_file = FakeFile.new
@file.link(other_file)
assert_equal [@file, other_file], other_file.links
end
def test_can_link_multiple_files
file_two = FakeFile.new
file_three = FakeFile.new
@file.link file_two
@file.link file_three
assert_equal [@file, file_two, file_three], @file.links
assert_equal [@file, file_two, file_three], file_two.links
assert_equal [@file, file_two, file_three], file_three.links
end
def test_links_share_same_content
other_file = FakeFile.new
@file.link other_file
@file.content = "foobar"
assert_equal "foobar", other_file.content
end
def test_clone_creates_new_inode
clone = @file.clone
assert !clone.inode.equal?(@file.inode)
end
def test_cloning_does_not_use_same_content_object
clone = @file.clone
clone.content = "foo"
@file.content = "bar"
assert_equal "foo", clone.content
assert_equal "bar", @file.content
end
def test_raises_an_error_with_the_correct_path
path = "/some/non/existing/file"
begin
FakeFS::File.new path
msg = nil
rescue Errno::ENOENT => e
msg = e.message
end
assert_equal "No such file or directory - #{path}", msg
end
end

View File

@ -1,10 +0,0 @@
require "test_helper"
class FakeSymlinkTest < Test::Unit::TestCase
include FakeFS
def test_symlink_has_method_missing_as_private
methods = FakeSymlink.private_instance_methods.map { |m| m.to_s }
assert methods.include?("method_missing")
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +0,0 @@
require "test_helper"
class FileStatTest < Test::Unit::TestCase
include FakeFS
def setup
FileSystem.clear
end
def touch(*args)
FileUtils.touch(*args)
end
def ln_s(*args)
FileUtils.ln_s(*args)
end
def mkdir(*args)
Dir.mkdir(*args)
end
def ln(*args)
File.link(*args)
end
def test_file_stat_init_with_non_existant_file
assert_raises(Errno::ENOENT) do
File::Stat.new("/foo")
end
end
def test_symlink_should_be_true_when_symlink
touch("/foo")
ln_s("/foo", "/bar")
assert File::Stat.new("/bar").symlink?
end
def test_symlink_should_be_false_when_not_a_symlink
FileUtils.touch("/foo")
assert !File::Stat.new("/foo").symlink?
end
def test_should_return_false_for_directory_when_not_a_directory
FileUtils.touch("/foo")
assert !File::Stat.new("/foo").directory?
end
def test_should_return_true_for_directory_when_a_directory
mkdir "/foo"
assert File::Stat.new("/foo").directory?
end
def test_one_file_has_hard_link
touch "testfile"
assert_equal 1, File.stat("testfile").nlink
end
def test_two_hard_links_show_nlinks_as_two
touch "testfile"
ln "testfile", "testfile.bak"
assert_equal 2, File.stat("testfile").nlink
end
def test_file_size
File.open('testfile', 'w') { |f| f << 'test' }
assert_equal 4, File.stat('testfile').size
end
end

View File

@ -1,44 +0,0 @@
require "test_helper"
class FakeFSSafeTest < Test::Unit::TestCase
def setup
FakeFS.deactivate!
end
def teardown
FakeFS.activate!
end
def test_FakeFS_method_does_not_intrude_on_global_namespace
path = 'file.txt'
FakeFS do
File.open(path, 'w') { |f| f.write "Yatta!" }
assert File.exists?(path)
end
assert ! File.exists?(path)
end
def test_FakeFS_method_returns_value_of_yield
result = FakeFS do
File.open('myfile.txt', 'w') { |f| f.write "Yatta!" }
File.read('myfile.txt')
end
assert_equal result, "Yatta!"
end
def test_FakeFS_method_deactivates_FakeFS_when_block_raises_exception
begin
FakeFS do
raise 'boom!'
end
rescue
end
assert_equal RealFile, File, "File is #{File} (should be #{RealFile})"
assert_equal RealFileUtils, FileUtils, "FileUtils is #{FileUtils} (should be #{RealFileUtils})"
assert_equal RealDir, Dir, "Dir is #{Dir} (should be #{RealDir})"
end
end

View File

@ -1,8 +0,0 @@
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'fakefs/safe'
require 'test/unit'
begin
require 'redgreen'
rescue LoadError
end

View File

@ -1,31 +0,0 @@
# Figure out what's missing from fakefs
#
# USAGE
#
# $ RUBYLIB=test ruby test/verify.rb | grep "not implemented"
require "test_helper"
class FakeFSVerifierTest < Test::Unit::TestCase
class_mapping = {
RealFile => FakeFS::File,
RealFile::Stat => FakeFS::File::Stat,
RealFileUtils => FakeFS::FileUtils,
RealDir => FakeFS::Dir,
RealFileTest => FakeFS::FileTest
}
class_mapping.each do |real_class, fake_class|
real_class.methods.each do |method|
define_method "test #{method} class method" do
assert fake_class.respond_to?(method), "#{fake_class}.#{method} not implemented"
end
end
real_class.instance_methods.each do |method|
define_method("test #{method} instance method") do
assert fake_class.instance_methods.include?(method), "#{fake_class}##{method} not implemented"
end
end
end
end