diff --git a/.rubocop.yml b/.rubocop.yml index 9909d8e..ea9207d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,9 @@ --- require: - - chefstyle + - cookstyle/chefstyle AllCops: + TargetRubyVersion: 3.1 Include: - "**/*.rb" Exclude: diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..b7175b0 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +@test-kitchen/maintainers diff --git a/Gemfile b/Gemfile index b7f5109..8eb5922 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,5 @@ source "https://rubygems.org" -# Specify your gem's dependencies in kitchen-dokken.gemspec gemspec group :test do @@ -11,9 +10,8 @@ end group :development do gem "pry" - gem "pry-byebug" end -group :chefstyle do - gem "chefstyle", "2.2.3" +group :linting do + gem "cookstyle", "7.32.8" end diff --git a/Rakefile b/Rakefile index 062d545..d541a04 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,13 @@ require "bundler/gem_tasks" -require "chefstyle" -require "rubocop/rake_task" -RuboCop::RakeTask.new(:style) do |task| - task.options += ["--display-cop-names", "--no-color"] +begin + require "cookstyle/chefstyle" + require "rubocop/rake_task" + RuboCop::RakeTask.new(:style) do |task| + task.options += ["--display-cop-names", "--no-color"] + end +rescue LoadError + puts "cookstyle/chefstyle is not available. (sudo) gem install cookstyle to do style checking." end task default: %i{style} diff --git a/kitchen-dokken.gemspec b/kitchen-dokken.gemspec index 3e6fd07..25b3122 100644 --- a/kitchen-dokken.gemspec +++ b/kitchen-dokken.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.files = %w{LICENSE kitchen-dokken.gemspec Gemfile Rakefile} + Dir.glob("lib/**/*") spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.1" spec.add_dependency "docker-api", ">= 1.33", "< 3" spec.add_dependency "lockfile", "~> 2.1" diff --git a/lib/kitchen/driver/dokken.rb b/lib/kitchen/driver/dokken.rb index bafdb69..63d39d5 100644 --- a/lib/kitchen/driver/dokken.rb +++ b/lib/kitchen/driver/dokken.rb @@ -465,7 +465,7 @@ def docker_config_creds next if v["auth"].nil? username, password = Base64.decode64(v["auth"]).split(":") - @docker_config_creds[k] = { serveraddress: k, username: username, password: password } + @docker_config_creds[k] = { serveraddress: k, username:, password: } end end diff --git a/lib/kitchen/transport/dokken.rb b/lib/kitchen/transport/dokken.rb index 9e0b75e..f2d8f93 100644 --- a/lib/kitchen/transport/dokken.rb +++ b/lib/kitchen/transport/dokken.rb @@ -165,11 +165,11 @@ def upload(locals, remote) debug "Rsync is not installed. Falling back to SCP." locals.each do |local| Net::SCP.upload!(ssh_ip, - "root", - local, - remote, - recursive: true, - ssh: { port: ssh_port, keys: ["#{tmpdir}/id_rsa"] }) + "root", + local, + remote, + recursive: true, + ssh: { port: ssh_port, keys: ["#{tmpdir}/id_rsa"] }) end end end diff --git a/test/cookbooks/dokken_test/recipes/default.rb b/test/cookbooks/dokken_test/recipes/default.rb index 34a90c3..527dcd5 100644 --- a/test/cookbooks/dokken_test/recipes/default.rb +++ b/test/cookbooks/dokken_test/recipes/default.rb @@ -57,9 +57,9 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375", - "CHEF_LICENSE" => "accept-no-persist" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375", + "CHEF_LICENSE" => "accept-no-persist" action :run end @@ -69,8 +69,8 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375" action :run end @@ -87,8 +87,8 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375", - "CHEF_LICENSE" => "accept-no-persist" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375", + "CHEF_LICENSE" => "accept-no-persist" action :run end