rack-link_headers 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rack/link_headers/version.rb +1 -1
  3. data/rack-link-headers.gemspec +2 -2
  4. data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/LICENSE +21 -0
  5. data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/README.md +23 -0
  6. data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/rubocop-config.gemspec +31 -0
  7. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/LICENSE.MIT +20 -0
  8. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/README.YARD.md +12 -0
  9. data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/LICENSE +56 -0
  10. data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/README.md +416 -0
  11. data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/json.gemspec +68 -0
  12. data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/LICENSE.txt +21 -0
  13. data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/README.md +88 -0
  14. data/vendor/bundle/ruby/3.3.0/gems/minitest-5.25.1/README.rdoc +835 -0
  15. data/vendor/bundle/ruby/3.3.0/gems/parallel-1.26.3/MIT-LICENSE.txt +20 -0
  16. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.5.0/LICENSE.txt +25 -0
  17. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.5.0/parser.gemspec +43 -0
  18. data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  19. data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.rdoc +60 -0
  20. data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/CHANGELOG.md +994 -0
  21. data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/MIT-LICENSE +20 -0
  22. data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/README.md +328 -0
  23. data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/LICENSE +20 -0
  24. data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/README.markdown +227 -0
  25. data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
  26. data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/README.rdoc +155 -0
  27. data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/rake.gemspec +101 -0
  28. data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/LICENSE +21 -0
  29. data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/README.md +107 -0
  30. data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
  31. data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/LICENSE +22 -0
  32. data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/regexp_parser.gemspec +34 -0
  33. data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.7/LICENSE.txt +22 -0
  34. data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.7/README.md +57 -0
  35. data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/LICENSE.txt +20 -0
  36. data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/README.md +251 -0
  37. data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.3/LICENSE.txt +20 -0
  38. data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.3/README.md +56 -0
  39. data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/CHANGELOG.md +85 -0
  40. data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/MIT-LICENSE.md +21 -0
  41. data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/README.md +88 -0
  42. data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/CHANGELOG.md +116 -0
  43. data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/MIT-LICENSE.md +21 -0
  44. data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/README.md +88 -0
  45. data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/LICENSE.txt +20 -0
  46. data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/README.md +97 -0
  47. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/CHANGELOG.md +1034 -0
  48. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/MIT-LICENSE.md +21 -0
  49. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/README.md +109 -0
  50. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/CHANGELOG.md +84 -0
  51. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/MIT-LICENSE.md +21 -0
  52. data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/README.md +90 -0
  53. data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +19 -0
  54. data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/README.md +131 -0
  55. data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/CHANGELOG.md +200 -0
  56. data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/MIT-LICENSE.txt +22 -0
  57. data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/README.md +171 -0
  58. data/vendor/bundle/ruby/3.3.0/specifications/ast-2.4.2.gemspec +30 -0
  59. data/vendor/bundle/ruby/3.3.0/specifications/json-2.7.2.gemspec +0 -0
  60. data/vendor/bundle/ruby/3.3.0/specifications/language_server-protocol-3.17.0.3.gemspec +31 -0
  61. data/vendor/bundle/ruby/3.3.0/specifications/minitest-5.25.1.gemspec +31 -0
  62. data/vendor/bundle/ruby/3.3.0/specifications/parallel-1.26.3.gemspec +21 -0
  63. data/vendor/bundle/ruby/3.3.0/specifications/parser-3.3.5.0.gemspec +37 -0
  64. data/vendor/bundle/ruby/3.3.0/specifications/racc-1.8.1.gemspec +28 -0
  65. data/vendor/bundle/ruby/3.3.0/specifications/rack-3.1.7.gemspec +31 -0
  66. data/vendor/bundle/ruby/3.3.0/specifications/rainbow-3.1.1.gemspec +25 -0
  67. data/vendor/bundle/ruby/3.3.0/specifications/rake-13.2.1.gemspec +26 -0
  68. data/vendor/bundle/ruby/3.3.0/specifications/rake-release-1.3.0.gemspec +26 -0
  69. data/vendor/bundle/ruby/3.3.0/specifications/regexp_parser-2.9.2.gemspec +22 -0
  70. data/vendor/bundle/ruby/3.3.0/specifications/rexml-3.3.7.gemspec +25 -0
  71. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-1.65.1.gemspec +39 -0
  72. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-ast-1.32.3.gemspec +28 -0
  73. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-capybara-2.21.0.gemspec +27 -0
  74. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-factory_bot-2.26.1.gemspec +27 -0
  75. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-performance-1.21.1.gemspec +29 -0
  76. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec-3.0.5.gemspec +28 -0
  77. data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec_rails-2.30.0.gemspec +28 -0
  78. data/vendor/bundle/ruby/3.3.0/specifications/ruby-progressbar-1.13.0.gemspec +29 -0
  79. data/vendor/bundle/ruby/3.3.0/specifications/unicode-display_width-2.6.0.gemspec +29 -0
  80. metadata +80 -4
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2007-2021 Leah Neukirchen <http://leahneukirchen.org/infopage.html>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to
7
+ deal in the Software without restriction, including without limitation the
8
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ sell copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,328 @@
1
+ # ![Rack](contrib/logo.webp)
2
+
3
+ Rack provides a minimal, modular, and adaptable interface for developing web
4
+ applications in Ruby. By wrapping HTTP requests and responses in the simplest
5
+ way possible, it unifies and distills the bridge between web servers, web
6
+ frameworks, and web application into a single method call.
7
+
8
+ The exact details of this are described in the [Rack Specification], which all
9
+ Rack applications should conform to.
10
+
11
+ ## Version support
12
+
13
+ | Version | Support |
14
+ |----------|------------------------------------|
15
+ | 3.0.x | Bug fixes and security patches. |
16
+ | 2.2.x | Security patches only. |
17
+ | <= 2.1.x | End of support. |
18
+
19
+ Please see the [Security Policy] for more information.
20
+
21
+ ## Rack 3.0
22
+
23
+ This is the latest version of Rack. It contains API improvements but also some
24
+ breaking changes. Please check the [Upgrade Guide](UPGRADE-GUIDE.md) for more
25
+ details about migrating servers, middlewares and applications designed for Rack 2
26
+ to Rack 3. For detailed information on specific changes, check the [Change Log](CHANGELOG.md).
27
+
28
+ ## Rack 2.2
29
+
30
+ This version of Rack is receiving security patches only, and effort should be
31
+ made to move to Rack 3.
32
+
33
+ Starting in Ruby 3.4 the `base64` dependency will no longer be a default gem,
34
+ and may cause a warning or error about `base64` being missing. To correct this,
35
+ add `base64` as a dependency to your project.
36
+
37
+ ## Installation
38
+
39
+ Add the rack gem to your application bundle, or follow the instructions provided
40
+ by a [supported web framework](#supported-web-frameworks):
41
+
42
+ ```bash
43
+ # Install it generally:
44
+ $ gem install rack
45
+
46
+ # or, add it to your current application gemfile:
47
+ $ bundle add rack
48
+ ```
49
+
50
+ If you need features from `Rack::Session` or `bin/rackup` please add those gems separately.
51
+
52
+ ```bash
53
+ $ gem install rack-session rackup
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ Create a file called `config.ru` with the following contents:
59
+
60
+ ```ruby
61
+ run do |env|
62
+ [200, {}, ["Hello World"]]
63
+ end
64
+ ```
65
+
66
+ Run this using the rackup gem or another [supported web
67
+ server](#supported-web-servers).
68
+
69
+ ```bash
70
+ $ gem install rackup
71
+ $ rackup
72
+ $ curl http://localhost:9292
73
+ Hello World
74
+ ```
75
+
76
+ ## Supported web servers
77
+
78
+ Rack is supported by a wide range of servers, including:
79
+
80
+ * [Agoo](https://github.com/ohler55/agoo)
81
+ * [Falcon](https://github.com/socketry/falcon)
82
+ * [Iodine](https://github.com/boazsegev/iodine)
83
+ * [NGINX Unit](https://unit.nginx.org/)
84
+ * [Phusion Passenger](https://www.phusionpassenger.com/) (which is mod_rack for
85
+ Apache and for nginx)
86
+ * [Puma](https://puma.io/)
87
+ * [Thin](https://github.com/macournoyer/thin)
88
+ * [Unicorn](https://yhbt.net/unicorn/)
89
+ * [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/)
90
+ * [Lamby](https://lamby.custominktech.com) (for AWS Lambda)
91
+
92
+ You will need to consult the server documentation to find out what features and
93
+ limitations they may have. In general, any valid Rack app will run the same on
94
+ all these servers, without changing anything.
95
+
96
+ ### Rackup
97
+
98
+ Rack provides a separate gem, [rackup](https://github.com/rack/rackup) which is
99
+ a generic interface for running a Rack application on supported servers, which
100
+ include `WEBRick`, `Puma`, `Falcon` and others.
101
+
102
+ ## Supported web frameworks
103
+
104
+ These frameworks and many others support the [Rack Specification]:
105
+
106
+ * [Camping](https://github.com/camping/camping)
107
+ * [Hanami](https://hanamirb.org/)
108
+ * [Ramaze](https://github.com/ramaze/ramaze)
109
+ * [Padrino](https://padrinorb.com/)
110
+ * [Roda](https://github.com/jeremyevans/roda)
111
+ * [Ruby on Rails](https://rubyonrails.org/)
112
+ * [Rum](https://github.com/leahneukirchen/rum)
113
+ * [Sinatra](https://sinatrarb.com/)
114
+ * [Utopia](https://github.com/socketry/utopia)
115
+ * [WABuR](https://github.com/ohler55/wabur)
116
+
117
+ ## Available middleware shipped with Rack
118
+
119
+ Between the server and the framework, Rack can be customized to your
120
+ applications needs using middleware. Rack itself ships with the following
121
+ middleware:
122
+
123
+ * `Rack::CommonLogger` for creating Apache-style logfiles.
124
+ * `Rack::ConditionalGet` for returning [Not
125
+ Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304)
126
+ responses when the response has not changed.
127
+ * `Rack::Config` for modifying the environment before processing the request.
128
+ * `Rack::ContentLength` for setting a `content-length` header based on body
129
+ size.
130
+ * `Rack::ContentType` for setting a default `content-type` header for responses.
131
+ * `Rack::Deflater` for compressing responses with gzip.
132
+ * `Rack::ETag` for setting `etag` header on bodies that can be buffered.
133
+ * `Rack::Events` for providing easy hooks when a request is received and when
134
+ the response is sent.
135
+ * `Rack::Files` for serving static files.
136
+ * `Rack::Head` for returning an empty body for HEAD requests.
137
+ * `Rack::Lint` for checking conformance to the [Rack Specification].
138
+ * `Rack::Lock` for serializing requests using a mutex.
139
+ * `Rack::Logger` for setting a logger to handle logging errors.
140
+ * `Rack::MethodOverride` for modifying the request method based on a submitted
141
+ parameter.
142
+ * `Rack::Recursive` for including data from other paths in the application, and
143
+ for performing internal redirects.
144
+ * `Rack::Reloader` for reloading files if they have been modified.
145
+ * `Rack::Runtime` for including a response header with the time taken to process
146
+ the request.
147
+ * `Rack::Sendfile` for working with web servers that can use optimized file
148
+ serving for file system paths.
149
+ * `Rack::ShowException` for catching unhandled exceptions and presenting them in
150
+ a nice and helpful way with clickable backtrace.
151
+ * `Rack::ShowStatus` for using nice error pages for empty client error
152
+ responses.
153
+ * `Rack::Static` for more configurable serving of static files.
154
+ * `Rack::TempfileReaper` for removing temporary files creating during a request.
155
+
156
+ All these components use the same interface, which is described in detail in the
157
+ [Rack Specification]. These optional components can be used in any way you wish.
158
+
159
+ ### Convenience interfaces
160
+
161
+ If you want to develop outside of existing frameworks, implement your own ones,
162
+ or develop middleware, Rack provides many helpers to create Rack applications
163
+ quickly and without doing the same web stuff all over:
164
+
165
+ * `Rack::Request` which also provides query string parsing and multipart
166
+ handling.
167
+ * `Rack::Response` for convenient generation of HTTP replies and cookie
168
+ handling.
169
+ * `Rack::MockRequest` and `Rack::MockResponse` for efficient and quick testing
170
+ of Rack application without real HTTP round-trips.
171
+ * `Rack::Cascade` for trying additional Rack applications if an application
172
+ returns a not found or method not supported response.
173
+ * `Rack::Directory` for serving files under a given directory, with directory
174
+ indexes.
175
+ * `Rack::MediaType` for parsing content-type headers.
176
+ * `Rack::Mime` for determining content-type based on file extension.
177
+ * `Rack::RewindableInput` for making any IO object rewindable, using a temporary
178
+ file buffer.
179
+ * `Rack::URLMap` to route to multiple applications inside the same process.
180
+
181
+ ## Configuration
182
+
183
+ Rack exposes several configuration parameters to control various features of the
184
+ implementation.
185
+
186
+ ### `param_depth_limit`
187
+
188
+ ```ruby
189
+ Rack::Utils.param_depth_limit = 32 # default
190
+ ```
191
+
192
+ The maximum amount of nesting allowed in parameters. For example, if set to 3,
193
+ this query string would be allowed:
194
+
195
+ ```
196
+ ?a[b][c]=d
197
+ ```
198
+
199
+ but this query string would not be allowed:
200
+
201
+ ```
202
+ ?a[b][c][d]=e
203
+ ```
204
+
205
+ Limiting the depth prevents a possible stack overflow when parsing parameters.
206
+
207
+ ### `multipart_file_limit`
208
+
209
+ ```ruby
210
+ Rack::Utils.multipart_file_limit = 128 # default
211
+ ```
212
+
213
+ The maximum number of parts with a filename a request can contain. Accepting
214
+ too many parts can lead to the server running out of file handles.
215
+
216
+ The default is 128, which means that a single request can't upload more than 128
217
+ files at once. Set to 0 for no limit.
218
+
219
+ Can also be set via the `RACK_MULTIPART_FILE_LIMIT` environment variable.
220
+
221
+ (This is also aliased as `multipart_part_limit` and `RACK_MULTIPART_PART_LIMIT` for compatibility)
222
+
223
+
224
+ ### `multipart_total_part_limit`
225
+
226
+ The maximum total number of parts a request can contain of any type, including
227
+ both file and non-file form fields.
228
+
229
+ The default is 4096, which means that a single request can't contain more than
230
+ 4096 parts.
231
+
232
+ Set to 0 for no limit.
233
+
234
+ Can also be set via the `RACK_MULTIPART_TOTAL_PART_LIMIT` environment variable.
235
+
236
+
237
+ ## Changelog
238
+
239
+ See [CHANGELOG.md](CHANGELOG.md).
240
+
241
+ ## Contributing
242
+
243
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for specific details about how to make a
244
+ contribution to Rack.
245
+
246
+ Please post bugs, suggestions and patches to [GitHub
247
+ Issues](https://github.com/rack/rack/issues).
248
+
249
+ Please check our [Security Policy](https://github.com/rack/rack/security/policy)
250
+ for responsible disclosure and security bug reporting process. Due to wide usage
251
+ of the library, it is strongly preferred that we manage timing in order to
252
+ provide viable patches at the time of disclosure. Your assistance in this matter
253
+ is greatly appreciated.
254
+
255
+ ## See Also
256
+
257
+ ### `rack-contrib`
258
+
259
+ The plethora of useful middleware created the need for a project that collects
260
+ fresh Rack middleware. `rack-contrib` includes a variety of add-on components
261
+ for Rack and it is easy to contribute new modules.
262
+
263
+ * https://github.com/rack/rack-contrib
264
+
265
+ ### `rack-session`
266
+
267
+ Provides convenient session management for Rack.
268
+
269
+ * https://github.com/rack/rack-session
270
+
271
+ ## Thanks
272
+
273
+ The Rack Core Team, consisting of
274
+
275
+ * Aaron Patterson [tenderlove](https://github.com/tenderlove)
276
+ * Samuel Williams [ioquatix](https://github.com/ioquatix)
277
+ * Jeremy Evans [jeremyevans](https://github.com/jeremyevans)
278
+ * Eileen Uchitelle [eileencodes](https://github.com/eileencodes)
279
+ * Matthew Draper [matthewd](https://github.com/matthewd)
280
+ * Rafael França [rafaelfranca](https://github.com/rafaelfranca)
281
+
282
+ and the Rack Alumni
283
+
284
+ * Ryan Tomayko [rtomayko](https://github.com/rtomayko)
285
+ * Scytrin dai Kinthra [scytrin](https://github.com/scytrin)
286
+ * Leah Neukirchen [leahneukirchen](https://github.com/leahneukirchen)
287
+ * James Tucker [raggi](https://github.com/raggi)
288
+ * Josh Peek [josh](https://github.com/josh)
289
+ * José Valim [josevalim](https://github.com/josevalim)
290
+ * Michael Fellinger [manveru](https://github.com/manveru)
291
+ * Santiago Pastorino [spastorino](https://github.com/spastorino)
292
+ * Konstantin Haase [rkh](https://github.com/rkh)
293
+
294
+ would like to thank:
295
+
296
+ * Adrian Madrid, for the LiteSpeed handler.
297
+ * Christoffer Sawicki, for the first Rails adapter and `Rack::Deflater`.
298
+ * Tim Fletcher, for the HTTP authentication code.
299
+ * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
300
+ * Armin Ronacher, for the logo and racktools.
301
+ * Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben Alpert, Dan
302
+ Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson, Phil Hagelberg, S. Brent
303
+ Faulkner, Bosko Milekic, Daniel Rodríguez Troitiño, Genki Takiuchi, Geoffrey
304
+ Grosenbach, Julien Sanchez, Kamal Fariz Mahyuddin, Masayoshi Takahashi,
305
+ Patrick Aljordm, Mig, Kazuhiro Nishiyama, Jon Bardin, Konstantin Haase, Larry
306
+ Siden, Matias Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin,
307
+ and Zach Brock for bug fixing and other improvements.
308
+ * Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support and API
309
+ improvements.
310
+ * Yehuda Katz and Carl Lerche for refactoring rackup.
311
+ * Brian Candler, for `Rack::ContentType`.
312
+ * Graham Batty, for improved handler loading.
313
+ * Stephen Bannasch, for bug reports and documentation.
314
+ * Gary Wright, for proposing a better `Rack::Response` interface.
315
+ * Jonathan Buch, for improvements regarding `Rack::Response`.
316
+ * Armin Röhrl, for tracking down bugs in the Cookie generator.
317
+ * Alexander Kellett for testing the Gem and reviewing the announcement.
318
+ * Marcus Rückert, for help with configuring and debugging lighttpd.
319
+ * The WSGI team for the well-done and documented work they've done and Rack
320
+ builds up on.
321
+ * All bug reporters and patch contributors not mentioned above.
322
+
323
+ ## License
324
+
325
+ Rack is released under the [MIT License](MIT-LICENSE).
326
+
327
+ [Rack Specification]: SPEC.rdoc
328
+ [Security Policy]: SECURITY.md
@@ -0,0 +1,20 @@
1
+ Copyright (c) Marcin Kulik
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,227 @@
1
+ # Rainbow
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rainbow.svg)](https://rubygems.org/gems/rainbow)
4
+ [![Build Status](https://travis-ci.org/sickill/rainbow.svg?branch=master)](https://travis-ci.org/sickill/rainbow)
5
+ [![Build status](https://ci.appveyor.com/api/projects/status/vq4acb2c38642s5q?svg=true)](https://ci.appveyor.com/project/sickill/rainbow)
6
+ [![Code Climate](https://codeclimate.com/github/sickill/rainbow.svg)](https://codeclimate.com/github/sickill/rainbow)
7
+ [![Coverage Status](https://coveralls.io/repos/sickill/rainbow/badge.svg)](https://coveralls.io/r/sickill/rainbow)
8
+
9
+ Rainbow is a ruby gem for colorizing printed text on ANSI terminals.
10
+
11
+ It provides a string presenter object, which adds several methods to your
12
+ strings for wrapping them in [ANSI escape
13
+ codes](http://en.wikipedia.org/wiki/ANSI_escape_code). These codes when printed
14
+ in a terminal change text attributes like text color, background color,
15
+ intensity etc.
16
+
17
+ ## Usage
18
+
19
+ To make your string colored wrap it with `Rainbow()` presenter and call
20
+ `.color(<color name>)` on it.
21
+
22
+ ### Example
23
+
24
+ ```ruby
25
+ require 'rainbow'
26
+
27
+ puts Rainbow("this is red").red + " and " + Rainbow("this on yellow bg").bg(:yellow) + " and " + Rainbow("even bright underlined!").underline.bright
28
+
29
+ # => "\e[31mthis is red\e[0m and \e[43mthis on yellow bg\e[0m and \e[4m\e[1meven bright underlined!\e[0m"
30
+ ```
31
+
32
+ ![Screenshot of the previous code in a terminal](https://user-images.githubusercontent.com/132/132943811-93747cc5-bdaf-43a2-a1a4-a1f18e805eba.png)
33
+
34
+ Or, [watch this video example](https://asciinema.org/a/J928KpHoUQ0sl54ulOSOLE71E?rows=20&speed=2.5)
35
+
36
+ ### Rainbow presenter API
37
+
38
+ Rainbow presenter adds the following methods to presented string:
39
+
40
+ * `color(c)` (with `foreground`, and `fg` aliases)
41
+ * `background(c)` (with `bg` alias)
42
+ * `bright`
43
+ * `underline`
44
+ * `blink`
45
+ * `inverse`
46
+ * `hide`
47
+ * `faint` (not well supported by terminal emulators)
48
+ * `italic` (not well supported by terminal emulators)
49
+ * `cross_out`, `strike`
50
+
51
+ Text color can also be changed by calling a method named by a color:
52
+
53
+ * `black`
54
+ * `red`
55
+ * `green`
56
+ * `yellow`
57
+ * `blue`
58
+ * `magenta`
59
+ * `cyan`
60
+ * `white`
61
+ * `aqua`
62
+ * `silver`
63
+ * `aliceblue`
64
+ * `indianred`
65
+
66
+ All of the methods return `self` (the presenter object) so you can chain method
67
+ calls:
68
+
69
+ ```ruby
70
+ Rainbow("hola!").blue.bright.underline
71
+ ```
72
+
73
+ ### Refinement
74
+
75
+ If you want to use the Refinements version, you can:
76
+
77
+ ```ruby
78
+ require 'rainbow/refinement'
79
+ using Rainbow
80
+ puts "Hi!".green
81
+ ```
82
+
83
+ Here's an IRB session example:
84
+
85
+ ```
86
+ >> 'Hello, World!'.blue.bright.underline
87
+ NoMethodError: undefined method `blue' for "Hello, World!":String
88
+ (ripl):1:in `<main>'
89
+ >> using Rainbow
90
+ => main
91
+ >> 'Hello, World!'.blue.bright.underline
92
+ => "\e[34m\e[1m\e[4mHello, World!\e[0m"
93
+ ```
94
+
95
+ ### Color specification
96
+
97
+ Both `color` and `background` accept color specified in any
98
+ of the following ways:
99
+
100
+ * ANSI color number (where 0 is black, 1 is red, 2 is green and so on):
101
+ `Rainbow("hello").color(1)`
102
+
103
+ * [ANSI color](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) name or [X11 color](https://en.wikipedia.org/wiki/X11_color_names) name as a symbol:
104
+ `Rainbow("hello").color(:yellow)`.
105
+ This can be simplified to `Rainbow("hello").yellow`
106
+
107
+ See [Color list](#user-content-color-list) for all available color names.
108
+ Note that ANSI colors can be changed in accordance with terminal setting.
109
+ But X11 color is just a syntax sugar for RGB triplet. So you always see what you specified.
110
+
111
+ * RGB triplet as separate values in the range 0-255:
112
+ `Rainbow("hello").color(115, 23, 98)`
113
+
114
+ * RGB triplet as a hex string:
115
+ `Rainbow("hello").color("FFC482")` or `Rainbow("hello").color("#FFC482")`
116
+
117
+ When you specify a color with a RGB triplet rainbow finds the nearest match
118
+ from 256 colors palette. Note that it requires a 256-colors capable terminal to
119
+ display correctly.
120
+
121
+ #### Example: Choose a random color
122
+
123
+ You can pick a random color with Rainbow, it's a one-liner:
124
+
125
+ ```ruby
126
+ colors = Range.new(0,7).to_a
127
+ "whoop dee doop".chars.map { |char| Rainbow(char).color(colors.sample) }.join
128
+ # => "\e[36mw\e[0m\e[37mh\e[0m\e[34mo\e[0m\e[34mo\e[0m\e[37mp\e[0m\e[34m \e[0m\e[36md\e[0m\e[33me\e[0m\e[34me\e[0m\e[37m \e[0m\e[32md\e[0m\e[35mo\e[0m\e[33mo\e[0m\e[36mp\e[0m"
129
+
130
+ colors = [:aliceblue, :antiquewhite, :aqua, :aquamarine, :azure, :beige, :bisque, :blanchedalmond, :blueviolet]
131
+ "whoop dee doop".chars.map { |char| Rainbow(char).color(colors.sample) }.join
132
+ # => "\e[38;5;135mw\e[0m\e[38;5;230mh\e[0m\e[38;5;231mo\e[0m\e[38;5;135mo\e[0m\e[38;5;231mp\e[0m\e[38;5;231m \e[0m\e[38;5;122md\e[0m\e[38;5;231me\e[0m\e[38;5;231me\e[0m\e[38;5;230m \e[0m\e[38;5;122md\e[0m\e[38;5;51mo\e[0m\e[38;5;51mo\e[0m\e[38;5;51mp\e[0m"
133
+ ```
134
+
135
+ ### Configuration
136
+
137
+ Rainbow can be enabled/disabled globally by setting:
138
+
139
+ ```ruby
140
+ Rainbow.enabled = true/false
141
+ ```
142
+
143
+ When disabled all the methods return an unmodified string
144
+ (`Rainbow("hello").red == "hello"`).
145
+
146
+ It's enabled by default, unless STDOUT/STDERR is not a TTY or a terminal is
147
+ dumb.
148
+
149
+ ### Advanced usage
150
+
151
+ `Rainbow()` and `Rainbow.enabled` operate on the global Rainbow wrapper
152
+ instance. If you would like to selectively enable/disable coloring in separate
153
+ parts of your application you can get a new Rainbow wrapper instance for each
154
+ of them and control the state of coloring during the runtime.
155
+
156
+ ```ruby
157
+ rainbow_one = Rainbow.new
158
+ rainbow_two = Rainbow.new
159
+
160
+ rainbow_one.enabled = false
161
+
162
+ Rainbow("hello").red # => "\e[31mhello\e[0m" ("hello" if not on TTY)
163
+ rainbow_one.wrap("hello").red # => "hello"
164
+ rainbow_two.wrap("hello").red # => "\e[31mhello\e[0m" ("hello" if not on TTY)
165
+ ```
166
+
167
+ By default each new instance inherits enabled/disabled state from the global
168
+ `Rainbow.enabled`.
169
+
170
+ This feature comes handy for example when you have multiple output formatters
171
+ in your application and some of them print to a terminal but others write to a
172
+ file. Normally rainbow would detect that STDIN/STDERR is a TTY and would
173
+ colorize all the strings, even the ones that go through file writing
174
+ formatters. You can easily solve that by disabling coloring for the Rainbow
175
+ instances that are used by formatters with file output.
176
+
177
+ ## Installation
178
+
179
+ Add it to your Gemfile:
180
+
181
+ ```ruby
182
+ gem 'rainbow'
183
+ ```
184
+
185
+ Or just install it via rubygems:
186
+
187
+ ```ruby
188
+ gem install rainbow
189
+ ```
190
+
191
+ ## Color list
192
+
193
+ ### ANSI colors
194
+
195
+ `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`
196
+
197
+ ### X11 colors
198
+
199
+ `aliceblue`, `antiquewhite`, `aqua`, `aquamarine`, `azure`, `beige`, `bisque`,
200
+ `blanchedalmond`, `blueviolet`, `brown`, `burlywood`, `cadetblue`, `chartreuse`,
201
+ `chocolate`, `coral`, `cornflower`, `cornsilk`, `crimson`, `darkblue`,
202
+ `darkcyan`, `darkgoldenrod`, `darkgray`, `darkgreen`, `darkkhaki`,
203
+ `darkmagenta`, `darkolivegreen`, `darkorange`, `darkorchid`, `darkred`,
204
+ `darksalmon`, `darkseagreen`, `darkslateblue`, `darkslategray`, `darkturquoise`,
205
+ `darkviolet`, `deeppink`, `deepskyblue`, `dimgray`, `dodgerblue`, `firebrick`,
206
+ `floralwhite`, `forestgreen`, `fuchsia`, `gainsboro`, `ghostwhite`, `gold`,
207
+ `goldenrod`, `gray`, `greenyellow`, `honeydew`, `hotpink`, `indianred`,
208
+ `indigo`, `ivory`, `khaki`, `lavender`, `lavenderblush`, `lawngreen`,
209
+ `lemonchiffon`, `lightblue`, `lightcoral`, `lightcyan`, `lightgoldenrod`,
210
+ `lightgray`, `lightgreen`, `lightpink`, `lightsalmon`, `lightseagreen`,
211
+ `lightskyblue`, `lightslategray`, `lightsteelblue`, `lightyellow`, `lime`,
212
+ `limegreen`, `linen`, `maroon`, `mediumaquamarine`, `mediumblue`,
213
+ `mediumorchid`, `mediumpurple`, `mediumseagreen`, `mediumslateblue`,
214
+ `mediumspringgreen`, `mediumturquoise`, `mediumvioletred`, `midnightblue`,
215
+ `mintcream`, `mistyrose`, `moccasin`, `navajowhite`, `navyblue`, `oldlace`,
216
+ `olive`, `olivedrab`, `orange`, `orangered`, `orchid`, `palegoldenrod`,
217
+ `palegreen`, `paleturquoise`, `palevioletred`, `papayawhip`, `peachpuff`,
218
+ `peru`, `pink`, `plum`, `powderblue`, `purple`, `rebeccapurple`, `rosybrown`,
219
+ `royalblue`, `saddlebrown`, `salmon`, `sandybrown`, `seagreen`, `seashell`,
220
+ `sienna`, `silver`, `skyblue`, `slateblue`, `slategray`, `snow`, `springgreen`,
221
+ `steelblue`, `tan`, `teal`, `thistle`, `tomato`, `turquoise`, `violet`,
222
+ `webgray`, `webgreen`, `webmaroon`, `webpurple`, `wheat`, `whitesmoke`,
223
+ `yellowgreen`
224
+
225
+ ## Authors
226
+
227
+ [Marcin Kulik](http://ku1ik.com/) and [great open-source contributors](https://github.com/sickill/rainbow/graphs/contributors).
@@ -0,0 +1,21 @@
1
+ Copyright (c) Jim Weirich
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+