diff --git a/.rubocop.yml b/.rubocop.yml index 8ca7d19..9047799 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,4 +2,7 @@ AllCops: Exclude: - 'vendor/**/*' - 'spec/fixtures/**/*' - TargetRubyVersion: 2.0 + TargetRubyVersion: 2.5 +Style/CommentedKeyword: + Enabled: false + diff --git a/.travis.yml b/.travis.yml index 74b395a..4dd725e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ os: # - osx rvm: - - 2.4.1 - - 2.3.1 + - 2.5 + - 2.6 before_install: - gem update --system diff --git a/Gemfile b/Gemfile index e55fa26..4f2f8d6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # vim:ft=ruby source 'https://rubygems.org' @@ -22,7 +24,7 @@ group :development, :unit_tests do gem 'metadata-json-lint', '~> 2.0' gem 'puppetlabs_spec_helper', '~> 2.3' gem 'rspec-puppet', '~> 2.6' - gem 'rubocop', '~> 0.50' + gem 'rubocop', '~> 0.78' gem 'tty-command', '~> 0.6' gem 'tty-file', '~> 0.4' gem 'tty-prompt', '~> 0.13' diff --git a/Gemfile.lock b/Gemfile.lock index 343450e..2bbe471 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,69 +1,69 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.5) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - ast (2.3.0) + CFPropertyList (2.3.6) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + ast (2.4.0) colored (1.2) cri (2.6.1) colored (~> 1.2) diff-lcs (1.3) - equatable (0.5.0) - facter (2.5.1) - facter (2.5.1-universal-darwin) + equatable (0.6.1) + facter (2.5.6) + facter (2.5.6-universal-darwin) CFPropertyList (~> 2.2) - faraday (0.9.2) + faraday (0.13.1) multipart-post (>= 1.2, < 3) - faraday_middleware (0.10.1) + faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) - fast_gettext (1.1.0) - gettext (3.2.4) + fast_gettext (1.1.2) + gettext (3.2.9) locale (>= 2.0.5) text (>= 1.3.0) - gettext-setup (0.28) + gettext-setup (0.31) fast_gettext (~> 1.1.0) gettext (>= 3.0.2) locale - hiera (3.4.2) - hitimes (1.2.6) - json (2.1.0) - json-schema (2.8.0) + hiera (3.6.0) + jaro_winkler (1.5.4) + json (2.3.0) + json-schema (2.8.1) addressable (>= 2.4) locale (2.1.2) log4r (1.1.10) - metaclass (0.0.4) - metadata-json-lint (2.0.2) + metadata-json-lint (2.2.0) json-schema (~> 2.8) spdx-licenses (~> 1.0) - minitar (0.6.1) - mocha (1.3.0) - metaclass (~> 0.0.1) - multi_json (1.12.2) - multipart-post (2.0.0) - necromancer (0.4.0) - os (1.0.0) - parallel (1.12.0) - parser (2.4.0.0) - ast (~> 2.2) - pastel (0.7.1) - equatable (~> 0.5.0) - tty-color (~> 0.4.0) - powerpack (0.1.1) - public_suffix (3.0.0) - puppet (5.3.2) - facter (> 2.0, < 4) - gettext-setup (>= 0.10, < 1) + minitar (0.9) + mocha (1.11.1) + multi_json (1.14.1) + multipart-post (2.1.1) + necromancer (0.5.1) + os (1.0.1) + parallel (1.19.1) + parser (2.7.0.0) + ast (~> 2.4.0) + pastel (0.7.3) + equatable (~> 0.6) + tty-color (~> 0.5) + pathspec (0.2.1) + public_suffix (4.0.1) + puppet (5.5.17) + facter (> 2.0.1, < 4) + fast_gettext (~> 1.1.2) hiera (>= 3.2.1, < 4) locale (~> 2.1) - puppet (5.3.2-universal-darwin) + multi_json (~> 1.10) + puppet (5.5.17-universal-darwin) CFPropertyList (~> 2.2) - facter (> 2.0, < 4) - gettext-setup (>= 0.10, < 1) + facter (> 2.0.1, < 4) + fast_gettext (~> 1.1.2) hiera (>= 3.2.1, < 4) locale (~> 2.1) - puppet-lint (2.3.3) - puppet-lint-absolute_classname-check (0.2.4) + multi_json (~> 1.10) + puppet-lint (2.4.2) + puppet-lint-absolute_classname-check (0.2.5) puppet-lint (>= 1.0, < 3.0) puppet-lint-absolute_template_path (1.0.1) puppet-lint (>= 1.1, < 3.0) @@ -71,7 +71,7 @@ GEM puppet-lint (>= 1.0, < 3.0) puppet-lint-leading_zero-check (0.1.1) puppet-lint (>= 1.0, < 3.0) - puppet-lint-resource_reference_syntax (1.0.10) + puppet-lint-resource_reference_syntax (1.0.14) puppet-lint (>= 1.0, < 3.0) puppet-lint-spaceship_operator_without_tag-check (0.1.1) puppet-lint (>= 1.0, < 3.0) @@ -83,79 +83,76 @@ GEM puppet-lint (>= 1.0, < 3.0) puppet-lint-variable_contains_upcase (1.2.0) puppet-lint (>= 1.0, < 3.0) - puppet-syntax (2.4.1) + puppet-syntax (2.6.0) rake - puppet_forge (2.2.6) - faraday (~> 0.9.0) - faraday_middleware (>= 0.9.0, < 0.11.0) + puppet_forge (2.2.9) + faraday (>= 0.9.0, < 0.14.0) + faraday_middleware (>= 0.9.0, < 0.13.0) gettext-setup (~> 0.11) minitar - semantic_puppet (~> 0.1.0) - puppetlabs_spec_helper (2.3.2) + semantic_puppet (~> 1.0) + puppetlabs_spec_helper (2.14.1) mocha (~> 1.0) + pathspec (~> 0.2.1) puppet-lint (~> 2.0) puppet-syntax (~> 2.0) rspec-puppet (~> 2.0) - r10k (2.5.5) + r10k (2.6.7) colored (= 1.2) cri (~> 2.6.1) gettext-setup (~> 0.5) log4r (= 1.1.10) multi_json (~> 1.10) - puppet_forge (~> 2.2) - semantic_puppet (~> 0.1.0) - rainbow (2.2.2) - rake - rake (12.1.0) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + puppet_forge (~> 2.2.8) + rainbow (3.0.0) + rake (13.0.1) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-mocks (3.6.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-puppet (2.6.9) + rspec-support (~> 3.9.0) + rspec-puppet (2.7.8) rspec - rspec-support (3.6.0) - rubocop (0.50.0) + rspec-support (3.9.0) + rubocop (0.78.0) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.3.3.1, < 3.0) - powerpack (~> 0.1) - rainbow (>= 2.2.2, < 3.0) + parser (>= 2.6) + rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.9.0) - rugged (0.26.0) - semantic_puppet (0.1.4) - gettext-setup (>= 0.3) - spdx-licenses (1.1.0) + unicode-display_width (>= 1.4.0, < 1.7) + ruby-progressbar (1.10.1) + rugged (0.28.4.1) + semantic_puppet (1.0.2) + spdx-licenses (1.2.0) text (1.3.1) - timers (4.1.2) - hitimes - trollop (2.1.2) - tty-color (0.4.2) - tty-command (0.6.0) + trollop (2.9.10) + tty-color (0.5.0) + tty-command (0.9.0) pastel (~> 0.7.0) - tty-cursor (0.5.0) - tty-file (0.4.0) - diff-lcs (~> 1.3.0) - pastel (~> 0.7.1) - tty-prompt (~> 0.13.2) - tty-prompt (0.13.2) - necromancer (~> 0.4.0) + tty-cursor (0.7.0) + tty-file (0.8.0) + diff-lcs (~> 1.3) + pastel (~> 0.7.2) + tty-prompt (~> 0.18) + tty-prompt (0.20.0) + necromancer (~> 0.5.0) pastel (~> 0.7.0) - timers (~> 4.1.2) - tty-cursor (~> 0.5.0) - tty-reader (~> 0.1.0) - tty-reader (0.1.0) + tty-reader (~> 0.7.0) + tty-reader (0.7.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.7) wisper (~> 2.0.0) - unicode-display_width (1.3.0) - wisper (2.0.0) + tty-screen (0.7.0) + unicode-display_width (1.6.0) + wisper (2.0.1) xmlrpc (0.3.0) yamllint (0.0.9) trollop (~> 2) @@ -184,7 +181,7 @@ DEPENDENCIES puppetlabs_spec_helper (~> 2.3) r10k (~> 2.5) rspec-puppet (~> 2.6) - rubocop (~> 0.50) + rubocop (~> 0.78) rugged (~> 0.26) tty-command (~> 0.6) tty-file (~> 0.4) @@ -193,4 +190,4 @@ DEPENDENCIES yamllint (~> 0.0.9) BUNDLED WITH - 1.15.4 + 2.0.2 diff --git a/Rakefile b/Rakefile index 3e367e5..0910ef1 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rubocop/rake_task' require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' diff --git a/Vagrantfile b/Vagrantfile index 6579212..ed6b50e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Vagrant.configure('2') do |config| config.vm.box = 'genebean/centos-7-nocm' end diff --git a/bin/dots.rb b/bin/dots.rb index f861bf8..360b5c7 100755 --- a/bin/dots.rb +++ b/bin/dots.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'open3' require 'os' require 'tty-command' diff --git a/bin/dotutils.rb b/bin/dotutils.rb index 8a337b1..0df94a7 100644 --- a/bin/dotutils.rb +++ b/bin/dotutils.rb @@ -1,5 +1,8 @@ +# frozen_string_literal: true + def existing_symlink(source, destination) return if File.readlink(destination).eql?(source) + # rubocop:disable Metrics/LineLength if @prompt.yes?("#{destination} currently points to #{File.readlink(destination)}, do you want point it at #{source}?") File.unlink(destination) diff --git a/bin/rake_tasks.rb b/bin/rake_tasks.rb index c678377..c91989d 100644 --- a/bin/rake_tasks.rb +++ b/bin/rake_tasks.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + desc 'Run dots' task :dots do ruby 'bin/dots.rb' diff --git a/puppet/production/Puppetfile b/puppet/production/Puppetfile index d079145..7662506 100644 --- a/puppet/production/Puppetfile +++ b/puppet/production/Puppetfile @@ -1,4 +1,5 @@ -# rubocop:disable Lint/UnneededDisable, Naming +# frozen_string_literal: true + forge 'http://forge.puppetlabs.com' # rubocop:disable Metrics/LineLength diff --git a/puppet/production/scripts/config_version.rb b/puppet/production/scripts/config_version.rb index 8a19a95..fb4ed1d 100755 --- a/puppet/production/scripts/config_version.rb +++ b/puppet/production/scripts/config_version.rb @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + begin require 'rugged' rescue LoadError diff --git a/puppet/production/site/custom_libs/lib/facter/os_release.rb b/puppet/production/site/custom_libs/lib/facter/os_release.rb index 1b3e883..3d9f94f 100644 --- a/puppet/production/site/custom_libs/lib/facter/os_release.rb +++ b/puppet/production/site/custom_libs/lib/facter/os_release.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Facter.add(:os_release) do confine kernel: 'Linux' @@ -7,12 +9,12 @@ Facter.add(:os_release) do os_release_hash = {} File.open(file_path, 'r') do |file| file.each_line do |line| - unless line.nil? or line.strip.length.eql? 0 - line_data = line.split('=') - key = line_data[0].downcase - value = line_data[1].strip.gsub(/(^\")|(\"$)/, '') - os_release_hash[key] = value - end + next if line.nil? || line.strip.length.eql?(0) + + line_data = line.split('=') + key = line_data[0].downcase + value = line_data[1].strip.gsub(/(^\")|(\"$)/, '') + os_release_hash[key] = value end end os_release_hash diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb b/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb index 68e589a..60d63a9 100644 --- a/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb +++ b/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Functions.create_function(:find_group) do dispatch :find_group do param 'String', :some_path diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb b/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb index 105ce2e..8a6e1fb 100644 --- a/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb +++ b/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Functions.create_function(:find_owner) do dispatch :find_owner do param 'String', :some_path diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb b/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb index ffd485d..7de542c 100644 --- a/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb +++ b/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Functions.create_function(:homedir_to_user) do dispatch :homedir_to_user do param 'String', :some_path