Skip to content

Instantly share code, notes, and snippets.

@pburkholder
Forked from gryte/devWrkstnConfig.ps1
Last active September 16, 2015 17:07
Show Gist options
  • Save pburkholder/88b695847a8852e807e6 to your computer and use it in GitHub Desktop.
Save pburkholder/88b695847a8852e807e6 to your computer and use it in GitHub Desktop.
Windows Workstation Config for Dev Environment for Chef Cookbooks
# launch powershell with admin privileges
# run:
# install chocolately
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# update to WMF 5 & powershell version 5
choco upgrade powershell -pre
# reboot machine
# launch powershell with admin privileges
# run:
Install-Package -name git -provider chocolatey
Install-Package -name chefdk -minimumVersion 0.6.0.1 -provider chocolatey
Install-Package -name atom -provider chocolatey
Install-Package -name vagrant -provider chocolatey
# Install-Package -name virtualbox -provider chocolatey # can't have hyper-v installed; fails to install on windows 10 tech preview build 10130
# remove vagrant-windows plugin[1][2]
vagrant plugin uninstall vagrant-windows
# add vagrant-winrm plugin
vagrant plugin install vagrant-winrm
# Open powershell window as user
apm install linter
apm install linter-foodcritic
apm install linter-rubocop
apm install line-ending-converter
apm install language-powershell
Install-Module posh-git
. $PROFILE
# Make sure that the Windows host dev machine has the line endings taken into account relative to Git & GitHub
https://help.github.com/articles/dealing-with-line-endings/
# You now have a Windows development environment for Chef Cookbooks that works the same way on OSX.
# [1]https://github.com/mitchellh/vagrant/issues/5316
# [2] https://github.com/WinRb/vagrant-windows
# "..Vagrant 1.6 will natively support Windows guests, this plugin should not be used with Vagrant 1.6 or later..."
# clone windows
git clone https://....
# Get an unencumbered windows box
mkdir tmp; cd tmp
# https://atlas.hashicorp.com/opentable/boxes/win-2012r2-standard-amd64-nocm
vagrant init opentable/win-2012r2-standard-amd64-nocm
vagrant up --provider virtualbox
@pburkholder
Copy link
Author

Need to update https://www.chef.io/blog/2014/11/04/the-chefdk-on-windows-survival-guide/ with:

$ruby_version = '2.1.0'

$env:Path += ";$env:USERPROFILE\appdata\local\chefdk\gem\ruby\$ruby_version\bin;c:\opscode\chefdk\embedded\bin"
$env:GEM_ROOT = "c:\opscode\chefdk\embedded\lib\ruby\gems\$ruby_version"
$env:GEM_HOME = "$env:USERPROFILE\appdata\local\chefdk\gem\ruby\$ruby_version"
$env:GEM_PATH = "$env:USERPROFILE\appdata\local\chefdk\gem\ruby\$ruby_version;C:\opscode\chefdk\embedded\lib\ruby\gems\$ruby_version"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment