Skip to content

Commit

Permalink
updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
al6x committed Sep 11, 2011
1 parent ca6b36d commit c477785
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 64 deletions.
8 changes: 4 additions & 4 deletions docs/basics.html
Expand Up @@ -38,7 +38,7 @@
<pre><code>gem install vfs
</code></pre>

<p>Once installed, You can proceed with the example below. It uses local file system as storage, there&rsquo;s also <a href="http://alexeypetrushin.github.com/vfs/s3/basics.html">S3 version</a> and <a href="http://alexeypetrushin.github.com/vfs/ssh/basics.html">SFTP version</a> (also <a href="http://alexeypetrushin.github.com/vfs/s3/backup.html">S3 backup</a> and <a href="http://alexeypetrushin.github.com/vfs/ssh/deployment.html">SSH/SFTP deployment</a> examples availiable).</p>
<p>Once installed, You can proceed with the example below. It uses local file system as storage, there&rsquo;s also <a href="s3/basics.html">S3 version</a> and <a href="ssh/basics.html">SFTP version</a> (also <a href="s3/backup.html">S3 backup</a> and <a href="ssh/deployment.html">SSH/SFTP deployment</a> examples availiable).</p>

<p>The project is <a href="https://github.com/alexeypetrushin/vfs">hosted on GitHub</a>. You can report bugs and discuss features on the <a href="https://github.com/alexeypetrushin/vfs/issues">issues page</a>.</p>
</td>
Expand Down Expand Up @@ -97,7 +97,7 @@ <h3>Example</h3>
<div class="pilwrap">
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>We can assign files and dirs to variables, now the <code>readme</code> variable refers to our readme.txt file. </p>
<p>We can assign files and dirs to variables, now the <code>readme</code> variable refers to our readme.txt file.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">readme</span> <span class="o">=</span> <span class="n">project</span><span class="o">[</span><span class="s1">&#39;readme.txt&#39;</span><span class="o">]</span></pre></div>
Expand All @@ -108,7 +108,7 @@ <h3>Example</h3>
<div class="pilwrap">
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Let&rsquo;s ensure that it&rsquo;s all ok with our readme file and check it&rsquo;s attributes. </p>
<p>Let&rsquo;s ensure that it&rsquo;s all ok with our readme file and check it&rsquo;s attributes.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">p</span> <span class="n">readme</span><span class="o">.</span><span class="n">name</span> <span class="c1"># =&gt; readme.txt</span>
Expand Down Expand Up @@ -275,7 +275,7 @@ <h3>Example</h3>
<a class="pilcrow" href="#section-19">&#182;</a>
</div>
<p>In this example we covering basics of <strong>Virtual File System</strong>, if You are interesting You can also take
a look at <a href="http://alexeypetrushin.github.com/vfs/s3/backup.html">S3 backup</a> and <a href="http://alexeypetrushin.github.com/vfs/ssh/deployment.html">SSH/SFTP deployment</a> examples.</p>
a look at <a href="s3/backup.html">S3 backup</a> and <a href="ssh/deployment.html">SSH/SFTP deployment</a> examples.</p>

</td>
<td class=code>
Expand Down
8 changes: 4 additions & 4 deletions docs/basics.rb
Expand Up @@ -106,10 +106,10 @@
# a look at [S3 backup][s3_backup] and [SSH/SFTP deployment][ssh_deployment] examples.
#
#
# [s3_basics]: http://alexeypetrushin.github.com/vfs/s3/basics.html
# [ssh_basics]: http://alexeypetrushin.github.com/vfs/ssh/basics.html
# [s3_backup]: http://alexeypetrushin.github.com/vfs/s3/backup.html
# [ssh_deployment]: http://alexeypetrushin.github.com/vfs/ssh/deployment.html
# [s3_basics]: s3/basics.html
# [ssh_basics]: ssh/basics.html
# [s3_backup]: s3/backup.html
# [ssh_deployment]: ssh/deployment.html
#
# [project]: https://github.com/alexeypetrushin/vfs
# [issues]: https://github.com/alexeypetrushin/vfs/issues
8 changes: 8 additions & 0 deletions docs/index.html
@@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="Refresh" content="0; url=basics.html" />
</head>
<body>
<p>Please follow <a href="basics.html">this link</a>.</p>
</body>
</html>
19 changes: 16 additions & 3 deletions docs/s3/backup.html
Expand Up @@ -8,6 +8,19 @@
<body>
<div id='container'>
<div id="background"></div>
<div id="jump_to">
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="backup.html">backup.rb</a>
<a class="source" href="basics.html">basics.rb</a>
<a class="source" href="sandbox.html">sandbox.rb</a>
<a class="source" href="../ssh/basics.html">basics.rb</a>
<a class="source" href="../ssh/deployment.html">deployment.rb</a>
<a class="source" href="../ssh/sandbox.html">sandbox.rb</a>
</div>
</div>
</div>
<table cellspacing=0 cellpadding=0>
<thead>
<tr>
Expand All @@ -21,7 +34,7 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Example of creating AWS S3 Backup with <a href="http://alexeypetrushin.github.com/vfs/basics.html">Virtual File System</a>.</p>
<p>Example of creating AWS S3 Backup with <a href="..">Virtual File System</a>.</p>

<p>In this example we uploading sample files to S3 and then
copying it back to local folder.</p>
Expand All @@ -36,7 +49,7 @@
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Connecting to S3 and preparing sandbox. You may take a look at
the <a href="http://alexeypetrushin.github.com/vfs/s3/sandbox.html">docs/s3/sandbox.rb</a> to see actual code.</p>
the <a href="sandbox.html">docs/s3/sandbox.rb</a> to see the actual code.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="vg">$LOAD_PATH</span> <span class="o">&lt;&lt;</span> <span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="bp">__FILE__</span><span class="si">}</span><span class="s2">/../../..&quot;</span><span class="p">)</span>
Expand Down Expand Up @@ -74,7 +87,7 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Preparing local storage for S3 backup (a temporary directory).</p>
<p>Preparing local storage for S3 backup.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">local_backup</span> <span class="o">=</span> <span class="s1">&#39;/tmp/vfs_sandbox/backup&#39;</span><span class="o">.</span><span class="n">to_dir</span><span class="o">.</span><span class="n">destroy</span></pre></div>
Expand Down
4 changes: 2 additions & 2 deletions docs/s3/backup.rb
Expand Up @@ -25,5 +25,5 @@
s3['app'].copy_to local_backup['app']
p local_backup['app/files/bos.png'].exist? # => true

# [vfs]: http://alexeypetrushin.github.com/vfs/basics.html
# [s3_sandbox]: http://alexeypetrushin.github.com/vfs/s3/sandbox.html
# [vfs]: ..
# [s3_sandbox]: sandbox.html
8 changes: 4 additions & 4 deletions docs/s3/basics.html
Expand Up @@ -34,9 +34,9 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Example of <a href="http://alexeypetrushin.github.com/vfs/basics.html">Virtual File System</a> working with AWS S3.</p>
<p>Example of <a href="..">Virtual File System</a> working with AWS S3.</p>

<p>This is exactly the same <a href="http://alexeypetrushin.github.com/vfs/basics.html">basic example</a> but this time
<p>This is exactly the same <a href="../basics.html">basic example</a> but this time
we using S3 as storage instead of local file system.</p>
</td>
<td class=code>
Expand All @@ -60,7 +60,7 @@
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Connecting to S3 and preparing sandbox. You may take a look at
the <a href="http://alexeypetrushin.github.com/vfs/s3/sandbox.html">docs/s3/sandbox.rb</a> to see the actual code.</p>
the <a href="sandbox.html">docs/s3/sandbox.rb</a> to see the actual code.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;docs/s3/sandbox&#39;</span></pre></div>
Expand All @@ -71,7 +71,7 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Now we just executig <a href="http://alexeypetrushin.github.com/vfs/basics.html">basic example</a>
<p>Now we just executig <a href="../basics.html">basic example</a>
but with the <code>$storage</code> set to AWS S3.</p>
</td>
<td class=code>
Expand Down
6 changes: 3 additions & 3 deletions docs/s3/basics.rb
Expand Up @@ -14,6 +14,6 @@
# but with the `$storage` set to AWS S3.
require 'docs/basics'

# [vfs]: http://alexeypetrushin.github.com/vfs/basics.html
# [basics]: http://alexeypetrushin.github.com/vfs/basics.html
# [s3_sandbox]: http://alexeypetrushin.github.com/vfs/s3/sandbox.html
# [vfs]: ..
# [basics]: ../basics.html
# [s3_sandbox]: sandbox.html
2 changes: 1 addition & 1 deletion docs/s3/sandbox.html
Expand Up @@ -34,7 +34,7 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Example of using AWS S3 as a storage for <a href="http://alexeypetrushin.github.com/vfs/basics.html">Virtual File System</a></p>
<p>Example of using AWS S3 as a storage for <a href="..">Virtual File System</a></p>
</td>
<td class=code>
<div class='highlight'><pre></pre></div>
Expand Down
2 changes: 1 addition & 1 deletion docs/s3/sandbox.rb
Expand Up @@ -21,4 +21,4 @@
# for sandbox and cleaning it before starting.
$sandbox = box['/tmp/vfs_sandbox'].to_dir.destroy

# [vfs]: http://alexeypetrushin.github.com/vfs/basics.html
# [vfs]: ..
8 changes: 4 additions & 4 deletions docs/ssh/basics.html
Expand Up @@ -34,9 +34,9 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Example of <a href="http://alexeypetrushin.github.com/vfs/basics.html">Virtual File System</a> working with SFTP.</p>
<p>Example of <a href="..">Virtual File System</a> working with SFTP.</p>

<p>This is exactly the same <a href="http://alexeypetrushin.github.com/vfs/basics.html">basic example</a> but this time
<p>This is exactly the same <a href="../basics.html">basic example</a> but this time
we using SFTP as storage instead of local file system.</p>
</td>
<td class=code>
Expand All @@ -60,7 +60,7 @@
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Connecting to SFTP and preparing sandbox. You may take a look at
the <a href="http://alexeypetrushin.github.com/vfs/ssh/sandbox.html">docs/ssh/sandbox.rb</a> to see the actual code.</p>
the <a href="sandbox.html">docs/ssh/sandbox.rb</a> to see the actual code.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;docs/ssh/sandbox&#39;</span></pre></div>
Expand All @@ -71,7 +71,7 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Now we just executig <a href="http://alexeypetrushin.github.com/vfs/basics.html">basic example</a>
<p>Now we just executig <a href="../basics.html">basic example</a>
but with the <code>$storage</code> set to SFTP.</p>
</td>
<td class=code>
Expand Down
6 changes: 3 additions & 3 deletions docs/ssh/basics.rb
Expand Up @@ -14,6 +14,6 @@
# but with the `$storage` set to SFTP.
require 'docs/basics'

# [vfs]: http://alexeypetrushin.github.com/vfs/basics.html
# [basics]: http://alexeypetrushin.github.com/vfs/basics.html
# [ssh_sandbox]: http://alexeypetrushin.github.com/vfs/ssh/sandbox.html
# [vfs]: ..
# [basics]: ../basics.html
# [ssh_sandbox]: sandbox.html
54 changes: 39 additions & 15 deletions docs/ssh/deployment.html
Expand Up @@ -34,46 +34,71 @@
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<p>Example of Application Deployment using <a href="..">Virtual File System</a>.</p>

<p>In this example we uploading sample app files to remote server,
write database configuration file and restart the server on remote machine.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="vg">$LOAD_PATH</span> <span class="o">&lt;&lt;</span> <span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="bp">__FILE__</span><span class="si">}</span><span class="s2">/../../..&quot;</span><span class="p">)</span>

<span class="nb">require</span> <span class="s1">&#39;docs/ssh/sandbox&#39;</span>
<span class="n">sandbox</span> <span class="o">=</span> <span class="vg">$sandbox</span></pre></div>
<div class='highlight'><pre></pre></div>
</td>
</tr>
<tr id='section-2'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-2">&#182;</a>
</div>
<p>Preparing sample files.</p>
<p>Adding examples folder to load paths.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">current_dir</span> <span class="o">=</span> <span class="bp">__FILE__</span><span class="o">.</span><span class="n">to_entry</span><span class="o">.</span><span class="n">parent</span>
<span class="n">sample_app</span> <span class="o">=</span> <span class="n">current_dir</span><span class="o">[</span><span class="s1">&#39;deployment/app&#39;</span><span class="o">]</span></pre></div>
<div class='highlight'><pre><span class="vg">$LOAD_PATH</span> <span class="o">&lt;&lt;</span> <span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="bp">__FILE__</span><span class="si">}</span><span class="s2">/../../..&quot;</span><span class="p">)</span></pre></div>
</td>
</tr>
<tr id='section-3'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<p>Copying app to remote machine.</p>
<p>Connecting to SFTP and preparing sandbox. You may take a look at
the <a href="sandbox.html">docs/ssh/sandbox.rb</a> to see the actual code.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;docs/ssh/sandbox&#39;</span>
<span class="n">sandbox</span> <span class="o">=</span> <span class="vg">$sandbox</span></pre></div>
</td>
</tr>
<tr id='section-4'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-4">&#182;</a>
</div>
<p>Preparing sample files located in our local folder in
current directory.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">current_dir</span> <span class="o">=</span> <span class="bp">__FILE__</span><span class="o">.</span><span class="n">to_entry</span><span class="o">.</span><span class="n">parent</span>
<span class="n">sample_app</span> <span class="o">=</span> <span class="n">current_dir</span><span class="o">[</span><span class="s1">&#39;deployment/app&#39;</span><span class="o">]</span></pre></div>
</td>
</tr>
<tr id='section-5'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-5">&#182;</a>
</div>
<p>Copying application files to remote machine.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">app</span> <span class="o">=</span> <span class="n">sandbox</span><span class="o">[</span><span class="s1">&#39;apps/app&#39;</span><span class="o">]</span>
<span class="n">sample_app</span><span class="o">.</span><span class="n">copy_to</span> <span class="n">app</span>
<span class="nb">p</span> <span class="n">app</span><span class="o">[</span><span class="s1">&#39;app.rb&#39;</span><span class="o">].</span><span class="n">exist?</span> <span class="c1"># =&gt; true</span></pre></div>
</td>
</tr>
<tr id='section-4'>
<tr id='section-6'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-4">&#182;</a>
<a class="pilcrow" href="#section-6">&#182;</a>
</div>
<p>Configuring.</p>
<p>Writing database configuration file.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="n">config</span> <span class="o">=</span> <span class="n">app</span><span class="o">[</span><span class="s1">&#39;config.yml&#39;</span><span class="o">]</span>
Expand All @@ -82,13 +107,12 @@
<span class="nb">p</span> <span class="n">app</span><span class="o">[</span><span class="s1">&#39;config.yml&#39;</span><span class="o">].</span><span class="n">exist?</span> <span class="c1"># =&gt; true</span></pre></div>
</td>
</tr>
<tr id='section-5'>
<tr id='section-7'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-5">&#182;</a>
<a class="pilcrow" href="#section-7">&#182;</a>
</div>
<p>Running</p>

<p>Updating gems and restarting the server.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">p</span> <span class="n">app</span><span class="o">.</span><span class="n">bash</span><span class="p">(</span><span class="s2">&quot;echo &#39;bundle install&#39;&quot;</span><span class="p">)</span> <span class="c1"># =&gt; bundle install</span>
Expand Down
22 changes: 17 additions & 5 deletions docs/ssh/deployment.rb
@@ -1,23 +1,35 @@
# Example of Application Deployment using [Virtual File System][vfs].
#
# In this example we uploading sample app files to remote server,
# write database configuration file and restart the server on remote machine.

# Adding examples folder to load paths.
$LOAD_PATH << File.expand_path("#{__FILE__}/../../..")

# Connecting to SFTP and preparing sandbox. You may take a look at
# the [docs/ssh/sandbox.rb][ssh_sandbox] to see the actual code.
require 'docs/ssh/sandbox'
sandbox = $sandbox

# Preparing sample files.
# Preparing sample files located in our local folder in
# current directory.
current_dir = __FILE__.to_entry.parent
sample_app = current_dir['deployment/app']

# Copying app to remote machine.
# Copying application files to remote machine.
app = sandbox['apps/app']
sample_app.copy_to app
p app['app.rb'].exist? # => true

# Configuring.
# Writing database configuration file.
config = app['config.yml']
config.write "database: mysql"
config.append "name: app_production"
p app['config.yml'].exist? # => true

# Running
# Updating gems and restarting the server.
p app.bash("echo 'bundle install'") # => bundle install
p app.bash("echo 'server start'") # => server start
p app.bash("echo 'server start'") # => server start

# [vfs]: ..
# [ssh_sandbox]: sandbox.html

0 comments on commit c477785

Please sign in to comment.