create docs

This commit is contained in:
Chris Wanstrath 2009-10-06 21:44:05 -07:00
commit f3ab9f70b5
42 changed files with 7814 additions and 0 deletions

BIN
apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

184
classes/FakeFS.html Normal file
View File

@ -0,0 +1,184 @@
<?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/dir_rb.html">lib/fakefs/dir.rb</a></li>
<li><a href="../files/lib/fakefs/base_rb.html">lib/fakefs/base.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/fileutils_rb.html">lib/fakefs/fileutils.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="#M000002">activate!</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000003">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/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>
</ul>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000002">
<a name="M000002"></a><b>activate!</b>()
</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/0da41d92a7ad99b3e2f3dd640f34520a3bd711ea/lib/fakefs/base.rb#L8" 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/base.rb, line 8</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">: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-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000003">
<a name="M000003"></a><b>deactivate!</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/0da41d92a7ad99b3e2f3dd640f34520a3bd711ea/lib/fakefs/base.rb#L19" 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/base.rb, line 19</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">: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">:FileUtils</span>, <span class="ruby-constant">RealFileUtils</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

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

@ -0,0 +1,775 @@
<?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="#M000001">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="#M000004">each</a>,</li>
<li><a href="#M000017">entries</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000020">foreach</a></li>
</ul>
</dd>
<dt>G</dt>
<dd>
<ul>
<li><a href="#M000021">glob</a></li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li><a href="#M000023">mkdir</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000000">new</a></li>
</ul>
</dd>
<dt>O</dt>
<dd>
<ul>
<li><a href="#M000024">open</a></li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li><a href="#M000005">path</a>,</li>
<li><a href="#M000006">pos</a>,</li>
<li><a href="#M000007">pos=</a>,</li>
<li><a href="#M000027">pwd</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000008">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="#M000026">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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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="M000017">
<a name="M000017"></a><b>entries</b>(dirname)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L72" 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 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-identifier">file</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>foreach</b>(dirname, &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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L77" 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 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="M000021">
<a name="M000021"></a><b>glob</b>(pattern)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L81" 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 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="M000023">
<a name="M000023"></a><b>mkdir</b>(string, integer = 0)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L85" 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/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-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="M000000">
<a name="M000000"></a><b>new</b>(string)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L5" 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/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="M000024">
<a name="M000024"></a><b>open</b>(string, &amp;block)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L92" 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/dir.rb, line 92</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="M000027">
<a name="M000027"></a><b>pwd</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L104" 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/dir.rb, line 104</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="M000026">
<a name="M000026"></a><b>tmpdir</b>()
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L100" 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/dir.rb, line 100</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="M000001">
<a name="M000001"></a><b>close</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L13" 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/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="M000004">
<a name="M000004"></a><b>each</b>(&amp;block)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L20" 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/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="M000005">
<a name="M000005"></a><b>path</b>()
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L26" 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 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="M000006">
<a name="M000006"></a><b>pos</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L30" 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 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="M000007">
<a name="M000007"></a><b>pos=</b>(integer)
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L34" 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 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="M000008">
<a name="M000008"></a><b>read</b>()
</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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/lib/fakefs/dir.rb#L38" 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 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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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/0124b3ab89ed01ae21088cea0497b3ee60bbdfa8/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>

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

@ -0,0 +1,322 @@
<?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="#M000022">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="#M000018">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000019">inspect</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000016">new</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000025">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>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000016">
<a name="M000016"></a><b>new</b>(name = nil, parent = nil)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L5" 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/fake/dir.rb, line 5</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-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000022">
<a name="M000022"></a><b>clone</b>(parent = nil)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L18" 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/fake/dir.rb, line 18</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L37" 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 37</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="M000018">
<a name="M000018"></a><b>entry</b>()
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L10" 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/fake/dir.rb, line 10</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="M000019">
<a name="M000019"></a><b>inspect</b>()
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L14" 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/fake/dir.rb, line 14</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="M000025">
<a name="M000025"></a><b>to_s</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/dir.rb#L27" 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 27</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,450 @@
<?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="#M000043">clone</a>,</li>
<li><a href="#M000039">content</a>,</li>
<li><a href="#M000040">content=</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000047">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000044">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000045">inspect</a></li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li><a href="#M000042">link</a>,</li>
<li><a href="#M000041">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="#M000046">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'>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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L24" 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 24</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-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000043">
<a name="M000043"></a><b>clone</b>(parent = nil)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L48" 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/file.rb, line 48</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="M000039">
<a name="M000039"></a><b>content</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L32" 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 32</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="M000040">
<a name="M000040"></a><b>content=</b>(str)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L36" 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 36</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="M000047">
<a name="M000047"></a><b>delete</b>()
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L67" 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/file.rb, line 67</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="M000044">
<a name="M000044"></a><b>entry</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L55" 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/file.rb, line 55</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="M000045">
<a name="M000045"></a><b>inspect</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L59" 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/file.rb, line 59</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="M000042">
<a name="M000042"></a><b>link</b>(other_file)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L44" 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 44</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="M000041">
<a name="M000041"></a><b>links</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L40" 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 40</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="M000046">
<a name="M000046"></a><b>to_s</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L63" 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/file.rb, line 63</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,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::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>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="#M000032">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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L6" 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 6</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="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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L14" 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 14</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="M000032">
<a name="M000032"></a><b>unlink</b>(file)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/file.rb#L19" 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 19</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="#M000036">delete</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000035">entry</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000034">inspect</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000031">new</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000037">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="M000031">
<a name="M000031"></a><b>new</b>(target)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/symlink.rb#L6" 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/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="M000036">
<a name="M000036"></a><b>delete</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/symlink.rb#L18" 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/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="M000035">
<a name="M000035"></a><b>entry</b>()
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/symlink.rb#L14" 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/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="M000034">
<a name="M000034"></a><b>inspect</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/symlink.rb#L10" 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/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="M000037">
<a name="M000037"></a><b>respond_to?</b>(method)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/fake/symlink.rb#L22" 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/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>

1100
classes/FakeFS/File.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
<?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="#M000082">directory?</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000080">new</a>,</li>
<li><a href="#M000083">nlink</a></li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li><a href="#M000081">symlink?</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000080">
<a name="M000080"></a><b>new</b>(file)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file.rb#L165" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000080_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 165</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file</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-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000082">
<a name="M000082"></a><b>directory?</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file.rb#L177" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000082_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 177</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="M000083">
<a name="M000083"></a><b>nlink</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file.rb#L181" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000083_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 181</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nlink</span>
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@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="M000081">
<a name="M000081"></a><b>symlink?</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file.rb#L173" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000081_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 173</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="#M000056">add</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000069">chdir</a>,</li>
<li><a href="#M000050">clear</a>,</li>
<li><a href="#M000061">clone</a>,</li>
<li><a href="#M000076">current_dir</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000068">delete</a>,</li>
<li><a href="#M000048">dir_levels</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000054">files</a>,</li>
<li><a href="#M000055">find</a>,</li>
<li><a href="#M000049">fs</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000073">normalize_path</a></li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li><a href="#M000071">path_parts</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000056">
<a name="M000056"></a><b>add</b>(path, object=FakeDir.new)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L35" 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 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="M000069">
<a name="M000069"></a><b>chdir</b>(dir, &amp;blk)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L74" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000069_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="M000050">
<a name="M000050"></a><b>clear</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L13" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000050_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="M000061">
<a name="M000061"></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('M000061_source')" id="l_M000061_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000061_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="M000076">
<a name="M000076"></a><b>current_dir</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L99" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000076_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="M000068">
<a name="M000068"></a><b>delete</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L68" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000068_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="M000048">
<a name="M000048"></a><b>dir_levels</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000048_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="M000054">
<a name="M000054"></a><b>files</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L18" 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 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="M000055">
<a name="M000055"></a><b>find</b>(path)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L22" 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 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="M000049">
<a name="M000049"></a><b>fs</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000049_source')" id="l_M000049_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L9" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000049_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="M000073">
<a name="M000073"></a><b>normalize_path</b>(path)
</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/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L90" 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 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="M000071">
<a name="M000071"></a><b>path_parts</b>(path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/c00d4506623d16a928fb37ae66084d2c632970a1/lib/fakefs/file_system.rb#L86" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000071_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,586 @@
<?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="#M000115">cd</a>,</li>
<li><a href="#M000116">chdir</a>,</li>
<li><a href="#M000112">chown</a>,</li>
<li><a href="#M000113">chown_R</a>,</li>
<li><a href="#M000100">cp</a>,</li>
<li><a href="#M000102">cp_r</a></li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li><a href="#M000099">ln_s</a></li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li><a href="#M000084">mkdir_p</a>,</li>
<li><a href="#M000086">mkpath</a>,</li>
<li><a href="#M000111">mv</a></li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li><a href="#M000092">rm</a>,</li>
<li><a href="#M000098">rm_r</a>,</li>
<li><a href="#M000093">rm_rf</a>,</li>
<li><a href="#M000087">rmdir</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000114">touch</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000115">
<a name="M000115"></a><b>cd</b>(dir)
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000116">chdir</a>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L117" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000115_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 117</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="M000116">
<a name="M000116"></a><b>chdir</b>(dir)
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000115">cd</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000112">
<a name="M000112"></a><b>chown</b>(user, group, list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L91" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000112_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 91</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="M000113">
<a name="M000113"></a><b>chown_R</b>(user, group, list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000113_source')" id="l_M000113_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L101" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000113_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 101</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="M000100">
<a name="M000100"></a><b>cp</b>(src, dest)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000100_source')" id="l_M000100_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L34" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000100_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 34</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="M000102">
<a name="M000102"></a><b>cp_r</b>(src, dest)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000102_source')" id="l_M000102_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L54" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000102_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 54</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="M000099">
<a name="M000099"></a><b>ln_s</b>(target, path)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000099_source')" id="l_M000099_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L29" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000099_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 29</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">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-keyword kw">if</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</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="M000084">
<a name="M000084"></a><b>mkdir_p</b>(path)
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000086">mkpath</a>
</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/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L5" 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/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-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="M000086">
<a name="M000086"></a><b>mkpath</b>(path)
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000084">mkdir_p</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000111">
<a name="M000111"></a><b>mv</b>(src, dest)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000111_source')" id="l_M000111_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L82" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000111_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 82</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-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="M000092">
<a name="M000092"></a><b>rm</b>(path)
</div>
<div class="aka">
This method is also aliased as
<a href="FileUtils.html#M000093">rm_rf</a>
<a href="FileUtils.html#M000098">rm_r</a>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000092_source')" id="l_M000092_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000092_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">path</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></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000098">
<a name="M000098"></a><b>rm_r</b>(path)
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000092">rm</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000093">
<a name="M000093"></a><b>rm_rf</b>(path)
</div>
<div class="description">
<p>
Alias for <a href="FileUtils.html#M000092">rm</a>
</p>
</div>
</div>
<div class="method">
<div class="title" id="M000087">
<a name="M000087"></a><b>rmdir</b>(list, options = {})
</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/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L10" 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/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="M000114">
<a name="M000114"></a><b>touch</b>(list, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000114_source')" id="l_M000114_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/25e47887b0091d1afc9b87d832d0a61e40c6a7c3/lib/fakefs/fileutils.rb#L105" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000114_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/fakefs/fileutils.rb, line 105</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>

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="#M000117">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.1.1&quot;</td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000117">
<a name="M000117"></a><b>to_s</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000117_source')" id="l_M000117_source">show</a>
| <a href="http://github.com/defunkt/fakefs/blob/1eb0b972079a524c91d9379bdd38da7727551376/lib/fakefs/version.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000117_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="#M000009">FakeFS</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000009">
<a name="M000009"></a><b>FakeFS</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/0da41d92a7ad99b3e2f3dd640f34520a3bd711ea/lib/fakefs/base.rb#L31" 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/base.rb, line 31</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-identifier">result</span> = <span class="ruby-keyword kw">yield</span>
<span class="ruby-operator">::</span><span class="ruby-constant">FakeFS</span>.<span class="ruby-identifier">deactivate!</span>
<span class="ruby-identifier">result</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 @@
Tue, 06 Oct 2009 21:44:00 -0700

263
css/main.css Executable file
View File

@ -0,0 +1,263 @@
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;
}
.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;
}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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: Tue Oct 06 21:17:21 -0700 2009</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>

158
files/README_markdown.html Normal file
View File

@ -0,0 +1,158 @@
<?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: Tue Oct 06 21:17:21 -0700 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<h1>FakeFS</h1>
<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're mocking and stubbing every call to FileUtils or File, you're
tightly coupling your tests with the implementation.</p>
<pre><code>def test_creates_directory
FileUtils.expects(:mkdir).with("directory").once
Library.add "directory"
end
</code></pre>
<p>The above test will break if we decide to use <code>mkdir_p</code> in our code. Refactoring
code shouldn't necessitate refactoring tests.</p>
<p>With FakeFS:</p>
<pre><code>def test_creates_directory
Library.add "directory"
assert File.directory?("directory")
end
</code></pre>
<p>Woot.</p>
<h2>Usage</h2>
<pre><code>require 'fakefs'
# That's it.
</code></pre>
<h2>Don't Fake the FS Immediately</h2>
<pre><code>require 'fakefs/safe'
FakeFS.activate!
# your code
FakeFS.deactivate!
# or
FakeFS do
# your code
end
</code></pre>
<h2>How is this different than MockFS?</h2>
<p>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.</p>
<h2>Speed?</h2>
<p><a href="http://gist.github.com/156091">http://gist.github.com/156091</a></p>
<h2>Installation</h2>
<h3><a href="http://gemcutter.org/">Gemcutter</a></h3>
<pre><code>$ gem install fakefs
</code></pre>
<h3><a href="http://hellorip.com">Rip</a></h3>
<pre><code>$ rip install git://github.com/defunkt/fakefs.git
</code></pre>
<h2>Contributors</h2>
<ul>
<li>Chris Wanstrath</li>
<li>David Reese</li>
<li>Jeff Hodges</li>
<li>Jon Yurek</li>
<li>Matt Freels</li>
<li>Myles Eftos</li>
<li>Pat Nakajima</li>
<li>Rob Sanheim</li>
<li>Scott Taylor</li>
<li>Tymon Tobolski</li>
<li>msassak</li>
</ul>
<h2>Meta</h2>
<ul>
<li>Code: <code>git clone git://github.com/defunkt/fakefs.git</code></li>
<li>Docs: <a href="http://defunkt.github.com/fakefs">http://defunkt.github.com/fakefs</a></li>
<li>Bugs: <a href="http://github.com/defunkt/fakefs/issues">http://github.com/defunkt/fakefs/issues</a></li>
<li>List: <a href="http://groups.google.com/group/fakefs">http://groups.google.com/group/fakefs</a></li>
<li>Test: <a href="http://runcoderun.com/defunkt/fakefs">http://runcoderun.com/defunkt/fakefs</a></li>
<li>Gems: <a href="http://gemcutter.org/gems/fakefs">http://gemcutter.org/gems/fakefs</a></li>
<li>Boss: Chris Wanstrath :: <a href="http://github.com/defunkt">http://github.com/defunkt</a></li>
</ul>
<script type="text/javascript">$(function() {
$('a').each(function() { $(this).attr('target', '_blank') })
})</script>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,101 @@
<?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: Tue Oct 06 21:17:21 -0700 2009</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">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>
<tr valign='top'>
<td class="attr-name">Dir</td>
<td>=</td>
<td class="attr-value">RealDir</td>
</tr>
<tr valign='top'>
<td class="attr-name">File</td>
<td>=</td>
<td class="attr-value">RealFile</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: Tue Oct 06 21:17:21 -0700 2009</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: Tue Oct 06 21:17:21 -0700 2009</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: Tue Oct 06 21:17:21 -0700 2009</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: Tue Oct 06 21:17:21 -0700 2009</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/file.rb</li>
<li>Last modified: Tue Oct 06 21:17:21 -0700 2009</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_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: Tue Oct 06 21:17:21 -0700 2009</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: Tue Oct 06 21:17:21 -0700 2009</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,77 @@
<?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: Tue Oct 06 21:17:21 -0700 2009</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/dir</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: Tue Oct 06 21:17:21 -0700 2009</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: Tue Oct 06 21:17:21 -0700 2009</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';
}
});

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",[["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","",[]],["fileutils.rb","files/lib/fakefs/fileutils_rb.html","",[]],["safe.rb","files/lib/fakefs/safe_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"," < Object",[["Stat","classes/FakeFS/File/Stat.html"," < Object",[]]]],["FileSystem","classes/FakeFS/FileSystem.html","",[]],["FileUtils","classes/FakeFS/FileUtils.html","",[]],["Version","classes/FakeFS/Version.html","",[]]]],["Object","classes/Object.html"," < Object",[]]]