Community Zero
Description
Based largely off of Chef Zero, Community Zero is an in-memory Chef Community Site that can be useful for testing. It IS intended to be simple, API compliant, easy to run and test. It is NOT intended to be secure, scalable, performant, scalable, persistent, or production-ready. It does not authentication or authorization (it will never throw a 400, 401, or 403). It does not persist data.
Because Community Zero run in memory, it's super fast and lightweight. This makes it perfect for testing against a "real" Community Site without mocking the entire Internet.
Installation
The server can be installed as a Ruby Gem:
$ gem install community-zero
If you're using bundler, add community-zero as a development dependency:
group :development do
gem 'community-zero'
end
Or in a .gemspec:
s.add_development_dependency 'community-zero'
You can also clone the source repository and install it using rake install.
Usage
The primary use is an in-memory fake Community site for testing. Here's a simple example:
require 'community_zero/server'
server = CommunityZero::Server.new(port: 3000)
server.start
This will create a server instance in the foreground. To stop the server:
server.stop
This is great for debugging and logging requests, but you'll probably want to run this in the background so you have full control of your thread.
To run Community Zero in the background, simply issue the start_background command:
require 'community_zero/server'
server = CommunityZero::Server.new(port: 4000)
server.start_background
You can stop the server the same way:
server.stop
Valid Options
You may currently pass the following options to the initializer:
host- the host to run on (Default: 0.0.0.0)port- the port to run on (Default: 3000)debug- run in debug mode to see all requests and responses (Default: false)
CLI (Command Line)
If you don't want to use Community Zero as a library, you can start it using the included executable:
$ community-zero
Note, this will run in the foreground.
Run community-zero --help to see a list of the supported flags and options:
Usage: community-zero [ARGS]
-H, --host HOST Host to bind to (default: 0.0.0.0)
-p, --port PORT Port to listen on
-d, --debug Show requests and debugging output
-h, --help Show this message
--version Show version
License and Copyright
- Copyright 2013 Seth Vargo
- Copyright 2013 Opscode, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

