Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Created July 26, 2011 20:22
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save ferventcoder/1107920 to your computer and use it in GitHub Desktop.
Save ferventcoder/1107920 to your computer and use it in GitHub Desktop.
Setting up a development environment with chocolatey
@echo off
SET DIR=%~dp0%
@PowerShell -NoProfile -ExecutionPolicy unrestricted -Command "& '%DIR%setup.ps1' %*"
pause
### install chocolatey ###
iex ((new-object net.webclient).DownloadString("http://chocolatey.org/install.ps1"))
# install nuget and ruby if they are missing
cinstm nuget.commandline
cinstm ruby
#perform ruby updates and get gems
gem update --system
gem install rake
gem install bundler
#restore the nuget packages
$nugetConfigs = Get-ChildItem '.\' -Recurse | ?{$_.name -match "packages\.config"} | select
foreach ($nugetConfig in $nugetConfigs) {
Write-Host "restoring packages from $($nugetConfig.FullName)"
nuget install $($nugetConfig.FullName) /OutputDirectory packages
}
rake
@ferventcoder
Copy link
Author

This does the following:

  • downloads and installs chocolatey
  • installs nuget.commandline if it is not installed
  • installs ruby if it is not installed
  • updates gems and installs some required gems for rake
  • restores nuget packages from the configs
  • builds the source with rake

@bsimser
Copy link

bsimser commented Jul 26, 2011

Slick! Another variant would be one that would download psake and setup a PowerShell build (maybe using uppercut/roundhouse?). This might fit well as I'm looking at making Tree Surgeon (http://treesurgeon.codeplex.com/) into a choclately project. Then you could create a new project from scratch with all the fixins'

@ferventcoder
Copy link
Author

cinst psake

@ferventcoder
Copy link
Author

Yes, the dependency chain is where uppercut is going. I have plans to take it there as well.

@ferventcoder
Copy link
Author

@ferventcoder
Copy link
Author

The one in the wiki has added a bit of user interaction with default answers after a timeout so they can be run unattended.

@ferventcoder
Copy link
Author

@taji
Copy link

taji commented Jan 7, 2016

I'm new to Ruby, and am confused by this this part of the script:

#restore the nuget packages
$nugetConfigs = Get-ChildItem '.\' -Recurse | ?{$_.name -match "packages\.config"} | select
foreach ($nugetConfig in $nugetConfigs) {
  Write-Host "restoring packages from $($nugetConfig.FullName)"
  nuget install $($nugetConfig.FullName) /OutputDirectory packages
}

Is this for a ruby development environment that is using nuget to manage the gems? I would think that a recursive call to Bundler would be more common. Or is this for some other purpose?

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