Skip to content

Commit

Permalink
Properly capitalize PowerShell in descriptions and errors
Browse files Browse the repository at this point in the history
It's PowerShell not Powershell. Our docs site had already been updated.

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Sep 7, 2018
1 parent 67e6a05 commit 9495024
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ It is now possible to load Solaris services recursively, by ensuring the new `op

This is the inverse of the pre-existing whitelisting functionality.

## The guard interpreter for `powershell_script` is Powershell, again
## The guard interpreter for `powershell_script` is PowerShell, again

When writing `not_if` or `only_if` statements, by default we now run those statements using powershell, rather than forcing the user to set `guard_interpreter` each time.

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/mixin/powershell_out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def build_powershell_command(script)
# always set the ExecutionPolicy flag
# see http://technet.microsoft.com/en-us/library/ee176961.aspx
"-ExecutionPolicy Unrestricted",
# Powershell will hang if STDIN is redirected
# PowerShell will hang if STDIN is redirected
# http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected
"-InputFormat None",
]
Expand Down
4 changes: 2 additions & 2 deletions lib/chef/provider/dsc_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def load_current_resource
def define_resource_requirements
requirements.assert(:run) do |a|
a.assertion { supports_dsc_invoke_resource? }
err = ["You must have Powershell version >= 5.0.10018.0 to use dsc_resource."]
err = ["You must have PowerShell version >= 5.0.10018.0 to use dsc_resource."]
a.failure_message Chef::Exceptions::ProviderNotFound,
err
a.whyrun err + ["Assuming a previous resource installs Powershell 5.0.10018.0 or higher."]
a.whyrun err + ["Assuming a previous resource installs PowerShell 5.0.10018.0 or higher."]
a.block_action!
end
requirements.assert(:run) do |a|
Expand Down
8 changes: 4 additions & 4 deletions lib/chef/provider/dsc_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def define_resource_requirements
err = [
"Could not find PowerShell DSC support on the system",
powershell_info_str,
"Powershell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
"PowerShell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
]
a.assertion { supports_dsc? }
a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
a.whyrun err + ["Assuming a previous resource installs Powershell 4.0 or higher."]
a.whyrun err + ["Assuming a previous resource installs PowerShell 4.0 or higher."]
a.block_action!
end
end
Expand Down Expand Up @@ -175,9 +175,9 @@ def generate_description

def powershell_info_str
if run_context && run_context.node[:languages] && run_context.node[:languages][:powershell]
install_info = "Powershell #{run_context.node[:languages][:powershell][:version]} was found on the system."
install_info = "PowerShell #{run_context.node[:languages][:powershell][:version]} was found on the system."
else
install_info = "Powershell was not found."
install_info = "PowerShell was not found."
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/package/powershell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_current_resource
def define_resource_requirements
super
if powershell_out("$PSVersionTable.PSVersion.Major").stdout.strip.to_i < 5
raise "Minimum installed Powershell Version required is 5"
raise "Minimum installed PowerShell Version required is 5"
end
requirements.assert(:install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? }
Expand Down
6 changes: 3 additions & 3 deletions lib/chef/provider/powershell_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ def default_interpreter_flags
"-NonInteractive",
"-NoProfile",
"-ExecutionPolicy #{execution_policy}",
# Powershell will hang if STDIN is redirected
# PowerShell will hang if STDIN is redirected
# http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected
"-InputFormat None",
]
end

# A wrapper script is used to launch user-supplied script while
# still obtaining useful process exit codes. Unless you
# explicitly call exit in Powershell, the powershell.exe
# explicitly call exit in PowerShell, the powershell.exe
# interpreter returns only 0 for success or 1 for failure. Since
# we'd like to get specific exit codes from executable tools run
# with Powershell, we do some work using the automatic variables
# with PowerShell, we do some work using the automatic variables
# $? and $LASTEXITCODE to return the process exit code of the
# last process run in the script if it is the last command
# executed, otherwise 0 or 1 based on whether $? is set to true
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/resource/dsc_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def module_name(value = nil)

property :module_version, String,
introduced: "12.21",
description: "The version number of the module to use. Powershell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the module_name."
description: "The version number of the module to use. PowerShell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the module_name."

def property(property_name, value = nil)
if not property_name.is_a?(Symbol)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/resource/powershell_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PowershellPackage < Chef::Resource::Package
resource_name :powershell_package
provides :powershell_package

description "Use the powershell_package resource to install and manage packages via the Powershell Package Manager for the Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be configured in the Powershell Package Manager via the Register-PackageSource command"
description "Use the powershell_package resource to install and manage packages via the PowerShell Package Manager for the Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be configured in the PowerShell Package Manager via the Register-PackageSource command"
introduced "12.16"

allowed_actions :install, :remove
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/resource/powershell_package_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PowershellPackageSource < Chef::Resource
preview_resource true
resource_name "powershell_package_source"

description "Use the powershell_package_source resource to register a powershell package repository."
description "Use the powershell_package_source resource to register a PowerShell package repository."
introduced "14.3"

property :source_name, String,
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/util/powershell/cmdlet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def run!(switches = {}, execution_options = {}, *arguments)
result = run(switches, execution_options, arguments)

if ! result.succeeded?
raise Chef::Exceptions::PowershellCmdletException, "Powershell Cmdlet failed: #{result.stderr}"
raise Chef::Exceptions::PowershellCmdletException, "PowerShell Cmdlet failed: #{result.stderr}"
end

result
Expand Down
6 changes: 3 additions & 3 deletions spec/functional/resource/dsc_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
Chef::Resource::DscResource.new("dsc_resource_test", run_context)
end

context "when Powershell does not support Invoke-DscResource"
context "when Powershell supports Invoke-DscResource" do
context "when PowerShell does not support Invoke-DscResource"
context "when PowerShell supports Invoke-DscResource" do
before do
if !Chef::Platform.supports_dsc_invoke_resource?(node)
skip "Requires Powershell >= 5.0.10018.0"
skip "Requires PowerShell >= 5.0.10018.0"
elsif !Chef::Platform.supports_refresh_mode_enabled?(node) && !Chef::Platform.dsc_refresh_mode_disabled?(node)
skip "Requires LCM RefreshMode is Disabled"
end
Expand Down
4 changes: 2 additions & 2 deletions spec/functional/resource/powershell_script_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
let(:valid_powershell_interpreter_flag) { "-Sta" }

let!(:resource) do
r = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context)
r = Chef::Resource::WindowsScript::PowershellScript.new("PowerShell resource functional test", @run_context)
r.code(successful_executable_script_content)
r
end
Expand Down Expand Up @@ -154,7 +154,7 @@
# This somewhat ambiguous case, two failures of different types,
# seems to violate the principle of returning the status of the
# last line executed -- in this case, we return the status of the
# second to last line. This happens because Powershell gives no
# second to last line. This happens because PowerShell gives no
# way for us to determine whether the last operation was a cmdlet
# or Windows process. Because the latter gives more specific
# errors than 0 or 1, we return that instead, which is acceptable
Expand Down
2 changes: 1 addition & 1 deletion spec/functional/win32/crypto_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

it "can be decrypted by powershell" do
encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext)
resource = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context)
resource = Chef::Resource::WindowsScript::PowershellScript.new("PowerShell resource functional test", @run_context)
resource.code <<~EOF
$encrypted = '#{encrypted}' | ConvertTo-SecureString
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted)
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/platform/query_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,21 @@
end

describe "Chef::Platform#supports_dsc?" do
it "returns false if powershell is not present" do
it "returns false if PowerShell is not present" do
node = Chef::Node.new
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
end

["1.0", "2.0", "3.0"].each do |version|
it "returns false for Powershell #{version}" do
it "returns false for PowerShell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
end
end

["4.0", "5.0"].each do |version|
it "returns true for Powershell #{version}" do
it "returns true for PowerShell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
expect(Chef::Platform.supports_dsc?(node)).to be_truthy
Expand All @@ -168,7 +168,7 @@
end

["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version|
it "returns false for Powershell #{version}" do
it "returns false for PowerShell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/provider/dsc_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Chef::Provider::DscResource.new(resource, run_context)
end

context "when Powershell does not support Invoke-DscResource" do
context "when PowerShell does not support Invoke-DscResource" do
let (:node) do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = "4.0"
Expand All @@ -40,7 +40,7 @@
end
end

context "when Powershell supports Invoke-DscResource" do
context "when PowerShell supports Invoke-DscResource" do

context "when RefreshMode is not set to Disabled" do
context "and the WMF 5 is a preview release" do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/provider/dsc_script_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
end
end

it "raises an exception if Powershell is not present" do
it "raises an exception if PowerShell is not present" do
expect do
provider.run_action(:run)
end.to raise_error(Chef::Exceptions::ProviderNotFound)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/resource/dsc_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
end
end

context "Powershell DSL methods" do
context "PowerShell DSL methods" do
it "responds to :ps_credential" do
expect(dsc_test_resource.respond_to?(:ps_credential)).to be true
end
Expand Down
2 changes: 1 addition & 1 deletion tasks/templates/prerelease.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Alternatively, you can install Chef using one of the following command options:
# In Shell
$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v <%= @version %> -c current

# In Windows Powershell
# In Windows PowerShell
. { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version <%= @version %> -channel current
```

Expand Down

0 comments on commit 9495024

Please sign in to comment.