restify 2.0.1 → 2.1.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/restify/adapter/base.rb +1 -1
- data/lib/restify/cache.rb +1 -1
- data/lib/restify/relation.rb +7 -11
- data/lib/restify/response.rb +2 -2
- data/lib/restify/version.rb +2 -2
- data/spec/restify/adapter/base_spec.rb +33 -0
- data/spec/restify/context_spec.rb +2 -2
- data/spec/restify/features/opentelemetry_spec.rb +1 -1
- data/spec/restify/global_spec.rb +50 -1
- data/spec/restify/link_spec.rb +13 -3
- data/spec/restify/relation_spec.rb +79 -7
- data/spec/restify/resource_spec.rb +6 -0
- data/spec/restify_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/README.md +23 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/CHANGELOG.md +561 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/README.rdoc +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/README.md +121 -0
- data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/LICENSE.MIT +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/README.YARD.md +12 -0
- data/vendor/bundle/ruby/4.0.0/gems/base64-0.3.0/README.md +48 -0
- data/vendor/bundle/ruby/4.0.0/gems/bigdecimal-4.1.2/LICENSE +56 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/CHANGELOG.md +615 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/README.md +409 -0
- data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/README.md +182 -0
- data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/README.md +43 -0
- data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/CHANGELOG.md +518 -0
- data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/README.md +92 -0
- data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/README.md +409 -0
- data/vendor/bundle/ruby/4.0.0/gems/drb-2.2.3/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/CHANGELOG.md +417 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/README.md +118 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/CHANGELOG.md +507 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/README.md +138 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/LICENSE +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/README.md +323 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/changelog.md +127 -0
- data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/LICENSE.txt +16 -0
- data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/README.md +187 -0
- data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/README.md +139 -0
- data/vendor/bundle/ruby/4.0.0/gems/json-2.19.9/README.md +310 -0
- data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/README.md +88 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/CHANGELOG.md +15 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/README.md +173 -0
- data/vendor/bundle/ruby/4.0.0/gems/little-plugger-1.1.4/README.rdoc +53 -0
- data/vendor/bundle/ruby/4.0.0/gems/logger-1.7.0/README.md +104 -0
- data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/README.md +140 -0
- data/vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/README.rdoc +763 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/ChangeLog +383 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/LICENSE +177 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/README.md +302 -0
- data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/LICENSE.md +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/README.md +281 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/LICENSE +37 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/README +59 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/license.md +80 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/readme.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/CHANGELOG.md +219 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/README.md +68 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/CHANGELOG.md +110 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/README.md +62 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/CHANGELOG.md +97 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/README.md +155 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/CHANGELOG.md +192 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/README.md +66 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/CHANGELOG.md +31 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/README.md +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/CHANGELOG.md +302 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/README.md +101 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/CHANGELOG.md +65 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/README.md +115 -0
- data/vendor/bundle/ruby/4.0.0/gems/parallel-2.1.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/LICENSE.txt +26 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/CHANGELOG.md +786 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/LICENSE.md +7 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/README.md +143 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/README.md +231 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/LICENSE +29 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/README.md +484 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/README.md +9 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/rc.d/README.md +74 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/ChangeLog +846 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.rdoc +60 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/CHANGELOG.md +1346 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/README.md +384 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/Changelog.md +101 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/README.markdown +227 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/README.rdoc +155 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/README.md +107 -0
- data/vendor/bundle/ruby/4.0.0/gems/regexp_parser-2.12.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/README.md +57 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/LICENSE.md +27 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/README.md +47 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/Changelog.md +2447 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/LICENSE.md +26 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/README.md +389 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/Changelog.md +1366 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/LICENSE.md +25 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/README.md +326 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/Changelog.md +1351 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/LICENSE.md +25 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/README.md +465 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/Changelog.md +444 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/LICENSE.md +23 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/README.md +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/README.md +255 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/README.md +54 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/CHANGELOG.md +116 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/README.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/CHANGELOG.md +135 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/README.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/README.md +100 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/CHANGELOG.md +1136 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/README.md +112 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/CHANGELOG.md +98 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/README.md +93 -0
- data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/README.md +131 -0
- data/vendor/bundle/ruby/4.0.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/CHANGELOG.md +191 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/README.md +974 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/LICENSE +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/README.md +65 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/CHANGELOG.md +114 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/README.md +30 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/CHANGELOG.md +13 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/README.md +29 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/CHANGELOG.md +465 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/README.md +588 -0
- data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/CHANGELOG.md +299 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/MIT-LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/README.md +194 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/CHANGELOG.md +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/README.md +205 -0
- data/vendor/bundle/ruby/4.0.0/gems/uri-1.1.1/README.md +55 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/README.md +1229 -0
- metadata +171 -4
- data/doc/file.README.html +0 -192
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# lint_roller - A plugin specification for linters
|
|
2
|
+
|
|
3
|
+
`lint_roller` is an itty-bitty plugin API for code analysis tools like linters
|
|
4
|
+
and formatters. It provides plugins for those tools to load extensions and
|
|
5
|
+
specify custom rulesets.
|
|
6
|
+
|
|
7
|
+
(As of this release, only [Standard
|
|
8
|
+
Ruby](https://github.com/standardrb/standard) supports `lint_roller` plugins,
|
|
9
|
+
but we think [RuboCop](https://github.com/rubocop/rubocop) could add support and
|
|
10
|
+
most plugins would be compatible with both `rubocop` and `standardrb`.
|
|
11
|
+
Additionally, there's nothing that would prevent other tools like
|
|
12
|
+
[rufo](https://github.com/ruby-formatter/rufo) from adopting it.)
|
|
13
|
+
|
|
14
|
+
## How to make a plugin
|
|
15
|
+
|
|
16
|
+
If you want to make a plugin, the first thing you should do is extend
|
|
17
|
+
[LintRoller::Plugin](/lib/lint_roller/plugin.rb) with a custom class. Let's take
|
|
18
|
+
this example plugin for banana-related static analysis:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
module BananaRoller
|
|
22
|
+
class Plugin < LintRoller::Plugin
|
|
23
|
+
# `config' is a Hash of options passed to the plugin by the user
|
|
24
|
+
def initialize(config = {})
|
|
25
|
+
@alternative = config["alternative"] ||= "chocolate"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def about
|
|
29
|
+
LintRoller::About.new(
|
|
30
|
+
name: "banana_roller",
|
|
31
|
+
version: "1.0", # or, in a gem, probably BananaRoller::VERSION
|
|
32
|
+
homepage: "https://github.com/example/banana_roller",
|
|
33
|
+
description: "Configuration of banana-related code"
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# `context' is an instance of LintRoller::Context provided by the runner
|
|
38
|
+
def supported?(context)
|
|
39
|
+
context.engine == :rubocop
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# `context' is an instance of LintRoller::Context provided by the runner
|
|
43
|
+
def rules(context)
|
|
44
|
+
LintRoller::Rules.new(
|
|
45
|
+
type: :path,
|
|
46
|
+
config_format: :rubocop,
|
|
47
|
+
value: Pathname.new(__dir__).join("../../config/default.yml")
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
And that's pretty much it. Just a declarative way to identify your plugin,
|
|
55
|
+
detect whether it supports the given
|
|
56
|
+
[LintRoller::Context](/lib/lint_roller_context.rb) (e.g. the current `runner`
|
|
57
|
+
and `engine` and their respective `_version`s), for which the plugin will
|
|
58
|
+
ultimately its configuration as a [LintRoller::Rules](/lib/lint_roller/rules.rb)
|
|
59
|
+
object.
|
|
60
|
+
|
|
61
|
+
## Packaging a plugin in a gem
|
|
62
|
+
|
|
63
|
+
In order for a formatter to use your plugin, it needs to know what path to
|
|
64
|
+
require as well as the name of the plugin class to instantiate and invoke.
|
|
65
|
+
|
|
66
|
+
To make this work seamlessly for your users without additional configuration of
|
|
67
|
+
their own, all you need to do is specify a metadata attribute called
|
|
68
|
+
`default_lint_roller_plugin` in your gemspec.
|
|
69
|
+
|
|
70
|
+
Taking [standard-custom](https://github.com/standardrb/standard-custom) as an
|
|
71
|
+
example, its gemspec contains:
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
Gem::Specification.new do |spec|
|
|
75
|
+
# …
|
|
76
|
+
spec.metadata["default_lint_roller_plugin"] = "Standard::Custom::Plugin"
|
|
77
|
+
# …
|
|
78
|
+
end
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Because gem specs are loaded by RubyGems and Bundler very early, remember to
|
|
82
|
+
specify the plugin as a string representation of the constant, as load order
|
|
83
|
+
usually matters, and most tools will need to be loaded before any custom
|
|
84
|
+
extensions. Hence, `"Standard::Custom::Plugin"` instead of
|
|
85
|
+
`Standard::Custom::Plugin`.
|
|
86
|
+
|
|
87
|
+
## Using your plugin
|
|
88
|
+
|
|
89
|
+
Once you've made your plugin, here's how it's configured from a Standard Ruby
|
|
90
|
+
`.standard.yml` file.
|
|
91
|
+
|
|
92
|
+
### If your plugin is packaged as a gem
|
|
93
|
+
|
|
94
|
+
Packaging your plugin in a gem is the golden path, both because distributing
|
|
95
|
+
code via [RubyGems.org](https://rubygems.org) is very neat, but also because it
|
|
96
|
+
makes the least work for your users.
|
|
97
|
+
|
|
98
|
+
If your gem name is `banana_roller` and you've set
|
|
99
|
+
`spec.metadata["default_lint_roller_plugin"]` to `"BananaRoller::Plugin"`, then
|
|
100
|
+
your users could just add this to their `.standard.yml` file:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
plugins:
|
|
104
|
+
- banana_roller
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
And that's it! During initialization, `standardrb` will `require
|
|
108
|
+
"banana_roller"` and know to call `BananaRoller::Plugin.new(config)` to
|
|
109
|
+
instantiate it.
|
|
110
|
+
|
|
111
|
+
### If your plugin ISN'T in a gem
|
|
112
|
+
|
|
113
|
+
If you're developing a plugin for internal use or in conjunction with a single
|
|
114
|
+
project, you may want it to live in the same repo as opposed to packaging it in
|
|
115
|
+
a gem.
|
|
116
|
+
|
|
117
|
+
To do this, then—in lieu of a gem name—provide the path you want to be required
|
|
118
|
+
as its name, and (since there is no `spec.metadata` to learn of your plugin's
|
|
119
|
+
class name), specify it as an option on the plugin:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
plugins:
|
|
123
|
+
- lib/banana_roller/plugin:
|
|
124
|
+
plugin_class_name: BananaRoller::Plugin
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
(Be careful with the indentation here! Any configuration under a plugin must be
|
|
128
|
+
indented in order for it to be parsed as a hash under the
|
|
129
|
+
`"lib/banana_roller/plugin"` key.)
|
|
130
|
+
|
|
131
|
+
Additionally, if you want the plugin's name to make more sense, you can give
|
|
132
|
+
it whatever name you like in the configuration and specify the `require_path`
|
|
133
|
+
explicitly:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
plugins:
|
|
137
|
+
- banana_roller:
|
|
138
|
+
require_path: lib/banana_roller/plugin
|
|
139
|
+
plugin_class_name: BananaRoller::Plugin
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Passing user configuration to the plugin
|
|
143
|
+
|
|
144
|
+
When a `LintRoller::Plugin` is instantiated, users can pass a configuration hash
|
|
145
|
+
that tells your plugin how to behave.
|
|
146
|
+
|
|
147
|
+
To illustrate how this works in Standard Ruby, anything passed as a hash beneath
|
|
148
|
+
a plugin will be passed to the class's `initialize` method:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
plugins:
|
|
152
|
+
- apple_roller
|
|
153
|
+
- banana_roller:
|
|
154
|
+
require_path: lib/banana_roller/plugin
|
|
155
|
+
plugin_class_name: BananaRoller::Plugin
|
|
156
|
+
alternative: "apples"
|
|
157
|
+
- orange_roller:
|
|
158
|
+
rind: false
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
In the above case, `apple_roller`'s plugin class will be instantiated with
|
|
162
|
+
`new({})`, `banana_roller` will get all 3 of those parameters passed
|
|
163
|
+
`BananaRoller::Plugin.new({require_path…})`, and `orange_roller`'s class will be
|
|
164
|
+
called with `new({rind: false})`.
|
|
165
|
+
|
|
166
|
+
## Code of Conduct
|
|
167
|
+
|
|
168
|
+
This project follows Test Double's [code of
|
|
169
|
+
conduct](https://testdouble.com/code-of-conduct) for all community interactions,
|
|
170
|
+
including (but not limited to) one-on-one communications, public posts/comments,
|
|
171
|
+
code reviews, pull requests, and GitHub issues. If violations occur, Test Double
|
|
172
|
+
will take any action they deem appropriate for the infraction, up to and
|
|
173
|
+
including blocking a user from the organization's repositories.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
= Little Plugger
|
|
2
|
+
* by Tim Pease
|
|
3
|
+
* http://github.com/TwP/little-plugger/tree/master
|
|
4
|
+
|
|
5
|
+
=== DESCRIPTION:
|
|
6
|
+
|
|
7
|
+
LittlePlugger is a module that provides Gem based plugin management.
|
|
8
|
+
By extending your own class or module with LittlePlugger you can easily
|
|
9
|
+
manage the loading and initializing of plugins provided by other gems.
|
|
10
|
+
|
|
11
|
+
=== FEATURES:
|
|
12
|
+
|
|
13
|
+
* List of plugins so that some plugins can be excluded while others are
|
|
14
|
+
loaded by default.
|
|
15
|
+
* Loading and initializing of plugins.
|
|
16
|
+
* Access to the plugin classes and modules.
|
|
17
|
+
|
|
18
|
+
LittlePlugger is a distallation of the plugin system from Hoe. It has been
|
|
19
|
+
"genericized" and encapsulated into its own easy to use module.
|
|
20
|
+
|
|
21
|
+
=== REQUIREMENTS:
|
|
22
|
+
|
|
23
|
+
Since Little Plugger is a Gem based plugin system, Ruby Gems must be
|
|
24
|
+
installed on your system.
|
|
25
|
+
|
|
26
|
+
=== INSTALL:
|
|
27
|
+
|
|
28
|
+
gem install little-plugger
|
|
29
|
+
|
|
30
|
+
=== LICENSE:
|
|
31
|
+
|
|
32
|
+
(The MIT License)
|
|
33
|
+
|
|
34
|
+
Copyright (c) 2009-2011
|
|
35
|
+
|
|
36
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
37
|
+
a copy of this software and associated documentation files (the
|
|
38
|
+
'Software'), to deal in the Software without restriction, including
|
|
39
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
40
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
41
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
42
|
+
the following conditions:
|
|
43
|
+
|
|
44
|
+
The above copyright notice and this permission notice shall be
|
|
45
|
+
included in all copies or substantial portions of the Software.
|
|
46
|
+
|
|
47
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
48
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
49
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
50
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
51
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
52
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
53
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Logger
|
|
2
|
+
|
|
3
|
+
Logger is a simple but powerful logging utility to output messages in your Ruby program.
|
|
4
|
+
|
|
5
|
+
Logger has the following features:
|
|
6
|
+
|
|
7
|
+
* Print messages to different levels such as `info` and `error`
|
|
8
|
+
* Auto-rolling of log files
|
|
9
|
+
* Setting the format of log messages
|
|
10
|
+
* Specifying a program name in conjunction with the message
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Add this line to your application's Gemfile:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
gem 'logger'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
And then execute:
|
|
21
|
+
|
|
22
|
+
$ bundle
|
|
23
|
+
|
|
24
|
+
Or install it yourself as:
|
|
25
|
+
|
|
26
|
+
$ gem install logger
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Simple Example
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
require 'logger'
|
|
34
|
+
|
|
35
|
+
# Create a Logger that prints to STDOUT
|
|
36
|
+
log = Logger.new(STDOUT)
|
|
37
|
+
log.debug("Created Logger")
|
|
38
|
+
|
|
39
|
+
log.info("Program finished")
|
|
40
|
+
|
|
41
|
+
# Create a Logger that prints to STDERR
|
|
42
|
+
error_log = Logger.new(STDERR)
|
|
43
|
+
error_log = error_log.error("fatal error")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
After checking out the repo, run the following to install dependencies.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
$ bin/setup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then, run the tests as:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
$ rake test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To install this gem onto your local machine, run
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
$ rake install
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
To release a new version, update the version number in `lib/logger/version.rb`, and then run
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
$ rake release
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
73
|
+
|
|
74
|
+
## Advanced Development
|
|
75
|
+
|
|
76
|
+
### Run tests of a specific file
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
$ ruby test/logger/test_logger.rb
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Run tests filtering test methods by a name
|
|
83
|
+
|
|
84
|
+
`--name` option is available as:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
$ ruby test/logger/test_logger.rb --name test_lshift
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Publish documents to GitHub Pages
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
$ rake gh-pages
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then, git commit and push the generated HTMLs onto `gh-pages` branch.
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/logger.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
The gem is available as open source under the terms of the [BSD-2-Clause](BSDL).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2007-2022 Tim Pease
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
[](https://github.com/TwP/logging/actions/workflows/ruby.yml)
|
|
2
|
+
|
|
3
|
+
## Logging
|
|
4
|
+
by Tim Pease
|
|
5
|
+
|
|
6
|
+
* [Homepage](http://rubygems.org/gems/logging)
|
|
7
|
+
* [Github Project](https://github.com/TwP/logging)
|
|
8
|
+
|
|
9
|
+
### Description
|
|
10
|
+
|
|
11
|
+
**Logging** is a flexible logging library for use in Ruby programs based on the
|
|
12
|
+
design of Java's log4j library. It features a hierarchical logging system,
|
|
13
|
+
custom level names, multiple output destinations per log event, custom
|
|
14
|
+
formatting, and more.
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
gem install logging
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Examples
|
|
23
|
+
|
|
24
|
+
This example configures a logger to output messages in a format similar to the
|
|
25
|
+
core ruby Logger class. Only log messages that are warnings or higher will be
|
|
26
|
+
logged.
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'logging'
|
|
30
|
+
|
|
31
|
+
logger = Logging.logger(STDOUT)
|
|
32
|
+
logger.level = :warn
|
|
33
|
+
|
|
34
|
+
logger.debug "this debug message will not be output by the logger"
|
|
35
|
+
logger.warn "this is your last warning"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In this example, a single logger is created that will append to STDOUT and to a
|
|
39
|
+
file. Only log messages that are informational or higher will be logged.
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
require 'logging'
|
|
43
|
+
|
|
44
|
+
logger = Logging.logger['example_logger']
|
|
45
|
+
logger.level = :info
|
|
46
|
+
|
|
47
|
+
logger.add_appenders \
|
|
48
|
+
Logging.appenders.stdout,
|
|
49
|
+
Logging.appenders.file('example.log')
|
|
50
|
+
|
|
51
|
+
logger.debug "this debug message will not be output by the logger"
|
|
52
|
+
logger.info "just some friendly advice"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The Logging library was created to allow each class in a program to have its
|
|
56
|
+
own configurable logger. The logging level for a particular class can be
|
|
57
|
+
changed independently of all other loggers in the system. This example shows
|
|
58
|
+
the recommended way of accomplishing this.
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
require 'logging'
|
|
62
|
+
|
|
63
|
+
Logging.logger['FirstClass'].level = :warn
|
|
64
|
+
Logging.logger['SecondClass'].level = :debug
|
|
65
|
+
|
|
66
|
+
class FirstClass
|
|
67
|
+
def initialize
|
|
68
|
+
@logger = Logging.logger[self]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def some_method
|
|
72
|
+
@logger.debug "some method was called on #{self.inspect}"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class SecondClass
|
|
77
|
+
def initialize
|
|
78
|
+
@logger = Logging.logger[self]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def another_method
|
|
82
|
+
@logger.debug "another method was called on #{self.inspect}"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
There are many more examples in the [examples folder](/examples) of the logging
|
|
88
|
+
package. The recommended reading order is the following:
|
|
89
|
+
|
|
90
|
+
* [simple.rb](/examples/simple.rb)
|
|
91
|
+
* [rspec_integration.rb](/examples/rspec_integration.rb)
|
|
92
|
+
* [loggers.rb](/examples/loggers.rb)
|
|
93
|
+
* [classes.rb](/examples/classes.rb)
|
|
94
|
+
* [hierarchies.rb](/examples/hierarchies.rb)
|
|
95
|
+
* [names.rb](/examples/names.rb)
|
|
96
|
+
* [lazy.rb](/examples/lazy.rb)
|
|
97
|
+
* [appenders.rb](/examples/appenders.rb)
|
|
98
|
+
* [layouts.rb](/examples/layouts.rb)
|
|
99
|
+
* [reusing_layouts.rb](/examples/reusing_layouts.rb)
|
|
100
|
+
* [formatting.rb](/examples/formatting.rb)
|
|
101
|
+
* [colorization.rb](/examples/colorization.rb)
|
|
102
|
+
* [fork.rb](/examples/fork.rb)
|
|
103
|
+
* [mdc.rb](/examples/mdc.rb)
|
|
104
|
+
|
|
105
|
+
### Extending
|
|
106
|
+
|
|
107
|
+
The Logging framework is extensible via the [little-plugger](https://github.com/twp/little-plugger)
|
|
108
|
+
gem-based plugin system. New appenders, layouts, or filters can be released as ruby
|
|
109
|
+
gems. When installed locally, the Logging framework will automatically detect
|
|
110
|
+
these gems as plugins and make them available for use.
|
|
111
|
+
|
|
112
|
+
The [logging-email](https://github.com/twp/logging-email) plugin is a good
|
|
113
|
+
example to follow. It includes a [`lib/logging/plugins/email.rb`](https://github.com/twp/logging-email/tree/master/lib/logging/plugins/email.rb)
|
|
114
|
+
file which is detected by the plugin framework. This file declares a
|
|
115
|
+
`Logging::Plugins::Email.initialize_email` method that is called when the plugin
|
|
116
|
+
is loaded.
|
|
117
|
+
|
|
118
|
+
The three steps for creating a plugin are:
|
|
119
|
+
|
|
120
|
+
* create a new Ruby gem: `logging-<name>`
|
|
121
|
+
* include a plugin file: `lib/logging/plugins/<name>.rb`
|
|
122
|
+
* define a plugin initializer: `Logging::Plugins::<Name>.initialize_<name>`
|
|
123
|
+
|
|
124
|
+
### Development
|
|
125
|
+
|
|
126
|
+
The Logging source code relies on the Mr Bones project for default rake tasks.
|
|
127
|
+
You will need to install the Mr Bones gem if you want to build or test the
|
|
128
|
+
logging gem. Conveniently there is a bootstrap script that you can run to setup
|
|
129
|
+
your development environment.
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
script/bootstrap
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This will install the Mr Bones gem and the required Ruby gems for development.
|
|
136
|
+
After this is done you can rake `rake -T` to see the available rake tasks.
|
|
137
|
+
|
|
138
|
+
### License
|
|
139
|
+
|
|
140
|
+
The MIT License - see the [LICENSE](/LICENSE) file for the full text.
|