Skip to content
This repository
Browse code

Roll 0.4.1 and update README with application examples.

  • Loading branch information...
commit 9bffad453aae1bd2a8c940c0c476045d898a31b0 1 parent e6e4a17
Sean Cribbs authored

Showing 2 changed files with 32 additions and 13 deletions. Show diff stats Hide diff stats

  1. +31 12 README.md
  2. +1 1  lib/webmachine/version.rb
43 README.md
Source Rendered
@@ -29,12 +29,17 @@ application for it!
29 29 require 'webmachine'
30 30 # Require any of the files that contain your resources here
31 31 require 'my_resource'
32   -
33   -# Point all URIs at the MyResource class
34   -Webmachine::Dispatcher.add_route(['*'], MyResource)
35   -
  32 +
  33 +# Create an application which encompasses routes and configruation
  34 +MyApp = Webmachine::Application.new do |app|
  35 + app.routes do
  36 + # Point all URIs at the MyResource class
  37 + add ['*'], MyResource
  38 + end
  39 +end
  40 +
36 41 # Start the server, binds to port 8080 using WEBrick
37   -Webmachine.run
  42 +MyApp.run
38 43 ```
39 44
40 45 Your resource will look something like this:
@@ -68,29 +73,31 @@ end
68 73 There are many other HTTP features exposed to your resource through
69 74 {Webmachine::Resource::Callbacks}. Give them a try!
70 75
71   -### Configurator
  76 +### Application/Configurator
72 77
73 78 There's a configurator that allows you to set the ip address and port
74 79 bindings as well as a different webserver adapter. You can also add
75   -your routes in a block. Both of these call return the `Webmachine`
76   -module, so you could chain them if you like.
  80 +your routes in a block (as shown above). Both of these call return the
  81 +`Webmachine::Application` instance, so you could chain them if you
  82 +like. If you don't want to create your own separate application
  83 +object, `Webmachine.application` will return a global one.
77 84
78 85 ```ruby
79 86 require 'webmachine'
80 87 require 'my_resource'
81 88
82   -Webmachine.routes do
  89 +Webmachine.application.routes do
83 90 add ['*'], MyResource
84 91 end
85 92
86   -Webmachine.configure do |config|
  93 +Webmachine.application.configure do |config|
87 94 config.ip = '127.0.0.1'
88 95 config.port = 3000
89 96 config.adapter = :Mongrel
90 97 end
91 98
92 99 # Start the server.
93   -Webmachine.run
  100 +Webmachine.application.run
94 101 ```
95 102
96 103 ## Features
@@ -115,7 +122,19 @@ Webmachine.run
115 122
116 123 ## Changelog
117 124
118   -### 0.4.0 February 2, 2012
  125 +### 0.4.1 February 8, 2012
  126 +
  127 +0.4.1 is a bugfix release that corrects a few minor issues. Added Sam
  128 +Goldman as a contributor. Thank you for your contributions!
  129 +
  130 +* Updated README with `Webmachine::Application` examples.
  131 +* The CGI env vars `CONTENT_LENGTH` and `CONTENT_TYPE` are now being
  132 + correctly converted into their Webmachine equivalents.
  133 +* The request body given via the Rack and Mongrel adapters now
  134 + responds to `#to_s` and `#each` so it can be treated like a `String`
  135 + or `Enumerable` that yields chunks.
  136 +
  137 +### 0.4.0 February 5, 2012
119 138
120 139 0.4.0 includes some important refactorings, isolating the idea of
121 140 global state into an Application object with its own Dispatcher and
2  lib/webmachine/version.rb
... ... @@ -1,6 +1,6 @@
1 1 module Webmachine
2 2 # Library version
3   - VERSION = "0.4.0"
  3 + VERSION = "0.4.1"
4 4
5 5 # String for use in "Server" HTTP response header, which includes
6 6 # the {VERSION}.

0 comments on commit 9bffad4

Please sign in to comment.
Something went wrong with that request. Please try again.