summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-04-20 14:57:20 +0100
committerThom May <thom@chef.io>2016-04-20 14:57:20 +0100
commitecfa1343b6e5836d8ab792be83b5e096e1201fa7 (patch)
tree1abf59109f17d9da51cf451381ff2a4700fbc4db /lib
parent3d70714756bd315abd4fab9031c87aaed59ae5a2 (diff)
downloadchef-ecfa1343b6e5836d8ab792be83b5e096e1201fa7.tar.gz
update to latest chefstyle - fix casecmptm/fix_casecmp
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/http/json_input.rb4
-rw-r--r--lib/chef/knife.rb2
-rw-r--r--lib/chef/provider/env/windows.rb2
-rw-r--r--lib/chef/provider/package/windows.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/http/json_input.rb b/lib/chef/http/json_input.rb
index eaee96d88a..4cc1aa2e10 100644
--- a/lib/chef/http/json_input.rb
+++ b/lib/chef/http/json_input.rb
@@ -33,7 +33,7 @@ class Chef
def handle_request(method, url, headers = {}, data = false)
if data && should_encode_as_json?(headers)
- headers.delete_if { |key, _value| key.downcase == "content-type" }
+ headers.delete_if { |key, _value| key.casecmp("content-type").zero? }
headers["Content-Type"] = "application/json"
json_opts = {}
json_opts[:validate_utf8] = opts[:validate_utf8] if opts.has_key?(:validate_utf8)
@@ -64,7 +64,7 @@ class Chef
# ruby/Net::HTTP don't enforce capitalized headers (it normalizes them
# for you before sending the request), so we have to account for all
# the variations we might find
- requested_content_type = headers.find { |k, v| k.downcase == "content-type" }
+ requested_content_type = headers.find { |k, v| k.casecmp("content-type").zero? }
requested_content_type.nil? || requested_content_type.last.include?("json")
end
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index a27a3b332b..356bf47fd4 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -145,7 +145,7 @@ class Chef
end
def self.subcommand_class_from(args)
- if args.size == 1 && args[0].strip.downcase == "rehash"
+ if args.size == 1 && args[0].strip.casecmp("rehash").zero?
# To prevent issues with the rehash file not pointing to the correct plugins,
# we always use the glob loader when regenerating the rehash file
@subcommand_loader = Chef::Knife::SubcommandLoader.gem_glob_loader(chef_config_dir)
diff --git a/lib/chef/provider/env/windows.rb b/lib/chef/provider/env/windows.rb
index 684386abe4..a68c8276e0 100644
--- a/lib/chef/provider/env/windows.rb
+++ b/lib/chef/provider/env/windows.rb
@@ -36,7 +36,7 @@ class Chef
obj.variablevalue = @new_resource.value
obj.put_
value = @new_resource.value
- value = expand_path(value) if @new_resource.key_name.upcase == "PATH"
+ value = expand_path(value) if @new_resource.key_name.casecmp("PATH").zero?
ENV[@new_resource.key_name] = value
broadcast_env_change
end
diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb
index 02137a5525..a5f3ff7191 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -260,7 +260,7 @@ class Chef
if source_location.nil?
inferred_registry_type == :msi
else
- ::File.extname(source_location).downcase == ".msi"
+ ::File.extname(source_location).casecmp(".msi").zero?
end
end
end