webmachine 1.2.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/CHANGELOG.md +57 -0
- data/Gemfile +20 -15
- data/README.md +89 -91
- data/RELEASING.md +21 -0
- data/Rakefile +5 -21
- data/documentation/adapters.md +41 -0
- data/documentation/authentication-and-authorization.md +37 -0
- data/documentation/configurator.md +19 -0
- data/documentation/error-handling.md +86 -0
- data/documentation/examples.md +224 -0
- data/documentation/how-it-works.md +76 -0
- data/documentation/routes.md +112 -0
- data/documentation/validation.md +159 -0
- data/documentation/versioning-apis.md +74 -0
- data/documentation/visual-debugger.md +38 -0
- data/examples/application.rb +2 -2
- data/examples/debugger.rb +1 -1
- data/lib/webmachine.rb +3 -1
- data/lib/webmachine/adapter.rb +7 -13
- data/lib/webmachine/adapters.rb +1 -2
- data/lib/webmachine/adapters/httpkit.rb +74 -0
- data/lib/webmachine/adapters/lazy_request_body.rb +1 -2
- data/lib/webmachine/adapters/rack.rb +70 -25
- data/lib/webmachine/adapters/rack_mapped.rb +42 -0
- data/lib/webmachine/adapters/reel.rb +22 -23
- data/lib/webmachine/adapters/webrick.rb +16 -16
- data/lib/webmachine/application.rb +2 -2
- data/lib/webmachine/chunked_body.rb +3 -4
- data/lib/webmachine/configuration.rb +1 -1
- data/lib/webmachine/constants.rb +75 -0
- data/lib/webmachine/decision/conneg.rb +12 -10
- data/lib/webmachine/decision/flow.rb +42 -32
- data/lib/webmachine/decision/fsm.rb +14 -21
- data/lib/webmachine/decision/helpers.rb +10 -38
- data/lib/webmachine/dispatcher.rb +13 -10
- data/lib/webmachine/dispatcher/route.rb +45 -9
- data/lib/webmachine/errors.rb +9 -3
- data/lib/webmachine/events.rb +2 -2
- data/lib/webmachine/header_negotiation.rb +25 -0
- data/lib/webmachine/headers.rb +8 -3
- data/lib/webmachine/locale/en.yml +7 -5
- data/lib/webmachine/media_type.rb +10 -8
- data/lib/webmachine/request.rb +67 -26
- data/lib/webmachine/rescueable_exception.rb +62 -0
- data/lib/webmachine/resource.rb +1 -1
- data/lib/webmachine/resource/callbacks.rb +11 -9
- data/lib/webmachine/response.rb +3 -5
- data/lib/webmachine/spec/IO_response.body +1 -0
- data/lib/webmachine/spec/adapter_lint.rb +83 -37
- data/lib/webmachine/spec/test_resource.rb +15 -4
- data/lib/webmachine/streaming/fiber_encoder.rb +1 -5
- data/lib/webmachine/streaming/io_encoder.rb +7 -1
- data/lib/webmachine/trace.rb +1 -0
- data/lib/webmachine/trace/fsm.rb +20 -10
- data/lib/webmachine/trace/resource_proxy.rb +2 -0
- data/lib/webmachine/translation.rb +2 -1
- data/lib/webmachine/version.rb +3 -3
- data/memory_test.rb +37 -0
- data/spec/spec_helper.rb +17 -9
- data/spec/webmachine/adapter_spec.rb +14 -15
- data/spec/webmachine/adapters/httpkit_spec.rb +10 -0
- data/spec/webmachine/adapters/rack_mapped_spec.rb +71 -0
- data/spec/webmachine/adapters/rack_spec.rb +32 -6
- data/spec/webmachine/adapters/reel_spec.rb +16 -12
- data/spec/webmachine/adapters/webrick_spec.rb +2 -2
- data/spec/webmachine/application_spec.rb +18 -17
- data/spec/webmachine/chunked_body_spec.rb +3 -3
- data/spec/webmachine/configuration_spec.rb +5 -5
- data/spec/webmachine/cookie_spec.rb +13 -13
- data/spec/webmachine/decision/conneg_spec.rb +49 -43
- data/spec/webmachine/decision/falsey_spec.rb +4 -4
- data/spec/webmachine/decision/flow_spec.rb +195 -145
- data/spec/webmachine/decision/fsm_spec.rb +81 -19
- data/spec/webmachine/decision/helpers_spec.rb +20 -20
- data/spec/webmachine/dispatcher/rfc3986_percent_decode_spec.rb +22 -0
- data/spec/webmachine/dispatcher/route_spec.rb +114 -32
- data/spec/webmachine/dispatcher_spec.rb +49 -24
- data/spec/webmachine/errors_spec.rb +1 -1
- data/spec/webmachine/etags_spec.rb +19 -19
- data/spec/webmachine/events_spec.rb +6 -6
- data/spec/webmachine/headers_spec.rb +14 -14
- data/spec/webmachine/media_type_spec.rb +36 -36
- data/spec/webmachine/request_spec.rb +70 -39
- data/spec/webmachine/rescueable_exception_spec.rb +15 -0
- data/spec/webmachine/resource/authentication_spec.rb +6 -6
- data/spec/webmachine/response_spec.rb +18 -12
- data/spec/webmachine/trace/fsm_spec.rb +8 -8
- data/spec/webmachine/trace/resource_proxy_spec.rb +9 -9
- data/spec/webmachine/trace/trace_store_spec.rb +5 -5
- data/spec/webmachine/trace_spec.rb +3 -3
- data/webmachine.gemspec +2 -6
- metadata +78 -228
- data/lib/webmachine/adapters/hatetepe.rb +0 -108
- data/lib/webmachine/adapters/mongrel.rb +0 -127
- data/lib/webmachine/dispatcher/not_found_resource.rb +0 -5
- data/lib/webmachine/fiber18.rb +0 -88
- data/spec/webmachine/adapters/hatetepe_spec.rb +0 -60
- data/spec/webmachine/adapters/mongrel_spec.rb +0 -16
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: edddc1a3a4d7be22971484644cbf1bece06b2ba0f95ab5c8a3ed08cf485982b2
|
|
4
|
+
data.tar.gz: 4a1e642ad3fb3a1a57e8eee886393802f7b85f8ecb81bf9f06812577fe253840
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 89062ab939aadad0f1a41d3c3b85d030acf0e4668b5d06b0c65ad4a4425284bdaf60ece3af7e76f2b9eacc02cf2052f657cfb491372fef62463dad4324933617
|
|
7
|
+
data.tar.gz: 0a6078e13d68abaa7692675f5057e3b69d06dd5311d6e662a176490f427b6d1a1053bd3e5e0ed82fa9536eab421f05285e54939a2c900ca364347a361c21b21a
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
### HEAD
|
|
2
|
+
|
|
3
|
+
### 1.6.0 June 22, 2021
|
|
4
|
+
|
|
5
|
+
* fix: replace missed URI.decode with new Route.rfc3986_percent_decode (#261)
|
|
6
|
+
* fix: implement rfc3986 Percent-Encoding decoder
|
|
7
|
+
* feat: make rack env available on the webmachine request when using a rack adapter
|
|
8
|
+
|
|
9
|
+
### 1.5.0 September 8, 2017
|
|
10
|
+
|
|
11
|
+
* Removed Fixnum/Integer deprecation warnings in Ruby 2.4
|
|
12
|
+
* Fixed multiple cookie setting code
|
|
13
|
+
* Added support for named captures
|
|
14
|
+
* Improved logic for determining which errors are 'rescuable' by Webmachine,
|
|
15
|
+
and which are 'unhandlable'.
|
|
16
|
+
|
|
17
|
+
### 1.4.0 March 20, 2015
|
|
18
|
+
|
|
19
|
+
* Added RackMapped adapter which allows Webmachine apps to be mounted
|
|
20
|
+
at a non-root path using Rack::Map.
|
|
21
|
+
Thanks to [Julian Doherty](https://github.com/madlep) for writing this.
|
|
22
|
+
|
|
23
|
+
### 1.3.1 January 15, 2015
|
|
24
|
+
|
|
25
|
+
* Fixed URI construction, including handling IPv6 addresses, when the
|
|
26
|
+
adapter did not supply a complete hostname.
|
|
27
|
+
* Removed dependency of Rack Adapter on REQUEST_INFO rack environment
|
|
28
|
+
variable which was not always present.
|
|
29
|
+
* Use IPAddr instead of Addrinfo as rbx does not support Addrinfo.
|
|
30
|
+
|
|
31
|
+
### 1.3.0 January 3, 2015
|
|
32
|
+
|
|
33
|
+
1.3.0 is a feature and bugfix release that removes two adapters,
|
|
34
|
+
reduces memory usage, fixes bugs, and includes a bunch of new
|
|
35
|
+
documentation. Thank you to our new contributor @rpag!
|
|
36
|
+
|
|
37
|
+
* Greatly reduced per-request garbage by freezing commonly used
|
|
38
|
+
Strings and Regexps into constants.
|
|
39
|
+
* Tutorial/example documentation was extracted from the README and
|
|
40
|
+
extended in the `documentation` directory.
|
|
41
|
+
* HTTPkit adapter was added.
|
|
42
|
+
* Hatetepe and Mongrel adapters were removed and adapters no longer
|
|
43
|
+
install interrupt handlers.
|
|
44
|
+
* The "splat" matcher in path specifications is now a Symbol `:*`
|
|
45
|
+
rather than a String `"*"`. Using the String version will result in
|
|
46
|
+
a deprecation warning.
|
|
47
|
+
* Requests with If-None-Match where the resource does not supply an
|
|
48
|
+
ETag will no longer respond with 412 or 500, but follow the success
|
|
49
|
+
path.
|
|
50
|
+
* Path fragments are now decoded.
|
|
51
|
+
* Simplified the interaction between the decision FSM and tracing.
|
|
52
|
+
* Updated specs to use RSpec 3.
|
|
53
|
+
* Improved handling of IO.copy_stream on Rack servers.
|
|
54
|
+
* Updated the Reel adapter.
|
|
55
|
+
* Exposed Application instance to the Adapter.
|
|
56
|
+
* Decode the value of the header 'Content-MD5' as base64-encoded string.
|
|
57
|
+
|
|
1
58
|
### 1.2.2 January 8, 2014
|
|
2
59
|
|
|
3
60
|
1.2.2 is a bugfix/patch release that expands functionality with some edge
|
data/Gemfile
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
require 'rbconfig'
|
|
2
|
-
|
|
3
2
|
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
3
|
gemspec
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
group :development do
|
|
6
|
+
gem "yard", "~> 0.9"
|
|
7
|
+
gem "rake", "~> 12.0"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
group :test do
|
|
11
|
+
gem "rspec", "~> 3.0", ">= 3.6.0"
|
|
12
|
+
gem "rspec-its", "~> 1.2"
|
|
13
|
+
gem "rack", "~> 2.0"
|
|
14
|
+
gem "rack-test", "~> 0.7"
|
|
15
|
+
gem "websocket_parser", "~>1.0"
|
|
16
|
+
end
|
|
8
17
|
|
|
9
18
|
group :webservers do
|
|
10
|
-
gem '
|
|
11
|
-
gem '
|
|
12
|
-
gem '
|
|
19
|
+
gem 'reel', '~> 0.5.0'
|
|
20
|
+
gem 'http', '~> 0.6.0'
|
|
21
|
+
gem 'celluloid', '0.17.4' # Refactors in 0.18.0 break the tests
|
|
22
|
+
gem 'httpkit', :platform => [:mri, :rbx]
|
|
13
23
|
end
|
|
14
24
|
|
|
15
25
|
group :guard do
|
|
16
|
-
gem 'guard-rspec'
|
|
26
|
+
gem 'guard-rspec', '~> 4.7'
|
|
17
27
|
case RbConfig::CONFIG['host_os']
|
|
18
28
|
when /darwin/
|
|
19
|
-
gem 'rb-fsevent'
|
|
29
|
+
gem 'rb-fsevent', '~> 0.10'
|
|
20
30
|
# gem 'growl_notify'
|
|
21
|
-
gem 'growl'
|
|
31
|
+
gem 'growl', '~> 1.0'
|
|
22
32
|
when /linux/
|
|
23
33
|
gem 'rb-inotify'
|
|
24
34
|
gem 'libnotify'
|
|
@@ -27,15 +37,10 @@ end
|
|
|
27
37
|
|
|
28
38
|
group :docs do
|
|
29
39
|
platform :mri_19, :mri_20 do
|
|
30
|
-
gem 'redcarpet'
|
|
40
|
+
gem 'redcarpet', '~> 3.4'
|
|
31
41
|
end
|
|
32
42
|
end
|
|
33
43
|
|
|
34
44
|
platforms :jruby do
|
|
35
45
|
gem 'jruby-openssl'
|
|
36
46
|
end
|
|
37
|
-
|
|
38
|
-
platform :rbx do
|
|
39
|
-
gem 'rubysl'
|
|
40
|
-
gem 'racc'
|
|
41
|
-
end
|
data/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
# webmachine for Ruby
|
|
1
|
+
# webmachine for Ruby
|
|
2
|
+
[](https://badge.fury.io/rb/webmachine)
|
|
3
|
+
[](https://travis-ci.org/webmachine/webmachine-ruby)
|
|
2
4
|
|
|
3
5
|
webmachine-ruby is a port of
|
|
4
6
|
[Webmachine](https://github.com/basho/webmachine), which is written in
|
|
5
7
|
Erlang. The goal of both projects is to expose interesting parts of
|
|
6
8
|
the HTTP protocol to your application in a declarative way. This
|
|
7
|
-
means that you are less concerned with
|
|
8
|
-
more with describing
|
|
9
|
-
|
|
9
|
+
means that you are less concerned with the procedures involved in handling
|
|
10
|
+
requests directly and more with describing facts about the resources
|
|
11
|
+
that make up your application.
|
|
12
|
+
Webmachine is not a web framework _per se_, but more of a
|
|
10
13
|
toolkit for building HTTP-friendly applications. For example, it does
|
|
11
14
|
not provide a templating engine or a persistence layer; those choices
|
|
12
15
|
are up to you.
|
|
@@ -15,46 +18,34 @@ are up to you.
|
|
|
15
18
|
|
|
16
19
|
* Handles the hard parts of content negotiation, conditional
|
|
17
20
|
requests, and response codes for you.
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Supports WEBrick and Mongrel (1.2pre+), and a Rack shim. Other host
|
|
21
|
+
* Provides a base resource with points of extension to let you
|
|
22
|
+
describe what is relevant about your particular resource.
|
|
23
|
+
* Supports WEBrick, Reel, HTTPkit, and a Rack shim. Other host
|
|
22
24
|
servers are being investigated.
|
|
23
25
|
* Streaming/chunked response bodies are permitted as Enumerables,
|
|
24
26
|
Procs, or Fibers!
|
|
25
27
|
* Unlike the Erlang original, it does real Language negotiation.
|
|
26
|
-
* Includes
|
|
28
|
+
* Includes a visual debugger so you can look through the decision
|
|
27
29
|
graph to determine how your resources are behaving.
|
|
28
30
|
|
|
29
31
|
## Documentation & Finding Help
|
|
30
32
|
|
|
33
|
+
* [How it works](/documentation/how-it-works.md) - understand how Webmachine works and the basics of creating a resource.
|
|
34
|
+
* [Example resources][example-resources] showing how to implement each HTTP method.
|
|
35
|
+
* [Routes][routes]
|
|
36
|
+
* [Authentication and authorization][authentication-and-authorization]
|
|
37
|
+
* [Validation][validation]
|
|
38
|
+
* [Error handling][error-handling]
|
|
39
|
+
* [Visual debugger][visual-debugger]
|
|
40
|
+
* [Configurator][configurator]
|
|
41
|
+
* [Webserver adapters][adapters]
|
|
42
|
+
* [Versioning APIs][versioning-apis]
|
|
31
43
|
* [API documentation](http://rubydoc.info/gems/webmachine/frames/file/README.md)
|
|
32
44
|
* [Mailing list](mailto:webmachine.rb@librelist.com)
|
|
33
45
|
* IRC channel #webmachine on freenode
|
|
34
46
|
|
|
35
|
-
## A Note about Rack
|
|
36
|
-
|
|
37
|
-
In order to be compatible with popular deployment stacks,
|
|
38
|
-
Webmachine has a [Rack](https://github.com/rack/rack) adapter (thanks to Jamis Buck).
|
|
39
|
-
**n.b.:** We recommend that NO middleware is used. The
|
|
40
|
-
behaviors that are encapsulated in Webmachine assume that no modifications
|
|
41
|
-
are done to requests or response outside of Webmachine.
|
|
42
|
-
|
|
43
|
-
## A Note about MRI 1.9
|
|
44
|
-
|
|
45
|
-
The [Reel](https://github.com/celluloid/reel) and [Hatetepe](https://github.com/lgierth/hatetepe)
|
|
46
|
-
adapters might crash with a `SystemStackError` on MRI 1.9 due to its
|
|
47
|
-
limited fiber stack size. If your application is affected by this, the
|
|
48
|
-
only known solution is to switch to JRuby, Rubinius or MRI 2.0.
|
|
49
|
-
|
|
50
|
-
|
|
51
47
|
## Getting Started
|
|
52
48
|
|
|
53
|
-
[GiddyUp](https://github.com/basho/giddyup) is an actively
|
|
54
|
-
developed webmachine-ruby app that is in production. You
|
|
55
|
-
can look there for an example of how to write and structure a
|
|
56
|
-
webmachine-ruby app (although it is hacky in places).
|
|
57
|
-
|
|
58
49
|
Below we go through some examples of how to do basic things
|
|
59
50
|
with webmachine-ruby.
|
|
60
51
|
|
|
@@ -71,8 +62,11 @@ There are many other HTTP features exposed to a resource through
|
|
|
71
62
|
of the decision tree Webmachine implements, and the decision tree
|
|
72
63
|
is what makes Webmachine unique and powerful.
|
|
73
64
|
|
|
65
|
+
### A simple static HTML resource
|
|
66
|
+
|
|
74
67
|
```ruby
|
|
75
68
|
require 'webmachine'
|
|
69
|
+
|
|
76
70
|
class MyResource < Webmachine::Resource
|
|
77
71
|
def to_html
|
|
78
72
|
"<html><body>Hello, world!</body></html>"
|
|
@@ -83,6 +77,39 @@ end
|
|
|
83
77
|
MyResource.run
|
|
84
78
|
```
|
|
85
79
|
|
|
80
|
+
### A simple dynamic JSON Resource
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
require 'webmachine'
|
|
84
|
+
require 'widget'
|
|
85
|
+
|
|
86
|
+
class MyResource < Webmachine::Resource
|
|
87
|
+
|
|
88
|
+
# GET and HEAD are allowed by default, but are shown here for clarity.
|
|
89
|
+
def allowed_methods
|
|
90
|
+
['GET','HEAD']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def content_types_provided
|
|
94
|
+
[['application/json', :to_json]]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Return a Truthy or Falsey value
|
|
98
|
+
def resource_exists?
|
|
99
|
+
widget
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def widget
|
|
103
|
+
@widget ||= Widget.find(request.path_info[:id])
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def to_json
|
|
107
|
+
widget.to_json
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
|
|
86
113
|
### Router
|
|
87
114
|
|
|
88
115
|
The router is used to map a resource to a given path. To map the class `MyResource` to
|
|
@@ -97,92 +124,54 @@ end
|
|
|
97
124
|
Webmachine.application.run
|
|
98
125
|
```
|
|
99
126
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
There's a configurator that allows you to set what IP address and port
|
|
103
|
-
a web server should bind to as well as what web server should serve a
|
|
104
|
-
webmachine resource.
|
|
105
|
-
|
|
106
|
-
A call to `Webmachine::Application#configure` returns a `Webmachine::Application` instance,
|
|
107
|
-
so you could chain other method calls if you like. If you don't want to create your own separate
|
|
108
|
-
application object `Webmachine.application` will return a global one.
|
|
127
|
+
When the resource needs to be mapped with variables that will be passed into the resource, use symbols to identify which path components are variables.
|
|
109
128
|
|
|
110
129
|
```ruby
|
|
111
|
-
require 'webmachine'
|
|
112
|
-
require 'my_resource'
|
|
113
130
|
|
|
114
|
-
Webmachine.application.
|
|
115
|
-
|
|
116
|
-
config.port = 3000
|
|
117
|
-
config.adapter = :Mongrel
|
|
131
|
+
Webmachine.application.routes do
|
|
132
|
+
add ['myresource', :id], MyResource
|
|
118
133
|
end
|
|
119
134
|
|
|
120
|
-
# Start a web server to serve requests via localhost
|
|
121
|
-
Webmachine.application.run
|
|
122
135
|
```
|
|
123
136
|
|
|
124
|
-
|
|
125
|
-
[Reel][reel], and [Hatetepe][hatetepe]. Additionally, the [Rack][rack] adapter lets it
|
|
126
|
-
run on any webserver that provides a Rack interface. It also lets it run on
|
|
127
|
-
[Shotgun][shotgun] ([example][shotgun_example]).
|
|
128
|
-
|
|
129
|
-
[webrick]: http://rubydoc.info/stdlib/webrick
|
|
130
|
-
[mongrel]: https://github.com/evan/mongrel
|
|
131
|
-
[reel]: https://github.com/celluloid/reel
|
|
132
|
-
[hatetepe]: https://github.com/lgierth/hatetepe
|
|
133
|
-
[rack]: https://github.com/rack/rack
|
|
134
|
-
[shotgun]: https://github.com/rtomayko/shotgun
|
|
135
|
-
[shotgun_example]: https://gist.github.com/4389220
|
|
136
|
-
|
|
137
|
-
### Visual debugger
|
|
138
|
-
|
|
139
|
-
It can be hard to understand all of the decisions that Webmachine
|
|
140
|
-
makes when servicing a request to your resource, which is why we have
|
|
141
|
-
the "visual debugger". In development, you can turn on tracing of the
|
|
142
|
-
decision graph for a resource by implementing the `#trace?` callback
|
|
143
|
-
so that it returns true:
|
|
137
|
+
To add more components to the URL mapping, simply add them to the array.
|
|
144
138
|
|
|
145
139
|
```ruby
|
|
146
|
-
class MyTracedResource < Webmachine::Resource
|
|
147
|
-
def trace?
|
|
148
|
-
true
|
|
149
|
-
end
|
|
150
140
|
|
|
151
|
-
|
|
141
|
+
Webmachine.application.routes do
|
|
142
|
+
add ['myparentresource', :parent_id, 'myresource', :id], MyResource
|
|
152
143
|
end
|
|
144
|
+
|
|
153
145
|
```
|
|
154
146
|
|
|
155
|
-
|
|
156
|
-
configuration:
|
|
147
|
+
Read more about routing [here][routes].
|
|
157
148
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
end
|
|
164
|
-
```
|
|
149
|
+
### Application/Configurator
|
|
150
|
+
|
|
151
|
+
There is a configurator that allows you to set what IP address and port
|
|
152
|
+
a web server should bind to as well as what web server should serve a
|
|
153
|
+
webmachine resource. Learn how to configure your application [here][configurator].
|
|
165
154
|
|
|
166
|
-
Now when you visit your traced resource, a trace of the request
|
|
167
|
-
process will be recorded in memory. Open your browser to `/trace` to
|
|
168
|
-
list the recorded traces and inspect the result. The response from your
|
|
169
|
-
traced resource will also include the `X-Webmachine-Trace-Id` that you
|
|
170
|
-
can use to lookup the trace. It might look something like this:
|
|
171
155
|
|
|
172
|
-
|
|
156
|
+
### Adapters
|
|
173
157
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
Webmachine provides adapters for many popular webservers. Learn more [here][adapters].
|
|
159
|
+
|
|
160
|
+
### Visual debugger
|
|
161
|
+
|
|
162
|
+
It can be hard to understand all of the decisions that Webmachine
|
|
163
|
+
makes when servicing a request to your resource, which is why we have
|
|
164
|
+
the "visual debugger". Learn how to configure it [here][visual-debugger].
|
|
177
165
|
|
|
178
166
|
## Related libraries
|
|
179
167
|
|
|
180
|
-
* [irwebmachine](https://github.com/
|
|
168
|
+
* [irwebmachine](https://github.com/generalassembly/irwebmachine) - IRB/Pry debugging of Webmachine applications
|
|
181
169
|
* [webmachine-test](https://github.com/bernd/webmachine-test) - Helpers for testing Webmachine applications
|
|
182
170
|
* [webmachine-linking](https://github.com/petejohanson/webmachine-linking) - Helpers for linking between Resources, and Web Linking
|
|
183
171
|
* [webmachine-sprockets](https://github.com/lgierth/webmachine-sprockets) - Integration with Sprockets assets packaging system
|
|
184
172
|
* [webmachine-actionview](https://github.com/rgarner/webmachine-actionview) - Integration of some Rails-style view conventions into Webmachine
|
|
185
173
|
* [jruby-http-kit](https://github.com/nLight/jruby-http-kit) - Includes an adapter for the Clojure-based Ring library/server
|
|
174
|
+
* [newrelic-webmachine](https://github.com/mdub/newrelic-webmachine) - NewRelic instrumentation
|
|
186
175
|
|
|
187
176
|
## LICENSE
|
|
188
177
|
|
|
@@ -190,3 +179,12 @@ webmachine-ruby is licensed under the
|
|
|
190
179
|
[Apache v2.0 license](http://www.apache.org/licenses/LICENSE-2.0). See
|
|
191
180
|
LICENSE for details.
|
|
192
181
|
|
|
182
|
+
[example-resources]: /documentation/examples.md
|
|
183
|
+
[versioning-apis]: /documentation/versioning-apis.md
|
|
184
|
+
[routes]: /documentation/routes.md
|
|
185
|
+
[error-handling]: /documentation/error-handling.md
|
|
186
|
+
[authentication-and-authorization]: /documentation/authentication-and-authorization.md
|
|
187
|
+
[adapters]: /documentation/adapters.md
|
|
188
|
+
[visual-debugger]: /documentation/visual-debugger.md
|
|
189
|
+
[configurator]: /documentation/configurator.md
|
|
190
|
+
[validation]: /documentation/validation.md
|
data/RELEASING.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
1. Open `CHANGELOG.md` and summarize the changes made since the last release (hopefully better than the individual commit messages). The history can be grabbed with a simple git command (assuming the last version was 1.3.0:
|
|
2
|
+
|
|
3
|
+
$ git log --pretty=format:' * %s' v1.3.0..HEAD
|
|
4
|
+
|
|
5
|
+
2. Edit the version in `lib/webmachine/version.rb` according to semantic versioning rules.
|
|
6
|
+
3. Commit both files.
|
|
7
|
+
|
|
8
|
+
$ git add CHANGELOG.md lib/webmachine/version.rb
|
|
9
|
+
$ git commit -m "chore(release): version $(ruby -r ./lib/webmachine/version.rb -e "puts Webmachine::VERSION")" && git push
|
|
10
|
+
|
|
11
|
+
4. Release the gem.
|
|
12
|
+
|
|
13
|
+
$ bundle exec rake release
|
|
14
|
+
|
|
15
|
+
5. If this is a new major or minor release, push a new stable branch, otherwise merge the commit into the stable branch (or master, depending on where you made the commit).
|
|
16
|
+
|
|
17
|
+
$ git push origin HEAD:1.3-stable
|
|
18
|
+
# or
|
|
19
|
+
$ git checkout 1.3-stable; git merge master; git push origin; git checkout master
|
|
20
|
+
|
|
21
|
+
6. YOU'RE DONE!
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
require
|
|
2
|
-
require 'rubygems/package_task'
|
|
1
|
+
require "bundler/gem_tasks"
|
|
3
2
|
|
|
4
3
|
begin
|
|
5
4
|
require 'yard'
|
|
@@ -11,26 +10,12 @@ begin
|
|
|
11
10
|
rescue LoadError
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
desc "Validate the gemspec file."
|
|
14
|
+
task :validate_gemspec do
|
|
15
|
+
Gem::Specification.load("webmachine.gemspec").validate
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
pkg.need_zip = false
|
|
20
|
-
pkg.need_tar = false
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
task :gem => :gemspec
|
|
24
|
-
|
|
25
|
-
desc %{Validate the gemspec file.}
|
|
26
|
-
task :gemspec do
|
|
27
|
-
gemspec.validate
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
desc %{Release the gem to RubyGems.org}
|
|
31
|
-
task :release => :gem do
|
|
32
|
-
system "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
|
33
|
-
end
|
|
18
|
+
task :build => :validate_gemspec
|
|
34
19
|
|
|
35
20
|
desc "Cleans up white space in source files"
|
|
36
21
|
task :clean_whitespace do
|
|
@@ -51,7 +36,6 @@ task :clean_whitespace do
|
|
|
51
36
|
end
|
|
52
37
|
end
|
|
53
38
|
|
|
54
|
-
require 'rspec/core'
|
|
55
39
|
require 'rspec/core/rake_task'
|
|
56
40
|
|
|
57
41
|
desc "Run specs"
|