diff options
-rw-r--r-- | tasks/spellcheck.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb index a3ffb577d7..9a4aee3e77 100644 --- a/tasks/spellcheck.rb +++ b/tasks/spellcheck.rb @@ -20,27 +20,33 @@ namespace :spellcheck do sh 'cspell lint --no-progress "**/*"' end - task prereqs: %i{wget_check cspell_check config_check fetch_common} + task prereqs: %i{curl_check cspell_check config_check fetch_common} - task :wget_check do - wget_version = begin - `wget --version` + task :curl_check do + curl_version = begin + `curl --version` rescue nil end - wget_version.is_a?(String) || abort(<<~INSTALL_WGET) - wget is not installed - INSTALL_WGET + 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 '#{config_file}' not found, skipping spellcheck" + end + config_file = "cspell.json" unless File.readable?(config_file) |