marlowe 1.0.3 → 3.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 +5 -5
- data/.github/workflows/ruby.yml +55 -0
- data/.standard.yml +4 -0
- data/Contributing.md +71 -0
- data/History.md +43 -0
- data/Licence.md +25 -0
- data/Manifest.txt +8 -4
- data/README.rdoc +168 -50
- data/Rakefile +51 -44
- data/lib/marlowe/config.rb +116 -0
- data/lib/marlowe/faraday.rb +20 -0
- data/lib/marlowe/formatter.rb +4 -4
- data/lib/marlowe/middleware.rb +50 -20
- data/lib/marlowe/rails.rb +20 -5
- data/lib/marlowe/simple_formatter.rb +3 -4
- data/lib/marlowe.rb +40 -5
- data/test/minitest_config.rb +8 -19
- data/test/test_marlowe.rb +90 -19
- data/test/test_marlowe_config.rb +109 -0
- metadata +127 -64
- data/.autotest +0 -25
- data/Gemfile +0 -9
- data/History.rdoc +0 -17
- data/Licence.rdoc +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a38beee250c02c545fa9a16e99a7e32702f4e027e2d9b87bfee4911210d6f7e
|
4
|
+
data.tar.gz: 3c4b0d3dddec1f5706076a36036fe1b1fcc26a4a662a7ce134fc4e7df7fa5579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1adb8585c41f04ae645af9080f97ae115d2977ed1e0fa0d2bace7b6b896b6dc3e9c10fca4938a40dcd7727a98a552312be9a514e883d48a0dd9058986b7b85ac
|
7
|
+
data.tar.gz: 80bfa345158bcf410251861067b071bbef0362cccac7866c50febbf6b9db557498a6b561aed47b1e62ea0de5988d15a510c896ceca017cc8193c386b1f0a5cdd
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
- master
|
9
|
+
workflow_dispatch:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
ruby-ci:
|
13
|
+
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
|
14
|
+
|
15
|
+
strategy:
|
16
|
+
fail-fast: true
|
17
|
+
matrix:
|
18
|
+
os:
|
19
|
+
- ubuntu-20.04
|
20
|
+
ruby:
|
21
|
+
- '2.7'
|
22
|
+
- '3.0'
|
23
|
+
- '3.1'
|
24
|
+
- head
|
25
|
+
- jruby
|
26
|
+
- jruby-head
|
27
|
+
- truffleruby
|
28
|
+
- truffleruby-head
|
29
|
+
- truffleruby+graalvm
|
30
|
+
- truffleruby+graalvm-head
|
31
|
+
include:
|
32
|
+
- ruby: head
|
33
|
+
continue-on-error: true
|
34
|
+
- ruby: jruby-head
|
35
|
+
continue-on-error: true
|
36
|
+
- os: ubuntu-22.04
|
37
|
+
ruby: head
|
38
|
+
- os: ubuntu-22.04
|
39
|
+
ruby: '3.1'
|
40
|
+
|
41
|
+
runs-on: ${{ matrix.os }}
|
42
|
+
|
43
|
+
continue-on-error: ${{ matrix.continue-on-error || false }}
|
44
|
+
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v3
|
47
|
+
- uses: ruby/setup-ruby@v1
|
48
|
+
with:
|
49
|
+
ruby-version: ${{ matrix.ruby }}
|
50
|
+
bundler-cache: true
|
51
|
+
|
52
|
+
- run: bundle exec ruby -S rake test --trace
|
53
|
+
- run: bundle exec ruby -S appraisal install
|
54
|
+
- run: bundle exec ruby -S appraisal rake test
|
55
|
+
- run: bundle exec standardrb
|
data/.standard.yml
ADDED
data/Contributing.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
We value any contribution to Marlowe you can provide: a bug report,
|
4
|
+
a feature request, or code contributions. Marlowe is reasonably complex
|
5
|
+
code, so there are a few contribution guidelines:
|
6
|
+
|
7
|
+
* Changes *will not* be accepted without tests. The test suite is written
|
8
|
+
with [Minitest][].
|
9
|
+
* Match our coding style.
|
10
|
+
* Use a thoughtfully-named topic branch that contains your change. Rebase
|
11
|
+
your commits into logical chunks as necessary.
|
12
|
+
* Use [quality commit messages][].
|
13
|
+
* Do not change the version number; when your patch is accepted and a release
|
14
|
+
is made, the version will be updated at that point.
|
15
|
+
* Submit a GitHub pull request with your changes.
|
16
|
+
|
17
|
+
### Test Dependencies
|
18
|
+
|
19
|
+
Marlowe uses Ryan Davis’s [Hoe][] to manage the release process, which
|
20
|
+
adds a number of rake tasks. You will mostly be interested in:
|
21
|
+
|
22
|
+
$ rake
|
23
|
+
|
24
|
+
which runs the tests the same way that:
|
25
|
+
|
26
|
+
$ rake test
|
27
|
+
$ rake travis
|
28
|
+
|
29
|
+
will do.
|
30
|
+
|
31
|
+
To assist with the installation of the development dependencies for
|
32
|
+
Marlowe, I have provided the simplest possible Gemfile pointing to the
|
33
|
+
(generated) `marlowe.gemspec` file. This will permit you to do:
|
34
|
+
|
35
|
+
$ bundle install
|
36
|
+
|
37
|
+
to get the development dependencies. If you aleady have `hoe` installed, you
|
38
|
+
can accomplish the same thing with:
|
39
|
+
|
40
|
+
$ rake newb
|
41
|
+
|
42
|
+
This task will install any missing dependencies, run the tests/specs, and
|
43
|
+
generate the RDoc.
|
44
|
+
|
45
|
+
### Workflow
|
46
|
+
|
47
|
+
Here's the most direct way to get your work merged into the project:
|
48
|
+
|
49
|
+
* Fork the project.
|
50
|
+
* Clone down your fork (`git clone
|
51
|
+
git://github.com/KineticCafe/marlowe.git`).
|
52
|
+
* Create a topic branch to contain your change (`git checkout -b
|
53
|
+
my_awesome_feature`).
|
54
|
+
* Hack away, add tests. Not necessarily in that order.
|
55
|
+
* Make sure everything still passes by running `rake`.
|
56
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
57
|
+
* Push the branch up (`git push origin my_awesome_feature`).
|
58
|
+
* Create a pull request against KineticCafe/marlowe and describe
|
59
|
+
what your change does and the why you think it should be merged.
|
60
|
+
|
61
|
+
### Contributors
|
62
|
+
|
63
|
+
* Trevor Oke [@thefury](https://github.com/thefury) created marlowe.
|
64
|
+
* Austin Ziegler [@halostatue](https://github.com/halostatue)
|
65
|
+
* Adam Solove [@asolove](https://github.com/asolove)
|
66
|
+
* Tim Morton [@tmorton](https://github.com/tmorton)
|
67
|
+
|
68
|
+
[Minitest]: https://github.com/seattlerb/minitest
|
69
|
+
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
70
|
+
[Hoe]: https://github.com/seattlerb/hoe
|
71
|
+
[kccoc]: https://github.com/KineticCafe/code-of-conduct
|
data/History.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
### 3.0 / 2022-09-11
|
2
|
+
|
3
|
+
- Added a Faraday request middleware.
|
4
|
+
- Replaced Hurley example with examples for the use of the Faraday
|
5
|
+
middleware.
|
6
|
+
- Added global Marlowe configuration.
|
7
|
+
|
8
|
+
### 2.1 / 2021-09-08
|
9
|
+
|
10
|
+
- Allow the use of Ruby 3.
|
11
|
+
- Switch to standardruby instead of rubocop.
|
12
|
+
- Switch from Travis to Github Actions.
|
13
|
+
|
14
|
+
### 2.0 / 2016-11-16
|
15
|
+
|
16
|
+
- Breaking change: the correlation header defaults to `X-Request-Id` instead of
|
17
|
+
`Correlation-Id`.
|
18
|
+
- Breaking change: by default, the `correlation_id` is sanitized in the same
|
19
|
+
way as `ActionDispatch::RequestId` when provided from an upstream source (only
|
20
|
+
alphanumerics with dashes up to 255 characters in length).
|
21
|
+
- Breaking change: by default, the `correlation_id` is returned to the client as
|
22
|
+
part of the response.
|
23
|
+
- Marlowe is more configurable now.
|
24
|
+
|
25
|
+
### 1.0.3 / 2016-01-15
|
26
|
+
|
27
|
+
- Update Readme example of using available formatted subclass.
|
28
|
+
- Make the correlation header name configurable
|
29
|
+
|
30
|
+
### 1.0.2 / 2015-11-24
|
31
|
+
|
32
|
+
- Add documentation for using Marlowe with [lograge][].
|
33
|
+
|
34
|
+
### 1.0.1 / 2015-10-20
|
35
|
+
|
36
|
+
- Update gemspec with homepage
|
37
|
+
- Update Rakefile
|
38
|
+
|
39
|
+
### 1.0.0 / 2015-10-16
|
40
|
+
|
41
|
+
- Initial Commit
|
42
|
+
|
43
|
+
[lograge]: https://github.com/roidrage/lograge
|
data/Licence.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## Licence
|
2
|
+
|
3
|
+
This software is available under an MIT-style licence.
|
4
|
+
|
5
|
+
- Copyright 2015–2022 Kinetic Cafe
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
|
+
this software and associated documentation files (the "Software"), to deal in
|
9
|
+
the Software without restriction, including without limitation the rights to
|
10
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
11
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
12
|
+
subject to the following conditions:
|
13
|
+
|
14
|
+
- The names of its contributors may not be used to endorse or promote products
|
15
|
+
derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
22
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
23
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
24
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
25
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
.github/workflows/ruby.yml
|
2
|
+
.standard.yml
|
3
|
+
Contributing.md
|
4
|
+
History.md
|
5
|
+
Licence.md
|
5
6
|
Manifest.txt
|
6
7
|
README.rdoc
|
7
8
|
Rakefile
|
8
9
|
lib/marlowe.rb
|
10
|
+
lib/marlowe/config.rb
|
11
|
+
lib/marlowe/faraday.rb
|
9
12
|
lib/marlowe/formatter.rb
|
10
13
|
lib/marlowe/middleware.rb
|
11
14
|
lib/marlowe/rails.rb
|
12
15
|
lib/marlowe/simple_formatter.rb
|
13
16
|
test/minitest_config.rb
|
14
17
|
test/test_marlowe.rb
|
18
|
+
test/test_marlowe_config.rb
|
data/README.rdoc
CHANGED
@@ -1,37 +1,138 @@
|
|
1
|
-
=
|
1
|
+
= Marlowe, Your Request Sleuth
|
2
|
+
|
3
|
+
code :: https://github.com/KineticCafe/marlowe/
|
4
|
+
issues :: https://github.com/KineticCafe/marlowe/issues
|
5
|
+
docs :: http://www.rubydoc.info/github/KineticCafe/marlowe/master
|
6
|
+
continuous integration :: {<img src="https://travis-ci.org/KineticCafe/marlowe.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/KineticCafe/marlowe]
|
2
7
|
|
3
8
|
== Description
|
4
9
|
|
5
|
-
{
|
6
|
-
|
7
|
-
across multiple services.
|
10
|
+
{Marlowe}[https://github.com/KineticCafe/marlowe] is a Rack middleware that
|
11
|
+
extracts or creates a request ID using a pre-defined header, permitting request
|
12
|
+
correlation across multiple services.
|
8
13
|
|
9
|
-
|
14
|
+
When using Rails, Marlowe automatically adds itself to the middleware before
|
15
|
+
<tt>Rails::Rack::Logger</tt>.
|
10
16
|
|
11
|
-
|
17
|
+
As of Marlowe 3.0, a Faraday middleware is provided (<tt>require 'marlowe/faraday'</tt>).
|
12
18
|
|
13
|
-
|
19
|
+
=== Upgrading
|
20
|
+
|
21
|
+
==== from Marlowe 2.0
|
22
|
+
|
23
|
+
In Marlowe 2.0, configuration was entirely specified in Rails configuration or
|
24
|
+
in the Rack +use+ clause. With the addition of a Faraday middleware for use with
|
25
|
+
Marlowe, centralization of the configuration is advisable.
|
26
|
+
|
27
|
+
The existing configuration mechanisms will work (and create instance
|
28
|
+
configurations if provided), but it is instead recommended to use the global
|
29
|
+
configuration:
|
30
|
+
|
31
|
+
# Compatibility with Marlowe 1.0
|
32
|
+
Marlowe.configure do |config|
|
33
|
+
config.header = 'Correlation-ID'
|
34
|
+
config.handler = :simple
|
35
|
+
config.return = false
|
36
|
+
end
|
37
|
+
|
38
|
+
Configuration is static for Marlowe::Middleware or Marlowe::Faraday instances
|
39
|
+
and changes to Marlowe configuration only affect *new* instances. If the
|
40
|
+
configuration options are provided in the middleware +use+ clause, they will
|
41
|
+
override the configured values.
|
42
|
+
|
43
|
+
Marlowe.configure do |config|
|
44
|
+
config.header = 'Correlation-ID'
|
45
|
+
config.handler = :simple
|
46
|
+
config.return = false
|
47
|
+
end
|
48
|
+
use Marlowe::Middleware, handler: :clean
|
49
|
+
# The handler will be the :clean handler for the used middleware.
|
50
|
+
|
51
|
+
==== from Marlowe 1.x
|
14
52
|
|
15
|
-
|
53
|
+
In Marlowe 1.0, the correlation header was called <tt>Correlation-Id</tt>;
|
54
|
+
since then, Rails 5 and other tools and frameworks (such as Phoenix) have
|
55
|
+
standardized on the header <tt>X-Request-Id</tt>. Marlowe 2.0 changes to this
|
56
|
+
header by default.
|
16
57
|
|
17
|
-
|
58
|
+
To keep complete compatibility with Marlowe 1.0, the following should be used:
|
59
|
+
|
60
|
+
# Rails
|
61
|
+
config.marlowe_header = 'Correlation-Id'
|
62
|
+
config.marlowe_handler = :simple
|
63
|
+
config.marlowe_return = false
|
64
|
+
|
65
|
+
# Rack
|
66
|
+
use Marlowe::Middleware, header: 'Correlation-Id', handler: :simple, return: false
|
18
67
|
|
19
68
|
== Configuration
|
20
69
|
|
21
|
-
|
70
|
+
Marlowe has three main configuration options: the request ID header, the
|
71
|
+
request ID handler, and the request ID return. The options may be provided to
|
72
|
+
the Rack +use+ command as a keyword option, or set in a corresponding
|
73
|
+
<tt>marlowe_<em>option</em></tt> configuration variable in Rails.
|
74
|
+
|
75
|
+
=== Request ID Header
|
76
|
+
|
77
|
+
Specifies the header to be used for the request correlation ID. Defaults to
|
78
|
+
<tt>X-Request-Id</tt>.
|
79
|
+
|
80
|
+
# Rails
|
81
|
+
config.marlowe_header = 'Correlation-Id'
|
82
|
+
# OR: config.marlowe_correlation_header = 'Correlation-Id'
|
83
|
+
|
84
|
+
# Rack
|
85
|
+
use Marlowe::Middleware, header: 'Correlation-Id'
|
86
|
+
# OR: use Marlowe::Middleware, correlation_header: 'Correlation-Id'
|
87
|
+
|
88
|
+
Marlowe will convert this to an appropriate HTTP header (in the Rack +env+
|
89
|
+
parameter, the above header would be represented as
|
90
|
+
<tt>env['HTTP_CORRELATION_ID']</tt>).
|
91
|
+
|
92
|
+
=== Request ID Handler
|
93
|
+
|
94
|
+
Specifies the method for sanitizing or generating the request correlation ID.
|
95
|
+
Values can be <tt>:clean</tt> (the default, which limits incoming correlation
|
96
|
+
IDs to 255 alphanumeric-or-dash characters), <tt>:simple</tt> (does not limit
|
97
|
+
incoming correlation IDs), or a proc to transform or generate a correlation ID.
|
98
|
+
|
99
|
+
In all cases, if a correlation request ID is not handled, a UUID will be
|
100
|
+
generated.
|
101
|
+
|
102
|
+
# Rails
|
103
|
+
config.marlowe_handler = :simple
|
104
|
+
config.marlowe_handler = ->(req_id) {
|
105
|
+
req_id.try(:reverse) || SecureRandom.uuid
|
106
|
+
}
|
22
107
|
|
23
|
-
|
108
|
+
# Rack
|
109
|
+
use Marlowe::Middleware, handler: :simple
|
110
|
+
use Marlowe::Middleware, handler: ->(req_id) {
|
111
|
+
req_id.try(:reverse) || SecureRandom.uuid
|
112
|
+
}
|
24
113
|
|
25
|
-
|
114
|
+
=== Request ID Return
|
26
115
|
|
27
|
-
|
116
|
+
If +true+ (the default), the request correlation ID will be returned to the
|
117
|
+
client in the same header that it was provided in.
|
28
118
|
|
29
|
-
|
119
|
+
# Rails
|
120
|
+
config.marlowe_return = false
|
30
121
|
|
31
|
-
|
32
|
-
|
122
|
+
# Rack
|
123
|
+
use Marlowe::Middleware, return: false
|
33
124
|
|
34
|
-
|
125
|
+
=== Using Marlowe with Rails 5
|
126
|
+
|
127
|
+
Rails 5 includes the <tt>ActionDispatch::RequestId</tt> middleware, reducing
|
128
|
+
the need for Marlowe. Marlowe is more configurable than the Rails 5 default, so
|
129
|
+
set +marlowe_replace_action_dispatch_request_id+ to true to have
|
130
|
+
<tt>Marlowe::Middleware</tt> will replace <tt>ActionDispatch::RequestId</tt>:
|
131
|
+
|
132
|
+
# Rails only
|
133
|
+
config.marlowe_replace_action_dispatch_request_id = true
|
134
|
+
|
135
|
+
== Accessing the Correlation ID
|
35
136
|
|
36
137
|
The correlation id can be accessed throughout the application by accessing the
|
37
138
|
{RequestStore}[https://github.com/steveklabnik/request_store] storage.
|
@@ -40,16 +141,15 @@ The correlation id can be accessed throughout the application by accessing the
|
|
40
141
|
|
41
142
|
== Logging
|
42
143
|
|
43
|
-
For a
|
44
|
-
the provided ones. Correlated versions of both the SimpleFormatter and
|
45
|
-
are included.
|
144
|
+
For a Rails application, you simply need to change the log formatter to one of
|
145
|
+
the provided ones. Correlated versions of both the SimpleFormatter and
|
146
|
+
Formatter are included.
|
46
147
|
|
47
148
|
# config/environments/development.rb
|
48
149
|
Rails.application.configure do
|
49
150
|
config.log_formatter = Marlowe::SimpleFormatter.new
|
50
151
|
end
|
51
152
|
|
52
|
-
|
53
153
|
To create your own formatter, you'll need to access the RequestStore storage.
|
54
154
|
You can use this pattern if you've rolled your own logger/formatter:
|
55
155
|
|
@@ -64,11 +164,11 @@ You can use this pattern if you've rolled your own logger/formatter:
|
|
64
164
|
|
65
165
|
=== Lograge
|
66
166
|
|
67
|
-
As {lograge}[https://github.com/roidrage/lograge] supplies
|
167
|
+
As {lograge}[https://github.com/roidrage/lograge] supplies its own formatter,
|
68
168
|
you will need to do something a little different:
|
69
169
|
|
70
170
|
# config/application.rb
|
71
|
-
|
171
|
+
|
72
172
|
class Application < Rails::Application
|
73
173
|
config.before_initialize do
|
74
174
|
...
|
@@ -80,46 +180,64 @@ you will need to do something a little different:
|
|
80
180
|
end
|
81
181
|
end
|
82
182
|
|
183
|
+
=== SemanticLogger
|
184
|
+
|
185
|
+
As {semantic_logger}[https://github.com/rocketjob/semantic_logger] provides its
|
186
|
+
own formatters this should be added as a tag. The best way that I can see to do
|
187
|
+
this is to capture the +correlation_id+ in an +on_log+ event:
|
188
|
+
|
189
|
+
# config/initializers/semantic_logger.rb
|
190
|
+
|
191
|
+
SemanticLogger.on_log do |log|
|
192
|
+
if RequestStore[:correlation_id]
|
193
|
+
log.named_tags[:correlation_id] = RequestStore[:correlation_id]
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
83
197
|
== Clients
|
84
198
|
|
85
199
|
Catching and creating the correlation ID is a great all on its own, but to
|
86
200
|
really take advantage of the correlation in a service based architecture you'll
|
87
|
-
need to pass the
|
201
|
+
need to pass the request ID to the next service in the change.
|
88
202
|
|
89
|
-
Here's an example
|
203
|
+
Here's an example with {Faraday}[https://github.com/lostisland/faraday]:
|
90
204
|
|
91
|
-
|
205
|
+
require 'faraday'
|
206
|
+
require 'faraday_middleware'
|
207
|
+
require 'marlowe/faraday'
|
92
208
|
|
93
|
-
|
94
|
-
|
209
|
+
conn = Faraday.new(url: 'https://example.org/') do |conn|
|
210
|
+
conn.request :marlowe
|
211
|
+
conn.request :json
|
95
212
|
|
96
|
-
|
97
|
-
|
98
|
-
super
|
99
|
-
header['Correlation-Id'] = ::RequestStore.store[:correlation_id]
|
213
|
+
conn.response :json
|
214
|
+
conn.adapter Faraday.default_adapter
|
100
215
|
end
|
101
|
-
end
|
102
216
|
|
103
|
-
|
104
|
-
machanism}[https://github.com/lostisland/hurley#client-callbacks] to add the
|
105
|
-
outgoing headers:
|
217
|
+
== Install
|
106
218
|
|
107
|
-
|
108
|
-
request.header['Correlation-Id'] = ::RequestStore.store[:correlation_id]
|
109
|
-
end
|
219
|
+
Add Marlowe to your Gemfile:
|
110
220
|
|
111
|
-
|
112
|
-
|
113
|
-
class Correlator
|
114
|
-
def name
|
115
|
-
:correlator
|
116
|
-
end
|
221
|
+
gem 'marlowe', '~> 2.0'
|
117
222
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
223
|
+
Or manually install:
|
224
|
+
|
225
|
+
$ gem install marlowe
|
226
|
+
|
227
|
+
== Marlowe Semantic Versioning
|
228
|
+
|
229
|
+
Marlowe uses a {Semantic Versioning}[http://semver.org/] scheme with one
|
230
|
+
significant change:
|
231
|
+
|
232
|
+
* When PATCH is zero (+0+), it will be omitted from version references.
|
122
233
|
|
123
|
-
|
234
|
+
Additionally, the major version will generally be reserved for plug-in
|
235
|
+
infrastructure changes.
|
124
236
|
|
237
|
+
== Community and Contributing
|
125
238
|
|
239
|
+
Marlowe welcomes your contributions as described in
|
240
|
+
{Contributing.md}[https://github.com/KineticCafe/marlowe/blob/master/Contributing.md].
|
241
|
+
This project, like all Kinetic Cafe {open source
|
242
|
+
projects}[https://github.com/KineticCafe], is under the Kinetic Cafe Open
|
243
|
+
Source {Code of Conduct}[https://github.com/KineticCafe/code-of-conduct].
|
data/Rakefile
CHANGED
@@ -1,61 +1,68 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
require "rake/clean"
|
5
6
|
|
6
7
|
Hoe.plugin :doofus
|
7
|
-
Hoe.plugin :email unless ENV[
|
8
|
+
Hoe.plugin :email unless ENV["CI"]
|
8
9
|
Hoe.plugin :gemspec2
|
9
10
|
Hoe.plugin :git
|
10
11
|
Hoe.plugin :minitest
|
11
12
|
Hoe.plugin :rubygems
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
developer(
|
16
|
-
|
17
|
-
|
18
|
-
self.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
extra_deps << [
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
13
|
+
|
14
|
+
spec = Hoe.spec "marlowe" do
|
15
|
+
developer("Trevor Oke", "toke@kineticcafe.com")
|
16
|
+
developer("Kinetic Cafe", "dev@kineticcafe.com")
|
17
|
+
|
18
|
+
self.history_file = "History.md"
|
19
|
+
self.readme_file = "README.rdoc"
|
20
|
+
|
21
|
+
license "MIT"
|
22
|
+
|
23
|
+
require_ruby_version ">= 2.0", "< 4"
|
24
|
+
|
25
|
+
extra_deps << ["request_store", "~> 1.2"]
|
26
|
+
extra_deps << ["rack", ">= 1", "< 4"]
|
27
|
+
|
28
|
+
extra_dev_deps << ["appraisal", "~> 2.1"]
|
29
|
+
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
30
|
+
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
|
31
|
+
extra_dev_deps << ["hoe-git", "~> 1.6"]
|
32
|
+
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
33
|
+
extra_dev_deps << ["minitest", "~> 5.4"]
|
34
|
+
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
|
35
|
+
extra_dev_deps << ["minitest-bonus-assertions", "~> 3.0"]
|
36
|
+
extra_dev_deps << ["minitest-focus", "~> 1.1"]
|
37
|
+
extra_dev_deps << ["minitest-moar", "~> 0.0"]
|
38
|
+
extra_dev_deps << ["rack-test", "~> 2.0"]
|
39
|
+
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
40
|
+
extra_dev_deps << ["rdoc", ">= 4.2"]
|
41
|
+
extra_dev_deps << ["standard", "~> 1.0"]
|
42
|
+
extra_dev_deps << ["simplecov", "~> 0.21"]
|
43
|
+
extra_dev_deps << ["psych", "~> 3.1"]
|
38
44
|
end
|
39
45
|
|
40
|
-
|
41
|
-
|
46
|
+
ENV["RUBYOPT"] = "-W0"
|
47
|
+
|
48
|
+
module Hoe::Publish # :nodoc:
|
49
|
+
alias_method :__make_rdoc_cmd__marlowe__, :make_rdoc_cmd
|
42
50
|
|
43
51
|
def make_rdoc_cmd(*extra_args) # :nodoc:
|
44
|
-
spec.extra_rdoc_files.reject! { |f| f ==
|
45
|
-
|
52
|
+
spec.extra_rdoc_files.reject! { |f| f == "Manifest.txt" }
|
53
|
+
__make_rdoc_cmd__marlowe__(*extra_args)
|
46
54
|
end
|
47
55
|
end
|
48
56
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
Rake::Task['test'].execute
|
57
|
+
if File.exist?(".simplecov-prelude.rb")
|
58
|
+
namespace :test do
|
59
|
+
task :coverage do
|
60
|
+
spec.test_prelude = 'load ".simplecov-prelude.rb"'
|
61
|
+
Rake::Task["test"].execute
|
62
|
+
end
|
63
|
+
|
64
|
+
CLOBBER << "coverage"
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
61
|
-
|
68
|
+
CLOBBER << "tmp"
|