diff options
Diffstat (limited to 'tasks/spellcheck.rb')
-rw-r--r-- | tasks/spellcheck.rb | 22 |
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) |