Neocitizen is composed of two parts:
- A Ruby wrapper for the Neocities API, and
- A tool to create and publish Neocities sites from the command line.
gem install neocitizen
Creating a new site with the
neocitizen SITENAME to generate a skeleton for a new site. That gives you a directory structure like this:
my-cool-site ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── Rakefile └── content └── index.html
content directory will contain all the files the will be uploaded to your site. Neocitizen will use Git to determine what files should be uploaded in order to minimize bandwidth usage.
Publishing your site
When you're ready to publish your site to Neocities, simply run
rake publish from inside your project directory.
Neocitizen will use Git to determine which
content files were changed in your most recent commit and only upload those. If you have uncommitted changes, Neocitizen will warn you about this and stop to let you clean up.
The API client
If you want to build your own tools around the Neocities API, you can use the
Neocitizen::Client class to do so.
Creating a new API client is easy:
require 'neocitizen' client = Neocitizen::Client.new(username: "my-cool-site", password: "abc123")
You can also set the
NEOCITIZEN_PASSWORD environment variables instead of passing them as options to the constructor.
To upload files to your site, use the
upload method on a client object.
upload takes a list of file names relative to your
pwd and uploads all of them:
- Fork it ( https://github.com/aergonaut/neocitizen/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
Running and writing new tests
Neocitizen uses VCR to record and playback HTTP requests during tests. These cassettes are stored in the
spec/cassettes folder. If you're not recording new cassettes, you don't need to worry about anything and can run the specs with
Neocitizen uses environment variables to store credentials used in testing. Here is the full list of environment variables for testing Neocitizen:
||Neocities username (preferably one created specifically for testing)|
||Password for test username|
Supported Ruby versions
This library is tested against the following versions of Ruby:
- Ruby 1.9.2
- Ruby 1.9.3
- Ruby 2.0.0
- Ruby 2.1.0
If something doesn't work in one of these versions, then it is a bug. This library may work inadvertently in other Ruby implementations, but support will only be provided for the versions listed.
This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:
spec.add_dependency 'neocitizen', '~> 0.0.1'
Neocitizen is made by @aergonaut.
The MIT License (MIT)
Copyright (c) 2014 Chris Fung
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.