From a82f9b0f4b16c6cd2a21ecd2e6ba5140911318a1 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 3 Mar 2019 09:07:10 +0100 Subject: [PATCH] Bump minimal ruby to 2.3 net-ssh to 5, rubocop to 0.65 (#1718) Supporting 2.0 is becoming a chore due to increasingly newest versions of dependent packages are not supporting 2.0. We chose 2.3 because that seems next release that some relevant distributions are shipping with and because 2.3 comes with safe navigation operator ?. --- .rubocop.yml | 8 ++------ .rubocop_todo.yml | 38 ++++++++++++++++++++++++++++++-------- .travis.yml | 2 -- CHANGELOG.md | 1 + README.md | 26 ++++++++++---------------- oxidized.gemspec | 6 +++--- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 43f43fd75..f8c8104a5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,8 @@ inherit_from: .rubocop_todo.yml +# Do not attempt to police vendored code AllCops: - Include: - - Rakefile - -# Do not attempt to police vendored code, and exclude special cases -AllCops: - #TargetRubyVersion: 2.0 + TargetRubyVersion: 2.3 Exclude: - 'vendor/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f078e1acf..80b299d3f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,18 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2019-02-04 23:25:43 +0200 using RuboCop version 0.63.1. +# on 2019-03-02 20:02:35 +0100 using RuboCop version 0.65.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# Configuration parameters: Include. -# Include: **/*.gemspec -Gemspec/RequiredRubyVersion: - Exclude: - - 'oxidized.gemspec' - # Offense count: 680 Lint/AmbiguousRegexpLiteral: Enabled: false @@ -111,11 +104,32 @@ Style/DoubleNegation: - 'lib/oxidized/cli.rb' - 'lib/oxidized/hook/exec.rb' +# Offense count: 171 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: when_needed, always, never +Style/FrozenStringLiteralComment: + Enabled: false + # Offense count: 1 Style/IfUnlessModifierOfIfUnless: Exclude: - 'lib/oxidized/input/ssh.rb' +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/hook/githubrepo.rb' + - 'lib/oxidized/model/aricentiss.rb' + - 'lib/oxidized/model/dellx.rb' + - 'lib/oxidized/model/powerconnect.rb' + - 'lib/oxidized/worker.rb' + # Offense count: 1 # Cop supports --auto-correct. Style/Proc: @@ -129,6 +143,14 @@ Style/Proc: Style/RegexpLiteral: Enabled: false +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. +# Whitelist: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/oxidized/input/http.rb' + # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AllowAsExpressionSeparator. diff --git a/.travis.yml b/.travis.yml index 3cdd5b3b8..6fa5984f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ before_install: - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - gem install bundler -v '< 2' rvm: - - 2.1 - - 2.2 - 2.3 - 2.4 - 2.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index fa58ccd15..3562b22ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * FEATURE: add raisecom RAX model (@vitalisator) * FEATURE: add huawei smartax model (@nyash) * MISC: prompt updates in siklu, netonix, netscaler models +* MISC: minimal supported ruby is now 2.3, net-ssh dependency ~> 5, rubocop ~> 0.65.0 ## 0.25.0 diff --git a/README.md b/README.md index f81f400c4..1553b238f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h * [FreeBSD](#freebsd) * [Build from Git](#build-from-git) * [Docker](#running-with-docker) - * [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm) + * [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm) 3. [Initial Configuration](#configuration) 4. [Configuration](docs/Configuration.md) * [Debugging](docs/Configuration.md#debugging) @@ -98,15 +98,9 @@ gem install oxidized-script oxidized-web # If you don't install oxidized-web, en ### CentOS, Oracle Linux, Red Hat Linux -On CentOS 6 / RHEL 6, begin by installing Ruby 2.0 or greater. For Ruby 2.1.2 installation instructions see [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm). +On CentOS 6 and 7 / RHEL 6 and 7, begin by installing Ruby 2.3 or greater by following the instructions at [Installing Ruby 2.3 using RVM](#installing-ruby-23-using-rvm). -If you've installed Ruby 2.0 or greater via a 3rd party package rather than the RVM instructions, additional dependencies will be required: - -```shell -yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++ -``` - -RHEL 7 / CentOS 7 will work out of the box with the following package list: +If you've installed Ruby 2.3 or greater via a 3rd party package rather than the RVM instructions, additional dependencies will be required: ```shell yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++ @@ -121,7 +115,7 @@ gem install oxidized-script oxidized-web # if you don't install oxidized-web, ma ### FreeBSD -[Use RVM to install Ruby v2.1.2](#installing-ruby-212-using-rvm), then install all required packages and gems: +[Use RVM to install Ruby v2.3](#installing-ruby-23-using-rvm), then install all required packages and gems: ```shell pkg install cmake pkgconf @@ -225,9 +219,9 @@ If you need to use an internal CA (e.g. to connect to an private github instance docker run -v /etc/oxidized:/root/.config/oxidized -v /path/to/MY-CA.crt:/usr/local/share/ca-certificates/MY-CA.crt -p 8888:8888/tcp -e UPDATE_CA_CERTIFICATES=true -t oxidized/oxidized:latest ``` -### Installing Ruby 2.1.2 using RVM +### Installing Ruby 2.3 using RVM -Install Ruby 2.1.2 build dependencies +Install Ruby 2.3 build dependencies ```shell yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel @@ -241,12 +235,12 @@ Install RVM curl -L get.rvm.io | bash -s stable ``` -Setup RVM environment and compile and install Ruby 2.1.2 and set it as default +Setup RVM environment and compile and install Ruby 2.3 and set it as default ```shell source /etc/profile.d/rvm.sh -rvm install 2.1.2 -rvm use --default 2.1.2 +rvm install 2.3 +rvm use --default 2.3 ``` ## Configuration @@ -286,7 +280,7 @@ Oxidized supports [CSV](docs/Configuration.md#source-csv), [SQLite](docs/Config Possible outputs are either [File](docs/Configuration.md#output-file), [GIT](docs/Configuration.md#output-git), [GIT-Crypt](docs/Configuration.md#output-git-crypt) and [HTTP](docs/Configuration.md#output-http). The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using `git-crypt` tool. Take a look at the [Configuration](docs/Configuration.md) for more details. -Maps define how to map a model's fields to model [model fields](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model). Most of the settings should be self explanatory, log is ignored if `use_syslog`(requires Ruby >= 2.0) is set to `true`. +Maps define how to map a model's fields to model [model fields](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model). Most of the settings should be self explanatory, log is ignored if `use_syslog` is set to `true`. First create the directory where the CSV `output` is going to store device configs and start Oxidized once. diff --git a/oxidized.gemspec b/oxidized.gemspec index d8416ee8b..ec6d49d81 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -17,9 +17,9 @@ Gem::Specification.new do |s| s.executables = %w[oxidized] s.require_path = 'lib' - s.required_ruby_version = '>= 2.0.0' + s.required_ruby_version = '>= 2.3' s.add_runtime_dependency 'asetus', '~> 0.1' - s.add_runtime_dependency 'net-ssh', '~> 4.1.0' + s.add_runtime_dependency 'net-ssh', '~> 5' s.add_runtime_dependency 'net-telnet', '~> 0.1.1' s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4' s.add_runtime_dependency 'slop', '~> 3.5' @@ -31,6 +31,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'mocha', '~> 1.1' s.add_development_dependency 'pry', '~> 0' s.add_development_dependency 'rake', '~> 10.0' - s.add_development_dependency 'rubocop', '~> 0.57.1' + s.add_development_dependency 'rubocop', '~> 0.65.0' s.add_development_dependency 'simplecov' end