Skip to content

Commit

Permalink
Merge pull request #105 from chef/jfm/json_bug_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmccrae authored Jan 18, 2022
2 parents 510e5b5 + a66c536 commit cce87f7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 77 deletions.
16 changes: 8 additions & 8 deletions .expeditor/manual_gem_release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ $ErrorActionPreference = "Stop"

$project_name = "chef-powershell"

Write-Output "--- Cleaning up old Hab directories for a minty fresh build experience"
# Is there a c:\hab directory? If so, nuke it.
if (Test-Path -Path c:\hab) {
Remove-Item -LiteralPath c:\hab -Recurse -Force #-ErrorAction SilentlyContinue
}
Write-Output "`r"

Write-Output "--- Making sure we're in the correct spot"
$project_root = (Get-ChildItem c:\ -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith($("$project_name-shim")) } | Select-Object -First 1).FullName
Set-Location -Path $project_root
Write-Output "`r"

Write-Output "-- Is Habitat actually installed?"
Write-Output "--- Is Habitat actually installed?"
# Is hab installed?
if (-not (Get-Command -Name Hab -ErrorAction SilentlyContinue)) {
Write-Output "--- No, Installing Habitat via Choco"
Expand All @@ -31,13 +38,6 @@ if (-not (Get-Command -Name Hab -ErrorAction SilentlyContinue)) {
}
Write-Output "`r"

Write-Output "--- Cleaning up old Hab directories for a minty fresh build experience"
# Is there a c:\hab directory? If so, nuke it.
if (Test-Path -Path c:\hab) {
Remove-Item -LiteralPath c:\hab -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Output "`r"

Write-Output "--- Comparing local version to published version, updating the local version as appropriate"
try {
$file = (Get-Content $("$project_root\chef-powershell\lib\chef-powershell\version.rb"))
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.6
1.0.12
63 changes: 0 additions & 63 deletions chef-powershell/lib/chef-powershell/json_compat.rb

This file was deleted.

7 changes: 3 additions & 4 deletions chef-powershell/lib/chef-powershell/powershell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
# limitations under the License.

require "ffi" unless defined?(FFI)
require_relative "json_compat"
autoload :FFI_Yajl, "ffi_yajl"
require_relative "exceptions"
require_relative "unicode"
# require "chef-powershell"

class ChefPowerShell
class PowerShell
Expand Down Expand Up @@ -98,8 +97,8 @@ def exec(script, timeout: -1)
PowerMod.set_ps_command(script)
execution = PowerMod.do_work
output = execution.read_utf16string
hashed_outcome = Chef::JSONCompat.parse(output)
@result = Chef::JSONCompat.parse(hashed_outcome["result"])
hashed_outcome = FFI_Yajl::Parser.parse(output)
@result = FFI_Yajl::Parser.parse(hashed_outcome["result"])
@errors = hashed_outcome["errors"]
@verbose = hashed_outcome["verbose"]
end
Expand Down
2 changes: 1 addition & 1 deletion chef-powershell/lib/chef-powershell/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

module ChefPowerShellModule
CHEFPOWERSHELL_ROOT = File.expand_path("..", __dir__)
VERSION = "1.0.10"
VERSION = "1.0.12"
end

0 comments on commit cce87f7

Please sign in to comment.