# Socks [![Build Status](https://secure.travis-ci.org/Beakr/socks.png)](http://travis-ci.org/Beakr/socks) [![Dependency Status](https://gemnasium.com/Beakr/socks.png)](https://gemnasium.com/Beakr/socks) Socks is a web framework and Ruby library supported by Rack for making complex or very simple webapps fast. ## Why Socks? Socks is as simple as [Sinatra](), yet as complex/powerful as [Rails](). The goal is to be able to write a simple app quickly, and still retain enough power to keep complex/powerful apps going. ## Installation Choose the one that fits your need: ```sh $ gem install socks --pre # General, global install + command-line app ``` ```ruby gem 'socks' # For Gemfiles gem.add_dependency "socks" # For your Gemspec ``` ## Quick Start First, create a new Socks app using: ```sh $ socks new myapp $ cd myapp ``` Next, go to `config/router.rb` and paste in the following between the `Router = HttpROuter.new do ... end` statement: ```ruby get('/') { |env| [200, {'Content-type' => 'text/plain'}, ['This is my first Socks app!']] } ``` Afterward, use: ```sh $ socks start ``` To spin up a web server on `localhost:4000`. Take a look, you should see the following text appear in your web browser: This is my first Socks app! ## Adding tests for Socks apps Socks comes with built-in support for RSpec matchers and DSL. It also comes with a built-in `spec_helper.rb` in the `spec/`directory. Paste in the following to test the simple Socks app in the quickstart: ```ruby require 'spec_helper' require File.expand_path("../../config/router.rb", __FILE__) describe Myapp::Router do let(:request) { Rack::MockRequest.new(Myapp::Router) } it 'returns something at /' do request.get('/').should == "This is my first Socks app!" end end end ``` ## Contributing 1. Fork it 2. Create your feature branch `(git checkout -b my-new-feature)` 3. Commit your changes `(git commit -am 'Added some feature')` 4. Push to the branch `(git push origin my-new-feature)` 5. Create new Pull Request ## License See LICENSE (MIT). [More on MIT »](http://www.opensource.org/licenses/MIT) ## TODO See TODO.md ## Thanks I'd like to thank [Sickill](https://github.com/sickill) for his amazing Rack web framework tutorial. Without it, it would be a much harder time getting Socks to work! ### *Thanks for using Socks!*