neocities/views/cli.erb
2017-05-26 15:17:26 -07:00

77 lines
3 KiB
Text

<div class="header-Outro">
<div class="row content single-Col">
<h1>The Neocities CLI</h1>
<h2 class="subtitle">Manage your site using a shell terminal</h2>
</div>
</div>
<div class="content single-Col misc-page">
<article role="article">
<p>Neocities has a CLI for power users that want to upload sites using a command line.</p>
<h2>Features</h2>
<ul>
<li><strong>Push support</strong> - uploads an entire directory. Great for static site generators.
<li><strong>HTTP persistence</strong> - the CLI reuses a single HTTP connection, improving performance.
<li><strong>Check before upload</strong> - checks if the file data matches before uploading.
<li><strong>Gitignore parsing</strong> - automatically skips files in root gitignore file for git repositories.
</ul>
<h2>Install Instructions</h2>
<p>If you're using a newer version of OSX or already have <a href="https://www.ruby-lang.org/">Ruby</a> installed, just run this command to install:</p>
<code>gem install neocities</code>
<p>If you get a permission error, you may need to run the command as superuser:</p>
<code>sudo gem install neocities</code>
<p>After installation, just run the command to get started:</p>
<pre>$ neocities
|\---/|
| o_o | Neocities
\_-_/
Subcommands:
push Recursively upload a local directory to your site
upload Upload individual files to your Neocities site
delete Delete files from your Neocities site
list List files from your Neocities site
info Information and stats for your site
logout Remove the site api key from the config</pre>
<h2>Windows</h2>
<p>If you're using Windows, you can install ruby with something like the <a href="https://rubyinstaller.org/">Ruby Installer</a>, and then run the above command.</p>
<h2>Linux / BSD</h2>
<p>Most Linux / BSD distributions come with Ruby packages. For example, with Ubuntu:</p>
<code>sudo apt-get install ruby-full</code>
A full list of available install options for ruby is <a href="https://www.ruby-lang.org/en/documentation/installation/">here</a>.
<a id="githooks"></a>
<h2>Git Hooks</h2>
<p>
If you want to create a git hook to automatically upload your site to Neocities when you run "git push", you can
run this command in the root directory of your git repo:
</p>
<pre>printf '#!/bin/sh\nneocities push .' >.git/hooks/pre-push && \
chmod u+x .git/hooks/pre-push</pre>
<p>If the files you're pushing are in a subdirectory of the root git repo, replace the "." with the subdirectory. For example, with Jekyll (which typically uses <strong>_site</strong>):</p>
<pre>printf '#!/bin/sh\nneocities push _site' >.git/hooks/pre-push && \
chmod u+x .git/hooks/pre-push</pre>
<p>Note: You will need to be logged in for the git hook to work, so run "neocities push" on the directory you want to upload before installing this hook. This will be fixed in a later version of the CLI.</p>
</article>
</div>