restify 2.0.2 → 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 +8 -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 +1 -9
- 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 +25 -6
- 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/gems/activesupport-8.1.3/CHANGELOG.md +561 -0
- data/vendor/bundle/ruby/{3.4.0/gems/activesupport-8.0.2 → 4.0.0/gems/activesupport-8.1.3}/README.rdoc +1 -1
- data/vendor/bundle/ruby/{3.4.0/gems/addressable-2.8.7 → 4.0.0/gems/addressable-2.9.0}/CHANGELOG.md +71 -46
- data/vendor/bundle/ruby/{3.4.0/gems/addressable-2.8.7 → 4.0.0/gems/addressable-2.9.0}/README.md +6 -6
- 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/{3.4.0/gems/concurrent-ruby-1.3.5 → 4.0.0/gems/concurrent-ruby-1.3.7}/CHANGELOG.md +12 -0
- data/vendor/bundle/ruby/{3.4.0/gems/concurrent-ruby-1.3.5 → 4.0.0/gems/concurrent-ruby-1.3.7}/README.md +4 -2
- data/vendor/bundle/ruby/{3.4.0/gems/connection_pool-2.5.3 → 4.0.0/gems/connection_pool-3.0.2}/README.md +49 -34
- 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/{3.4.0/gems/ethon-0.16.0 → 4.0.0/gems/ethon-0.18.0}/CHANGELOG.md +43 -1
- data/vendor/bundle/ruby/{3.4.0/gems/ethon-0.16.0 → 4.0.0/gems/ethon-0.18.0}/README.md +1 -1
- data/vendor/bundle/ruby/{3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu → 4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu}/CHANGELOG.md +34 -0
- data/vendor/bundle/ruby/{3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu → 4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu}/README.md +1 -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/{3.4.0/gems/hitimes-3.1.0 → 4.0.0/gems/hitimes-3.2.0}/README.md +1 -1
- data/vendor/bundle/ruby/{3.4.0/gems/i18n-1.14.7 → 4.0.0/gems/i18n-1.15.2}/README.md +13 -1
- 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/{3.4.0/gems/minitest-5.25.5 → 4.0.0/gems/minitest-6.0.6}/README.rdoc +21 -100
- data/vendor/bundle/ruby/{3.4.0/gems/msgpack-1.8.0 → 4.0.0/gems/msgpack-1.8.3}/ChangeLog +15 -0
- data/vendor/bundle/ruby/{3.4.0/gems/msgpack-1.8.0 → 4.0.0/gems/msgpack-1.8.3}/README.md +1 -1
- 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/{3.4.0/gems/opentelemetry-common-0.22.0 → 4.0.0/gems/opentelemetry-common-0.25.0}/CHANGELOG.md +12 -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/{3.4.0/gems/public_suffix-6.0.2 → 4.0.0/gems/public_suffix-7.0.5}/LICENSE.txt +1 -1
- data/vendor/bundle/ruby/{3.4.0/gems/public_suffix-6.0.2 → 4.0.0/gems/public_suffix-7.0.5}/README.md +38 -29
- 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/{3.4.0/gems/rack-3.1.15 → 4.0.0/gems/rack-3.2.6}/CHANGELOG.md +216 -16
- data/vendor/bundle/ruby/{3.4.0/gems/rack-3.1.15 → 4.0.0/gems/rack-3.2.6}/README.md +49 -20
- 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/{3.4.0/gems/rake-13.2.1 → 4.0.0/gems/rake-13.4.2}/README.rdoc +5 -5
- 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/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/{3.4.0/gems/multi_json-1.15.0 → 4.0.0/gems/rspec-support-3.13.7}/LICENSE.md +4 -1
- 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/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/{3.4.0/gems/typhoeus-1.4.1 → 4.0.0/gems/typhoeus-1.6.0}/CHANGELOG.md +56 -1
- data/vendor/bundle/ruby/{3.4.0/gems/typhoeus-1.4.1 → 4.0.0/gems/typhoeus-1.6.0}/README.md +2 -2
- 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/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 +170 -65
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/CHANGELOG.md +0 -255
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +0 -138
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +0 -275
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +0 -121
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/CHANGELOG.md +0 -193
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md +0 -498
- /data/vendor/bundle/ruby/{3.4.0/bundler/gems/my-rubocop-3bcd2110ca87 → 4.0.0/bundler/gems/my-rubocop-2b861962124a}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/bundler/gems/my-rubocop-3bcd2110ca87 → 4.0.0/bundler/gems/my-rubocop-2b861962124a}/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/activesupport-8.0.2 → 4.0.0/gems/activesupport-8.1.3}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/addressable-2.8.7 → 4.0.0/gems/addressable-2.9.0}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/base64-0.2.0 → 4.0.0/gems/base64-0.3.0}/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/bigdecimal-3.1.9 → 4.0.0/gems/bigdecimal-4.1.2}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/concurrent-ruby-1.3.5 → 4.0.0/gems/concurrent-ruby-1.3.7}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/connection_pool-2.5.3 → 4.0.0/gems/connection_pool-3.0.2}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/base64-0.2.0 → 4.0.0/gems/drb-2.2.3}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/ethon-0.16.0 → 4.0.0/gems/ethon-0.18.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu → 4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu → 4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu}/LICENSE.SPECS +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/hitimes-3.1.0 → 4.0.0/gems/hitimes-3.2.0}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/i18n-1.14.7 → 4.0.0/gems/i18n-1.15.2}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/little-plugger-1.1.4/README.rdoc +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/logger-1.7.0/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/logging-2.4.0/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/logging-2.4.0/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/msgpack-1.8.0 → 4.0.0/gems/msgpack-1.8.3}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/opentelemetry-api-1.5.0 → 4.0.0/gems/opentelemetry-api-1.10.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/opentelemetry-api-1.5.0 → 4.0.0/gems/opentelemetry-api-1.10.0}/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/opentelemetry-common-0.22.0 → 4.0.0/gems/opentelemetry-common-0.25.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/opentelemetry-common-0.22.0 → 4.0.0/gems/opentelemetry-common-0.25.0}/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/rack-3.1.15 → 4.0.0/gems/rack-3.2.6}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/rake-13.2.1 → 4.0.0/gems/rake-13.4.2}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/rake-release-1.3.0 → 4.0.0/gems/rake-release-1.4.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/rake-release-1.3.0 → 4.0.0/gems/rake-release-1.4.0}/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/drb-2.2.1 → 4.0.0/gems/rexml-3.4.4}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/securerandom-0.4.1/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/typhoeus-1.4.1 → 4.0.0/gems/typhoeus-1.6.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/tzinfo-2.0.6/LICENSE +0 -0
- /data/vendor/bundle/ruby/{3.4.0 → 4.0.0}/gems/tzinfo-2.0.6/README.md +0 -0
- /data/vendor/bundle/ruby/{3.4.0/gems/uri-1.0.3 → 4.0.0/gems/uri-1.1.1}/README.md +0 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# JSON implementation for Ruby
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ruby/json/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This is an implementation of the JSON specification according to RFC 7159
|
|
8
|
+
http://www.ietf.org/rfc/rfc7159.txt .
|
|
9
|
+
|
|
10
|
+
The JSON generator generate UTF-8 character sequences by default.
|
|
11
|
+
If an :ascii\_only option with a true value is given, they escape all
|
|
12
|
+
non-ASCII and control characters with \uXXXX escape sequences, and support
|
|
13
|
+
UTF-16 surrogate pairs in order to be able to generate the whole range of
|
|
14
|
+
unicode code points.
|
|
15
|
+
|
|
16
|
+
All strings, that are to be encoded as JSON strings, should be UTF-8 byte
|
|
17
|
+
sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
|
|
18
|
+
encoded, please use the to\_json\_raw\_object method of String (which produces
|
|
19
|
+
an object, that contains a byte array) and decode the result on the receiving
|
|
20
|
+
endpoint.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
25
|
+
|
|
26
|
+
$ bundle add json
|
|
27
|
+
|
|
28
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
29
|
+
|
|
30
|
+
$ gem install json
|
|
31
|
+
|
|
32
|
+
## Basic Usage
|
|
33
|
+
|
|
34
|
+
To use JSON you can
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
require 'json'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Now you can parse a JSON document into a ruby data structure by calling
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
JSON.parse(document)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you want to generate a JSON document from a ruby data structure call
|
|
47
|
+
```ruby
|
|
48
|
+
JSON.generate(data)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
You can also use the `pretty_generate` method (which formats the output more
|
|
52
|
+
verbosely and nicely) or `fast_generate` (which doesn't do any of the security
|
|
53
|
+
checks generate performs, e. g. nesting deepness checks).
|
|
54
|
+
|
|
55
|
+
## Casting non native types
|
|
56
|
+
|
|
57
|
+
JSON documents can only support Hashes, Arrays, Strings, Integers and Floats.
|
|
58
|
+
|
|
59
|
+
By default if you attempt to serialize something else, `JSON.generate` will
|
|
60
|
+
search for a `#to_json` method on that object:
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
Position = Struct.new(:latitude, :longitude) do
|
|
64
|
+
def to_json(state = nil, *)
|
|
65
|
+
JSON::State.from_state(state).generate({
|
|
66
|
+
latitude: latitude,
|
|
67
|
+
longitude: longitude,
|
|
68
|
+
})
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
JSON.generate([
|
|
73
|
+
Position.new(12323.234, 435345.233),
|
|
74
|
+
Position.new(23434.676, 159435.324),
|
|
75
|
+
]) # => [{"latitude":12323.234,"longitude":435345.233},{"latitude":23434.676,"longitude":159435.324}]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If a `#to_json` method isn't defined on the object, `JSON.generate` will fallback to call `#to_s`:
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
JSON.generate(Object.new) # => "#<Object:0x000000011e768b98>"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Both of these behavior can be disabled using the `strict: true` option:
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
JSON.generate(Object.new, strict: true) # => Object not allowed in JSON (JSON::GeneratorError)
|
|
88
|
+
JSON.generate(Position.new(1, 2)) # => Position not allowed in JSON (JSON::GeneratorError)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## JSON::Coder
|
|
92
|
+
|
|
93
|
+
Since `#to_json` methods are global, it can sometimes be problematic if you need a given type to be
|
|
94
|
+
serialized in different ways in different locations.
|
|
95
|
+
|
|
96
|
+
Instead it is recommended to use the newer `JSON::Coder` API:
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
module MyApp
|
|
100
|
+
API_JSON_CODER = JSON::Coder.new do |object, is_object_key|
|
|
101
|
+
case object
|
|
102
|
+
when Time
|
|
103
|
+
object.iso8601(3)
|
|
104
|
+
else
|
|
105
|
+
object
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
puts MyApp::API_JSON_CODER.dump(Time.now.utc) # => "2025-01-21T08:41:44.286Z"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The provided block is called for all objects that don't have a native JSON equivalent, and
|
|
114
|
+
must return a Ruby object that has a native JSON equivalent.
|
|
115
|
+
|
|
116
|
+
It is also called for objects that do have a JSON equivalent, but are used as Hash keys, for instance `{ 1 => 2}`,
|
|
117
|
+
as well as for strings that aren't valid UTF-8:
|
|
118
|
+
|
|
119
|
+
```ruby
|
|
120
|
+
coder = JSON::Combining.new do |object, is_object_key|
|
|
121
|
+
case object
|
|
122
|
+
when String
|
|
123
|
+
if !string.valid_encoding? || string.encoding != Encoding::UTF_8
|
|
124
|
+
Base64.encode64(string)
|
|
125
|
+
else
|
|
126
|
+
string
|
|
127
|
+
end
|
|
128
|
+
else
|
|
129
|
+
object
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Combining JSON fragments
|
|
135
|
+
|
|
136
|
+
To combine JSON fragments into a bigger JSON document, you can use `JSON::Fragment`:
|
|
137
|
+
|
|
138
|
+
```ruby
|
|
139
|
+
posts_json = cache.fetch_multi(post_ids) do |post_id|
|
|
140
|
+
JSON.generate(Post.find(post_id))
|
|
141
|
+
end
|
|
142
|
+
posts_json.map! { |post_json| JSON::Fragment.new(post_json) }
|
|
143
|
+
JSON.generate({ posts: posts_json, count: posts_json.count })
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Round-tripping arbitrary types
|
|
147
|
+
|
|
148
|
+
> [!CAUTION]
|
|
149
|
+
> You should never use `JSON.unsafe_load` nor `JSON.parse(str, create_additions: true)` to parse untrusted user input,
|
|
150
|
+
> as it can lead to remote code execution vulnerabilities.
|
|
151
|
+
|
|
152
|
+
To create a JSON document from a ruby data structure, you can call
|
|
153
|
+
`JSON.generate` like that:
|
|
154
|
+
|
|
155
|
+
```ruby
|
|
156
|
+
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
|
157
|
+
# => "[1,2,{\"a\":3.141},false,true,null,\"4..10\"]"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
To get back a ruby data structure from a JSON document, you have to call
|
|
161
|
+
JSON.parse on it:
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
JSON.parse json
|
|
165
|
+
# => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"]
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Note, that the range from the original data structure is a simple
|
|
169
|
+
string now. The reason for this is, that JSON doesn't support ranges
|
|
170
|
+
or arbitrary classes. In this case the json library falls back to call
|
|
171
|
+
`Object#to_json`, which is the same as `#to_s.to_json`.
|
|
172
|
+
|
|
173
|
+
It's possible to add JSON support serialization to arbitrary classes by
|
|
174
|
+
simply implementing a more specialized version of the `#to_json method`, that
|
|
175
|
+
should return a JSON object (a hash converted to JSON with `#to_json`) like
|
|
176
|
+
this (don't forget the `*a` for all the arguments):
|
|
177
|
+
|
|
178
|
+
```ruby
|
|
179
|
+
class Range
|
|
180
|
+
def to_json(*a)
|
|
181
|
+
{
|
|
182
|
+
'json_class' => self.class.name, # = 'Range'
|
|
183
|
+
'data' => [ first, last, exclude_end? ]
|
|
184
|
+
}.to_json(*a)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The hash key `json_class` is the class, that will be asked to deserialise the
|
|
190
|
+
JSON representation later. In this case it's `Range`, but any namespace of
|
|
191
|
+
the form `A::B` or `::A::B` will do. All other keys are arbitrary and can be
|
|
192
|
+
used to store the necessary data to configure the object to be deserialised.
|
|
193
|
+
|
|
194
|
+
If the key `json_class` is found in a JSON object, the JSON parser checks
|
|
195
|
+
if the given class responds to the `json_create` class method. If so, it is
|
|
196
|
+
called with the JSON object converted to a Ruby hash. So a range can
|
|
197
|
+
be deserialised by implementing `Range.json_create` like this:
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
class Range
|
|
201
|
+
def self.json_create(o)
|
|
202
|
+
new(*o['data'])
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Now it possible to serialise/deserialise ranges as well:
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
|
211
|
+
# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
|
|
212
|
+
JSON.parse json
|
|
213
|
+
# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
|
214
|
+
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
|
215
|
+
# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
|
|
216
|
+
JSON.unsafe_load json
|
|
217
|
+
# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`JSON.generate` always creates the shortest possible string representation of a
|
|
221
|
+
ruby data structure in one line. This is good for data storage or network
|
|
222
|
+
protocols, but not so good for humans to read. Fortunately there's also
|
|
223
|
+
`JSON.pretty_generate` (or `JSON.pretty_generate`) that creates a more readable
|
|
224
|
+
output:
|
|
225
|
+
|
|
226
|
+
```ruby
|
|
227
|
+
puts JSON.pretty_generate([1, 2, {"a"=>3.141}, false, true, nil, 4..10])
|
|
228
|
+
[
|
|
229
|
+
1,
|
|
230
|
+
2,
|
|
231
|
+
{
|
|
232
|
+
"a": 3.141
|
|
233
|
+
},
|
|
234
|
+
false,
|
|
235
|
+
true,
|
|
236
|
+
null,
|
|
237
|
+
{
|
|
238
|
+
"json_class": "Range",
|
|
239
|
+
"data": [
|
|
240
|
+
4,
|
|
241
|
+
10,
|
|
242
|
+
false
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
There are also the methods `Kernel#j` for generate, and `Kernel#jj` for
|
|
249
|
+
`pretty_generate` output to the console, that work analogous to Core Ruby's `p` and
|
|
250
|
+
the `pp` library's `pp` methods.
|
|
251
|
+
|
|
252
|
+
## Security
|
|
253
|
+
|
|
254
|
+
When parsing or serializing untrusted input, parser and generator options should never be user controlled.
|
|
255
|
+
|
|
256
|
+
```ruby
|
|
257
|
+
# Dangerous, DO NOT DO THIS.
|
|
258
|
+
JSON.generate(params[:data], params[:options])
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Security vulnerability reports relying on attacker controlled parsing or generator options will be handled as regular bug fixes.
|
|
262
|
+
|
|
263
|
+
## Development
|
|
264
|
+
|
|
265
|
+
### Prerequisites
|
|
266
|
+
|
|
267
|
+
1. Clone the repository
|
|
268
|
+
2. Install dependencies with `bundle install`
|
|
269
|
+
|
|
270
|
+
### Testing
|
|
271
|
+
|
|
272
|
+
The full test suite can be run with:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
bundle exec rake test
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Release
|
|
279
|
+
|
|
280
|
+
Update the `lib/json/version.rb` file.
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
rbenv shell 2.6.5
|
|
284
|
+
rake build
|
|
285
|
+
gem push pkg/json-2.3.0.gem
|
|
286
|
+
|
|
287
|
+
rbenv shell jruby-9.2.9.0
|
|
288
|
+
rake build
|
|
289
|
+
gem push pkg/json-2.3.0-java.gem
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Author
|
|
293
|
+
|
|
294
|
+
Florian Frank <mailto:flori@ping.de>
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
Ruby License, see https://www.ruby-lang.org/en/about/license.txt.
|
|
299
|
+
|
|
300
|
+
## Download
|
|
301
|
+
|
|
302
|
+
The latest version of this library can be downloaded at
|
|
303
|
+
|
|
304
|
+
* https://rubygems.org/gems/json
|
|
305
|
+
|
|
306
|
+
Online Documentation should be located at
|
|
307
|
+
|
|
308
|
+
* https://www.rubydoc.info/gems/json
|
|
309
|
+
|
|
310
|
+
[Ragel]: http://www.colm.net/open-source/ragel/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Fumiaki MATSUSHIMA
|
|
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 deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
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 THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# LanguageServer::Protocol
|
|
2
|
+
|
|
3
|
+
A Language Server Protocol SDK for Ruby.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/rb/language_server-protocol)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'language_server-protocol'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install language_server-protocol
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Currently, this gem supports only stdio as transport layer out of box.
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
require "language_server-protocol"
|
|
29
|
+
|
|
30
|
+
LSP = LanguageServer::Protocol
|
|
31
|
+
writer = LSP::Transport::Stdio::Writer.new
|
|
32
|
+
reader = LSP::Transport::Stdio::Reader.new
|
|
33
|
+
|
|
34
|
+
subscribers = {
|
|
35
|
+
initialize: -> {
|
|
36
|
+
LSP::Interface::InitializeResult.new(
|
|
37
|
+
capabilities: LSP::Interface::ServerCapabilities.new(
|
|
38
|
+
text_document_sync: LSP::Interface::TextDocumentSyncOptions.new(
|
|
39
|
+
change: LSP::Constant::TextDocumentSyncKind::FULL
|
|
40
|
+
),
|
|
41
|
+
completion_provider: LSP::Interface::CompletionOptions.new(
|
|
42
|
+
resolve_provider: true,
|
|
43
|
+
trigger_characters: %w(.)
|
|
44
|
+
),
|
|
45
|
+
definition_provider: true
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
reader.read do |request|
|
|
52
|
+
result = subscribers[request[:method].to_sym].call
|
|
53
|
+
writer.write(id: request[:id], result: result)
|
|
54
|
+
exit
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
You can use any IO object as transport layer:
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
io = StringIO.new
|
|
62
|
+
writer = LSP::Transport::Io::Writer.new(io)
|
|
63
|
+
reader = LSP::Transport::Io::Reader.new(io)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Versioning
|
|
67
|
+
|
|
68
|
+
language_server-protocol gem does NOT use semantic versioning.
|
|
69
|
+
This gem versions are structured as `x.y.z.t`.
|
|
70
|
+
`x.y.z` indicates the [Language server protocol](https://github.com/Microsoft/language-server-protocol/) version and `t` is a monotonically increasing number.
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
75
|
+
|
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, 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).
|
|
77
|
+
|
|
78
|
+
## Contributing
|
|
79
|
+
|
|
80
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mtsmfm/language_server-protocol-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
85
|
+
|
|
86
|
+
## Code of Conduct
|
|
87
|
+
|
|
88
|
+
Everyone interacting in the LanguageServer::Protocol project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mtsmfm/language_server-protocol-ruby/blob/main/CODE_OF_CONDUCT.md).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [1.1.0]
|
|
4
|
+
|
|
5
|
+
- Add `LintRoller::Support` module of classes designed to make it a little
|
|
6
|
+
easier to author plugins. `MergesUpstreamMetadata#merge` will allow a minimal
|
|
7
|
+
YAML config (say, `standard-sorbet`'s, which only contains `Enabled` values for
|
|
8
|
+
each rule) to merge in any other defaults from a source YAML (e.g.
|
|
9
|
+
`rubocop-sorbet`'s which includes `Description`, `VersionAdded`, and so on).
|
|
10
|
+
This way that metadata is neither absent at runtime nor duplicated in a standard
|
|
11
|
+
plugin that mirrors a rubocop extension
|
|
12
|
+
|
|
13
|
+
## [1.0.0]
|
|
14
|
+
|
|
15
|
+
- Initial release
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Test Double, Inc.
|
|
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 deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
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 THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -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.
|