diff --git a/.github/workflows/pronto.yml b/.github/workflows/pronto.yml new file mode 100644 index 0000000..824b395 --- /dev/null +++ b/.github/workflows/pronto.yml @@ -0,0 +1,20 @@ +name: Pronto +on: [pull_request_target] + +jobs: + pronto: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - run: | + git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/* + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: gem install pronto pronto-rubocop + - run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }} + env: + PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}" + BUNDLE_PATH: "vendor/bundle" diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 4f54887..b66e945 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -1,13 +1,6 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake -# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby +name: RSpec -name: Ruby CI - -on: [push, pull_request] +on: [pull_request] jobs: test: strategy: diff --git a/.gitignore b/.gitignore index 3b02b5d..4458943 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ quickstart.rb *.gz -/vendor/ +vendor/ diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..2a884e5 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,17 @@ +require: + - standard + - standard-custom + - standard-performance + - rubocop-performance + +inherit_gem: + standard: config/base.yml + standard-custom: config/base.yml + standard-performance: config/base.yml + +AllCops: + NewCops: enable + Exclude: + - node_modules/**/* + - public/**/* + - vendor/**/* diff --git a/Gemfile b/Gemfile index f3ceb81..38d50a8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'https://rubygems.org' +source "https://rubygems.org" gem "faraday", "~> 1.10" gem "faraday_middleware" diff --git a/Gemfile.lock b/Gemfile.lock index 8fab64f..b42d8ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - netbox-client-ruby (0.10.0) + netbox-client-ruby (0.10.1) dry-configurable (~> 1) faraday (>= 0.11.0, < 3) faraday-detailed_logger (~> 2.1) @@ -49,22 +49,23 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) ipaddress (0.8.3) + json (2.7.2) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) method_source (1.0.0) multipart-post (2.3.0) openssl (3.2.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.3.6) - strscan + regexp_parser (2.9.2) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -78,28 +79,41 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (0.93.1) + rubocop (1.66.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-rspec (1.44.1) - rubocop (~> 0.87) - rubocop-ast (>= 0.7.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.3) + parser (>= 3.3.1.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - strscan (3.1.0) - unicode-display_width (1.8.0) + standard (1.41.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.66.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.5) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.5.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.22.0) + unicode-display_width (2.6.0) zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES @@ -110,8 +124,8 @@ DEPENDENCIES pry (~> 0.10) rake (~> 13) rspec (~> 3.5) - rubocop (~> 0.48) - rubocop-rspec (~> 1.15) + standard (~> 1.31) + standard-performance (~> 1.2) BUNDLED WITH 2.4.10 diff --git a/bin/console b/bin/console index 4a6f765..2604487 100755 --- a/bin/console +++ b/bin/console @@ -17,7 +17,7 @@ end NCR = NetboxClientRuby -version = File.read(File.expand_path('../VERSION', __dir__)).strip +version = Gem.loaded_specs["netbox-client-ruby"].version puts <<~WELCOME_TEXT This is using NetboxClientRuby v#{version}. diff --git a/gemfiles/faraday0.gemfile.lock b/gemfiles/faraday0.gemfile.lock index 461577a..6017711 100644 --- a/gemfiles/faraday0.gemfile.lock +++ b/gemfiles/faraday0.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - netbox-client-ruby (0.10.0) + netbox-client-ruby (0.10.1) dry-configurable (~> 1) faraday (>= 0.11.0, < 3) faraday-detailed_logger (~> 2.1) @@ -29,21 +29,23 @@ GEM faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) ipaddress (0.8.3) + json (2.7.2) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) method_source (1.0.0) multipart-post (2.3.0) openssl (3.2.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.2.6) + regexp_parser (2.9.2) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -57,26 +59,40 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (0.93.1) + rubocop (1.66.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-rspec (1.44.1) - rubocop (~> 0.87) - rubocop-ast (>= 0.7.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.3) + parser (>= 3.3.1.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - unicode-display_width (1.8.0) + standard (1.41.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.66.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.5) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.5.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.22.0) + unicode-display_width (2.6.0) zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES @@ -87,8 +103,8 @@ DEPENDENCIES pry (~> 0.10) rake (~> 13) rspec (~> 3.5) - rubocop (~> 0.48) - rubocop-rspec (~> 1.15) + standard (~> 1.31) + standard-performance (~> 1.2) BUNDLED WITH 2.4.10 diff --git a/gemfiles/faraday1.gemfile.lock b/gemfiles/faraday1.gemfile.lock index 67a4106..0fa6a17 100644 --- a/gemfiles/faraday1.gemfile.lock +++ b/gemfiles/faraday1.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - netbox-client-ruby (0.10.0) + netbox-client-ruby (0.10.1) dry-configurable (~> 1) faraday (>= 0.11.0, < 3) faraday-detailed_logger (~> 2.1) @@ -28,21 +28,23 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) ipaddress (0.8.3) + json (2.7.2) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) method_source (1.0.0) multipart-post (2.3.0) openssl (3.2.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.2.6) + regexp_parser (2.9.2) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -56,26 +58,40 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (0.93.1) + rubocop (1.66.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-rspec (1.44.1) - rubocop (~> 0.87) - rubocop-ast (>= 0.7.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.3) + parser (>= 3.3.1.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - unicode-display_width (1.8.0) + standard (1.41.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.66.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.5) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.5.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.22.0) + unicode-display_width (2.6.0) zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES @@ -86,8 +102,8 @@ DEPENDENCIES pry (~> 0.10) rake (~> 13) rspec (~> 3.5) - rubocop (~> 0.48) - rubocop-rspec (~> 1.15) + standard (~> 1.31) + standard-performance (~> 1.2) BUNDLED WITH 2.4.10 diff --git a/gemfiles/faraday2.gemfile.lock b/gemfiles/faraday2.gemfile.lock index 312aff5..ccfa30f 100644 --- a/gemfiles/faraday2.gemfile.lock +++ b/gemfiles/faraday2.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - netbox-client-ruby (0.10.0) + netbox-client-ruby (0.10.1) dry-configurable (~> 1) faraday (>= 0.11.0, < 3) faraday-detailed_logger (~> 2.1) @@ -34,22 +34,24 @@ GEM faraday (~> 2.5) net-http-persistent (~> 4.0) ipaddress (0.8.3) + json (2.7.2) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) method_source (1.0.0) net-http-persistent (4.0.2) connection_pool (~> 2.2) openssl (3.2.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.2.6) + regexp_parser (2.9.2) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -63,27 +65,41 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (0.93.1) + rubocop (1.66.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-rspec (1.44.1) - rubocop (~> 0.87) - rubocop-ast (>= 0.7.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.3) + parser (>= 3.3.1.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - unicode-display_width (1.8.0) + standard (1.41.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.66.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.5) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.5.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.22.0) + unicode-display_width (2.6.0) zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES @@ -94,8 +110,8 @@ DEPENDENCIES pry (~> 0.10) rake (~> 13) rspec (~> 3.5) - rubocop (~> 0.48) - rubocop-rspec (~> 1.15) + standard (~> 1.31) + standard-performance (~> 1.2) BUNDLED WITH 2.4.10 diff --git a/netbox-client-ruby.gemspec b/netbox-client-ruby.gemspec index 19bca69..0b4382f 100644 --- a/netbox-client-ruby.gemspec +++ b/netbox-client-ruby.gemspec @@ -1,40 +1,40 @@ -lib = File.expand_path('lib', __dir__) +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| - spec.name = 'netbox-client-ruby' - spec.version = `git describe --tags --match="v[0-9]*" --abbrev=0`.strip.delete_prefix("v") + spec.name = "netbox-client-ruby" + spec.version = `git describe --tags --match="v[0-9]*" --abbrev=0`.strip.delete_prefix("v") - spec.summary = 'A read/write client for Netbox v2.' - spec.homepage = 'https://github.com/ninech/netbox-client-ruby' - spec.license = 'MIT' + spec.summary = "A read/write client for Netbox v2." + spec.homepage = "https://github.com/ninech/netbox-client-ruby" + spec.license = "MIT" - spec.authors = ['Christian Màˆder'] - spec.email = ['christian.maeder@nine.ch'] + spec.authors = ["Nine Internet Solutions AG"] + spec.email = ["support@nine.ch"] if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = 'https://rubygems.org' + spec.metadata["allowed_push_host"] = "https://rubygems.org" end spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end - spec.bindir = 'exe' - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ['lib'] - - spec.required_ruby_version = '>= 2.7.0' - - spec.add_runtime_dependency 'dry-configurable', '~> 1' - spec.add_runtime_dependency 'faraday', '>= 0.11.0', '< 3' - spec.add_runtime_dependency 'faraday-detailed_logger', '~> 2.1' - spec.add_runtime_dependency 'ipaddress', '~> 0.8', '>= 0.8.3' - spec.add_runtime_dependency 'openssl', '>= 2.0.5' - - spec.add_development_dependency 'bundler', '~> 2.1' - spec.add_development_dependency 'pry', '~> 0.10' - spec.add_development_dependency 'rake', '~> 13' - spec.add_development_dependency 'rspec', '~> 3.5' - spec.add_development_dependency 'rubocop', '~> 0.48' - spec.add_development_dependency 'rubocop-rspec', '~> 1.15' + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.required_ruby_version = ">= 2.7.0" + + spec.add_runtime_dependency "dry-configurable", "~> 1" + spec.add_runtime_dependency "faraday", ">= 0.11.0", "< 3" + spec.add_runtime_dependency "faraday-detailed_logger", "~> 2.1" + spec.add_runtime_dependency "ipaddress", "~> 0.8", ">= 0.8.3" + spec.add_runtime_dependency "openssl", ">= 2.0.5" + + spec.add_development_dependency "bundler", "~> 2.1" + spec.add_development_dependency "pry", "~> 0.10" + spec.add_development_dependency "rake", "~> 13" + spec.add_development_dependency "rspec", "~> 3.5" + spec.add_development_dependency "standard", "~> 1.31" + spec.add_development_dependency "standard-performance", "~> 1.2" end