summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-10-27 07:32:48 -0700
committerGitHub <noreply@github.com>2021-10-27 07:32:48 -0700
commitede42c858d735bde1ee2e8173267881cfa707159 (patch)
tree6fa84cea90386cc47ff84039745ee8a8e04234ae
parent694c07c9ee1cdd6fd9663ace6a21067c5140ff84 (diff)
parent5b34298e7a9bb0b3ff35d47a3811435441616503 (diff)
downloadchef-ede42c858d735bde1ee2e8173267881cfa707159.tar.gz
Merge pull request #12211 from rpunt/test-wget-present
replace wget with curl in 'rake spellcheck'
-rw-r--r--tasks/spellcheck.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb
index 0eb8924a81..d43495a7ae 100644
--- a/tasks/spellcheck.rb
+++ b/tasks/spellcheck.rb
@@ -20,15 +20,33 @@ namespace :spellcheck do
sh 'cspell lint --no-progress "**/*"'
end
- task prereqs: %i{cspell_check config_check fetch_common}
+ task prereqs: %i{curl_check cspell_check config_check fetch_common}
+
+ task :curl_check do
+ curl_version = begin
+ `curl --version`
+ rescue
+ nil
+ end
+
+ curl_version.is_a?(String) || abort(<<~INSTALL_CURL)
+ curl is not available, cannot download chef_dictionary.txt
+ INSTALL_CURL
+ end
task :fetch_common do
- sh "wget -q https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -O chef_dictionary.txt"
+ sh "curl -s https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -o chef_dictionary.txt"
end
task :config_check do
require "json"
+ chef_dictionary = "chef_dictionary.txt"
+
+ unless File.readable?(chef_dictionary)
+ abort "Dictionary file '#{chef_dictionary}' not found, skipping spellcheck"
+ end
+
config_file = "cspell.json"
unless File.readable?(config_file)