summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /lib/chef/mixin
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/checksum.rb4
-rw-r--r--lib/chef/mixin/command.rb14
-rw-r--r--lib/chef/mixin/command/unix.rb2
-rw-r--r--lib/chef/mixin/command/windows.rb2
-rw-r--r--lib/chef/mixin/convert_to_class_name.rb12
-rw-r--r--lib/chef/mixin/create_path.rb2
-rw-r--r--lib/chef/mixin/enforce_ownership_and_permissions.rb2
-rw-r--r--lib/chef/mixin/file_class.rb2
-rw-r--r--lib/chef/mixin/homebrew_user.rb6
-rw-r--r--lib/chef/mixin/language.rb6
-rw-r--r--lib/chef/mixin/language_include_attribute.rb4
-rw-r--r--lib/chef/mixin/language_include_recipe.rb4
-rw-r--r--lib/chef/mixin/params_validate.rb6
-rw-r--r--lib/chef/mixin/path_sanity.rb4
-rw-r--r--lib/chef/mixin/powershell_out.rb4
-rw-r--r--lib/chef/mixin/powershell_type_coercions.rb6
-rw-r--r--lib/chef/mixin/properties.rb6
-rw-r--r--lib/chef/mixin/provides.rb2
-rw-r--r--lib/chef/mixin/proxified_socket.rb6
-rw-r--r--lib/chef/mixin/recipe_definition_dsl_core.rb2
-rw-r--r--lib/chef/mixin/shell_out.rb16
-rw-r--r--lib/chef/mixin/template.rb4
-rw-r--r--lib/chef/mixin/uris.rb2
-rw-r--r--lib/chef/mixin/which.rb4
-rw-r--r--lib/chef/mixin/wide_string.rb12
-rw-r--r--lib/chef/mixin/windows_architecture_helper.rb14
-rw-r--r--lib/chef/mixin/windows_env_helper.rb16
-rw-r--r--lib/chef/mixin/xml_escape.rb10
28 files changed, 87 insertions, 87 deletions
diff --git a/lib/chef/mixin/checksum.rb b/lib/chef/mixin/checksum.rb
index 1d9c99ec7e..f805efae9a 100644
--- a/lib/chef/mixin/checksum.rb
+++ b/lib/chef/mixin/checksum.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'digest/sha2'
-require 'chef/digester'
+require "digest/sha2"
+require "chef/digester"
class Chef
module Mixin
diff --git a/lib/chef/mixin/command.rb b/lib/chef/mixin/command.rb
index d9a9c4f006..ea6e5f19fc 100644
--- a/lib/chef/mixin/command.rb
+++ b/lib/chef/mixin/command.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/exceptions'
-require 'tmpdir'
-require 'fcntl'
-require 'etc'
+require "chef/log"
+require "chef/exceptions"
+require "tmpdir"
+require "fcntl"
+require "etc"
class Chef
module Mixin
@@ -50,11 +50,11 @@ class Chef
# NOTE: run_command is deprecated in favor of using Chef::Shellout which now comes from the mixlib-shellout gem. NOTE #
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/mixin/command/windows'
+ require "chef/mixin/command/windows"
include ::Chef::Mixin::Command::Windows
extend ::Chef::Mixin::Command::Windows
else
- require 'chef/mixin/command/unix'
+ require "chef/mixin/command/unix"
include ::Chef::Mixin::Command::Unix
extend ::Chef::Mixin::Command::Unix
end
diff --git a/lib/chef/mixin/command/unix.rb b/lib/chef/mixin/command/unix.rb
index 2bad4e6bcf..710324caa0 100644
--- a/lib/chef/mixin/command/unix.rb
+++ b/lib/chef/mixin/command/unix.rb
@@ -104,7 +104,7 @@ class Chef
else
Kernel.exec(cmd)
end
- raise 'forty-two'
+ raise "forty-two"
rescue Exception => e
Marshal.dump(e, ps.last)
ps.last.flush
diff --git a/lib/chef/mixin/command/windows.rb b/lib/chef/mixin/command/windows.rb
index 0147d58039..9cd1162234 100644
--- a/lib/chef/mixin/command/windows.rb
+++ b/lib/chef/mixin/command/windows.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'open3'
+require "open3"
class Chef
module Mixin
diff --git a/lib/chef/mixin/convert_to_class_name.rb b/lib/chef/mixin/convert_to_class_name.rb
index 14676e5ed4..8ac42cb218 100644
--- a/lib/chef/mixin/convert_to_class_name.rb
+++ b/lib/chef/mixin/convert_to_class_name.rb
@@ -42,7 +42,7 @@ class Chef
def convert_to_snake_case(str, namespace=nil)
str = str.dup
- str.sub!(/^#{namespace}(\:\:)?/, '') if namespace
+ str.sub!(/^#{namespace}(\:\:)?/, "") if namespace
str.gsub!(/[A-Z]/) {|s| "_" + s}
str.downcase!
str.sub!(/^\_/, "")
@@ -51,19 +51,19 @@ class Chef
def normalize_snake_case_name(str)
str = str.dup
- str.gsub!(/[^A-Za-z0-9_]/,'_')
- str.gsub!(/^(_+)?/,'')
+ str.gsub!(/[^A-Za-z0-9_]/,"_")
+ str.gsub!(/^(_+)?/,"")
str
end
def snake_case_basename(str)
with_namespace = convert_to_snake_case(str)
- with_namespace.split("::").last.sub(/^_/, '')
+ with_namespace.split("::").last.sub(/^_/, "")
end
def filename_to_qualified_string(base, filename)
file_base = File.basename(filename, ".rb")
- str = base.to_s + (file_base == 'default' ? '' : "_#{file_base}")
+ str = base.to_s + (file_base == "default" ? "" : "_#{file_base}")
normalize_snake_case_name(str)
end
@@ -91,7 +91,7 @@ class Chef
# NameError is raised when the name is not in CamelCase or the constant is
# unknown.
def constantize(camel_cased_word)
- names = camel_cased_word.split('::')
+ names = camel_cased_word.split("::")
# Trigger a built-in NameError exception including the ill-formed constant in the message.
Object.const_get(camel_cased_word) if names.empty?
diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb
index 547224dda9..ee0f80448f 100644
--- a/lib/chef/mixin/create_path.rb
+++ b/lib/chef/mixin/create_path.rb
@@ -35,7 +35,7 @@ class Chef
if file_path.kind_of?(String)
file_path = File.expand_path(file_path).split(File::SEPARATOR)
- file_path.shift if file_path[0] == ''
+ file_path.shift if file_path[0] == ""
# Check if path starts with a separator or drive letter (Windows)
unless file_path[0].match("^#{File::SEPARATOR}|^[a-zA-Z]:")
file_path[0] = "#{File::SEPARATOR}#{file_path[0]}"
diff --git a/lib/chef/mixin/enforce_ownership_and_permissions.rb b/lib/chef/mixin/enforce_ownership_and_permissions.rb
index 9c1e4dda93..4dbdef0451 100644
--- a/lib/chef/mixin/enforce_ownership_and_permissions.rb
+++ b/lib/chef/mixin/enforce_ownership_and_permissions.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/file_access_control'
+require "chef/file_access_control"
class Chef
module Mixin
diff --git a/lib/chef/mixin/file_class.rb b/lib/chef/mixin/file_class.rb
index 347ef45ba9..f612cec148 100644
--- a/lib/chef/mixin/file_class.rb
+++ b/lib/chef/mixin/file_class.rb
@@ -24,7 +24,7 @@ class Chef
def file_class
@host_os_file ||= if Chef::Platform.windows?
- require 'chef/win32/file'
+ require "chef/win32/file"
Chef::ReservedNames::Win32::File
else
::File
diff --git a/lib/chef/mixin/homebrew_user.rb b/lib/chef/mixin/homebrew_user.rb
index ab6fb19563..6be3536814 100644
--- a/lib/chef/mixin/homebrew_user.rb
+++ b/lib/chef/mixin/homebrew_user.rb
@@ -22,8 +22,8 @@
# This lives here in Chef::Mixin because Chef's namespacing makes it
# awkward to use modules elsewhere (e.g., chef/provider/package/homebrew/owner)
-require 'chef/mixin/shell_out'
-require 'etc'
+require "chef/mixin/shell_out"
+require "etc"
class Chef
module Mixin
@@ -48,7 +48,7 @@ class Chef
private
def calculate_owner
- default_brew_path = '/usr/local/bin/brew'
+ default_brew_path = "/usr/local/bin/brew"
if ::File.exist?(default_brew_path)
# By default, this follows symlinks which is what we want
owner = ::File.stat(default_brew_path).uid
diff --git a/lib/chef/mixin/language.rb b/lib/chef/mixin/language.rb
index f4df86bdc3..45e96472c6 100644
--- a/lib/chef/mixin/language.rb
+++ b/lib/chef/mixin/language.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/data_query'
-require 'chef/mixin/deprecation'
+require "chef/dsl/platform_introspection"
+require "chef/dsl/data_query"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/language_include_attribute.rb b/lib/chef/mixin/language_include_attribute.rb
index 0be2614e41..351ce6ad44 100644
--- a/lib/chef/mixin/language_include_attribute.rb
+++ b/lib/chef/mixin/language_include_attribute.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/dsl/include_attribute'
-require 'chef/mixin/deprecation'
+require "chef/dsl/include_attribute"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/language_include_recipe.rb b/lib/chef/mixin/language_include_recipe.rb
index d85e5c682d..8e608516d9 100644
--- a/lib/chef/mixin/language_include_recipe.rb
+++ b/lib/chef/mixin/language_include_recipe.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/dsl/include_recipe'
-require 'chef/mixin/deprecation'
+require "chef/dsl/include_recipe"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb
index e3c7657b1b..841cf9e6a2 100644
--- a/lib/chef/mixin/params_validate.rb
+++ b/lib/chef/mixin/params_validate.rb
@@ -15,9 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/constants'
-require 'chef/property'
-require 'chef/delayed_evaluator'
+require "chef/constants"
+require "chef/property"
+require "chef/delayed_evaluator"
class Chef
module Mixin
diff --git a/lib/chef/mixin/path_sanity.rb b/lib/chef/mixin/path_sanity.rb
index ed857ffd36..00eba5876e 100644
--- a/lib/chef/mixin/path_sanity.rb
+++ b/lib/chef/mixin/path_sanity.rb
@@ -23,7 +23,7 @@ class Chef
def enforce_path_sanity(env=ENV)
if Chef::Config[:enforce_path_sanity]
env["PATH"] = "" if env["PATH"].nil?
- path_separator = Chef::Platform.windows? ? ';' : ':'
+ path_separator = Chef::Platform.windows? ? ";" : ":"
existing_paths = env["PATH"].split(path_separator)
# ensure the Ruby and Gem bindirs are included
# mainly for 'full-stack' Chef installs
@@ -56,7 +56,7 @@ class Chef
end
def ruby_bindir
- RbConfig::CONFIG['bindir']
+ RbConfig::CONFIG["bindir"]
end
def gem_bindir
diff --git a/lib/chef/mixin/powershell_out.rb b/lib/chef/mixin/powershell_out.rb
index 7ec2a5cb40..5e52c56747 100644
--- a/lib/chef/mixin/powershell_out.rb
+++ b/lib/chef/mixin/powershell_out.rb
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mixin/shell_out'
-require 'chef/mixin/windows_architecture_helper'
+require "chef/mixin/shell_out"
+require "chef/mixin/windows_architecture_helper"
class Chef
module Mixin
diff --git a/lib/chef/mixin/powershell_type_coercions.rb b/lib/chef/mixin/powershell_type_coercions.rb
index 3297d6abbb..e068acab6e 100644
--- a/lib/chef/mixin/powershell_type_coercions.rb
+++ b/lib/chef/mixin/powershell_type_coercions.rb
@@ -25,8 +25,8 @@ class Chef
@type_coercions ||= {
Fixnum => { :type => lambda { |x| x.to_s }},
Float => { :type => lambda { |x| x.to_s }},
- FalseClass => { :type => lambda { |x| '$false' }},
- TrueClass => { :type => lambda { |x| '$true' }},
+ FalseClass => { :type => lambda { |x| "$false" }},
+ TrueClass => { :type => lambda { |x| "$true" }},
Hash => {:type => Proc.new { |x| translate_hash(x)}},
Array => {:type => Proc.new { |x| translate_array(x)}},
}
@@ -61,7 +61,7 @@ class Chef
end
def unsafe?(s)
- ["'", '#', '`', '"'].any? do |x|
+ ["'", '#', "`", '"'].any? do |x|
s.include? x
end
end
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index 85abe4427e..af4e2c2c09 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -1,6 +1,6 @@
-require 'chef/delayed_evaluator'
-require 'chef/mixin/params_validate'
-require 'chef/property'
+require "chef/delayed_evaluator"
+require "chef/mixin/params_validate"
+require "chef/property"
class Chef
module Mixin
diff --git a/lib/chef/mixin/provides.rb b/lib/chef/mixin/provides.rb
index 095e273dab..5885752752 100644
--- a/lib/chef/mixin/provides.rb
+++ b/lib/chef/mixin/provides.rb
@@ -1,5 +1,5 @@
-require 'chef/mixin/descendants_tracker'
+require "chef/mixin/descendants_tracker"
class Chef
module Mixin
diff --git a/lib/chef/mixin/proxified_socket.rb b/lib/chef/mixin/proxified_socket.rb
index 3fda0083c3..07a6e49928 100644
--- a/lib/chef/mixin/proxified_socket.rb
+++ b/lib/chef/mixin/proxified_socket.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'proxifier'
+require "proxifier"
class Chef
module Mixin
@@ -25,9 +25,9 @@ class Chef
# make the TCPSocket respect ENV['https_proxy'] or ENV['http_proxy'] if
# they are present
def proxified_socket(host, port)
- proxy = ENV['https_proxy'] || ENV['http_proxy'] || false
+ proxy = ENV["https_proxy"] || ENV["http_proxy"] || false
if proxy
- Proxifier.Proxy(proxy, no_proxy: ENV['no_proxy']).open(host, port)
+ Proxifier.Proxy(proxy, no_proxy: ENV["no_proxy"]).open(host, port)
else
TCPSocket.new(host, port)
end
diff --git a/lib/chef/mixin/recipe_definition_dsl_core.rb b/lib/chef/mixin/recipe_definition_dsl_core.rb
index 704ee162be..c998936b69 100644
--- a/lib/chef/mixin/recipe_definition_dsl_core.rb
+++ b/lib/chef/mixin/recipe_definition_dsl_core.rb
@@ -24,7 +24,7 @@
# This constant (module name) will eventually be deprecated and then removed.
###
-require 'chef/mixin/deprecation'
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb
index 529023056d..1e6f96d99a 100644
--- a/lib/chef/mixin/shell_out.rb
+++ b/lib/chef/mixin/shell_out.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'mixlib/shellout'
+require "mixlib/shellout"
class Chef
module Mixin
@@ -35,15 +35,15 @@ class Chef
env_key = options.has_key?(:env) ? :env : :environment
options[env_key] ||= {}
options[env_key] = options[env_key].dup
- options[env_key]['LC_ALL'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LC_ALL')
- options[env_key]['LANGUAGE'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LANGUAGE')
- options[env_key]['LANG'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LANG')
+ options[env_key]["LC_ALL"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LC_ALL")
+ options[env_key]["LANGUAGE"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LANGUAGE")
+ options[env_key]["LANG"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LANG")
args << options
else
args << { :environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
} }
end
@@ -114,4 +114,4 @@ class Chef
end
# Break circular dep
-require 'chef/config'
+require "chef/config"
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb
index db9a2f6d91..c669dc630b 100644
--- a/lib/chef/mixin/template.rb
+++ b/lib/chef/mixin/template.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'tempfile'
-require 'erubis'
+require "tempfile"
+require "erubis"
class Chef
module Mixin
diff --git a/lib/chef/mixin/uris.rb b/lib/chef/mixin/uris.rb
index 0136b55f6a..e33250dc2d 100644
--- a/lib/chef/mixin/uris.rb
+++ b/lib/chef/mixin/uris.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'uri'
+require "uri"
class Chef
module Mixin
diff --git a/lib/chef/mixin/which.rb b/lib/chef/mixin/which.rb
index 4e1c516386..715b7443dc 100644
--- a/lib/chef/mixin/which.rb
+++ b/lib/chef/mixin/which.rb
@@ -21,11 +21,11 @@ class Chef
def which(cmd, opts = {})
extra_path =
if opts[:extra_path].nil?
- [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ]
+ [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
else
[ opts[:extra_path] ].flatten
end
- paths = ENV['PATH'].split(File::PATH_SEPARATOR) + extra_path
+ paths = ENV["PATH"].split(File::PATH_SEPARATOR) + extra_path
paths.each do |path|
filename = File.join(path, cmd)
return filename if File.executable?(Chef.path_to(filename))
diff --git a/lib/chef/mixin/wide_string.rb b/lib/chef/mixin/wide_string.rb
index 0c32b76365..46c0f128dc 100644
--- a/lib/chef/mixin/wide_string.rb
+++ b/lib/chef/mixin/wide_string.rb
@@ -31,7 +31,7 @@ class Chef
def utf8_to_wide(ustring)
# ensure it is actually UTF-8
# Ruby likes to mark binary data as ASCII-8BIT
- ustring = (ustring + "").force_encoding('UTF-8') if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8"
+ ustring = (ustring + "").force_encoding("UTF-8") if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8"
# ensure we have the double-null termination Windows Wide likes
ustring = ustring + "\000\000" if ustring.length == 0 or ustring[-1].chr != "\000"
@@ -39,9 +39,9 @@ class Chef
# encode it all as UTF-16LE AKA Windows Wide Character AKA Windows Unicode
ustring = begin
if ustring.respond_to?(:encode)
- ustring.encode('UTF-16LE')
+ ustring.encode("UTF-16LE")
else
- require 'iconv'
+ require "iconv"
Iconv.conv("UTF-16LE", "UTF-8", ustring)
end
end
@@ -51,14 +51,14 @@ class Chef
def wide_to_utf8(wstring)
# ensure it is actually UTF-16LE
# Ruby likes to mark binary data as ASCII-8BIT
- wstring = wstring.force_encoding('UTF-16LE') if wstring.respond_to?(:force_encoding)
+ wstring = wstring.force_encoding("UTF-16LE") if wstring.respond_to?(:force_encoding)
# encode it all as UTF-8
wstring = begin
if wstring.respond_to?(:encode)
- wstring.encode('UTF-8')
+ wstring.encode("UTF-8")
else
- require 'iconv'
+ require "iconv"
Iconv.conv("UTF-8", "UTF-16LE", wstring)
end
end
diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb
index 744001f8a2..7ac56ecdaf 100644
--- a/lib/chef/mixin/windows_architecture_helper.rb
+++ b/lib/chef/mixin/windows_architecture_helper.rb
@@ -17,10 +17,10 @@
#
-require 'chef/exceptions'
-require 'chef/platform/query_helpers'
-require 'chef/win32/process' if Chef::Platform.windows?
-require 'chef/win32/system' if Chef::Platform.windows?
+require "chef/exceptions"
+require "chef/platform/query_helpers"
+require "chef/win32/process" if Chef::Platform.windows?
+require "chef/win32/system" if Chef::Platform.windows?
class Chef
module Mixin
@@ -48,11 +48,11 @@ class Chef
def with_os_architecture(node, architecture: nil)
node ||= begin
- os_arch = ENV['PROCESSOR_ARCHITEW6432'] ||
- ENV['PROCESSOR_ARCHITECTURE']
+ os_arch = ENV["PROCESSOR_ARCHITEW6432"] ||
+ ENV["PROCESSOR_ARCHITECTURE"]
Hash.new.tap do |n|
n[:kernel] = Hash.new
- n[:kernel][:machine] = os_arch == 'AMD64' ? :x86_64 : :i386
+ n[:kernel][:machine] = os_arch == "AMD64" ? :x86_64 : :i386
end
end
diff --git a/lib/chef/mixin/windows_env_helper.rb b/lib/chef/mixin/windows_env_helper.rb
index cd12b4254a..98b5dcf893 100644
--- a/lib/chef/mixin/windows_env_helper.rb
+++ b/lib/chef/mixin/windows_env_helper.rb
@@ -17,12 +17,12 @@
#
-require 'chef/exceptions'
-require 'chef/mixin/wide_string'
-require 'chef/platform/query_helpers'
-require 'chef/win32/error' if Chef::Platform.windows?
-require 'chef/win32/api/system' if Chef::Platform.windows?
-require 'chef/win32/api/unicode' if Chef::Platform.windows?
+require "chef/exceptions"
+require "chef/mixin/wide_string"
+require "chef/platform/query_helpers"
+require "chef/win32/error" if Chef::Platform.windows?
+require "chef/win32/api/system" if Chef::Platform.windows?
+require "chef/win32/api/unicode" if Chef::Platform.windows?
class Chef
module Mixin
@@ -44,11 +44,11 @@ class Chef
flags = SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG
# for why two calls, see:
# http://stackoverflow.com/questions/4968373/why-doesnt-sendmessagetimeout-update-the-environment-variables
- if ( SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string('Environment').address, flags, 5000, nil) == 0 )
+ if ( SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string("Environment").address, flags, 5000, nil) == 0 )
Chef::ReservedNames::Win32::Error.raise!
end
if ( SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string(
- utf8_to_wide('Environment')
+ utf8_to_wide("Environment")
).address, flags, 5000, nil) == 0 )
Chef::ReservedNames::Win32::Error.raise!
end
diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb
index ceb45df3e6..78b0399493 100644
--- a/lib/chef/mixin/xml_escape.rb
+++ b/lib/chef/mixin/xml_escape.rb
@@ -46,10 +46,10 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'chef/log'
+require "chef/log"
begin
- require 'fast_xs'
+ require "fast_xs"
rescue LoadError
Chef::Log.info "The fast_xs gem is not installed, slower pure ruby XML escaping will be used."
end
@@ -93,9 +93,9 @@ class Chef
# http://www.w3.org/TR/REC-xml/#dt-chardata
PREDEFINED = {
- 38 => '&amp;', # ampersand
- 60 => '&lt;', # left angle bracket
- 62 => '&gt;' # right angle bracket
+ 38 => "&amp;", # ampersand
+ 60 => "&lt;", # left angle bracket
+ 62 => "&gt;" # right angle bracket
}
# http://www.w3.org/TR/REC-xml/#charsets