ferventcoder / chocolatey-packages

The packages...all about the packages.
112 stars 113 forks source link

(ruby2.devkit) ruby2.devkit does not preserve config.yml #182

Open brianrobertarmstrong opened 7 years ago

brianrobertarmstrong commented 7 years ago

ruby2.devkit tries to prevent an existing config.yml file from being overwritten

  # clean out the recommended directories
  #2. Delete all the <DEVKIT_INSTALL_DIR> subdirectories and files except for config.yml. If you’ve made any customizations to the MSYS shell you may also want to keep files in the etc and home subdirectories.
  if ([System.IO.File]::Exists("$($devKitInstallDir)\config.yml")) {
    Write-Host "Moving config.yml to a holding location prior to extraction"
    Copy-Item "$($devKitInstallDir)\config.yml" "$tempDir" -Force
  }

It then copes the config.yml file back to $devKitInstallDir after extracting the installer archive.
But later on when the package runs ruby dk.rb init the installer will overwrite config.yml anyway, blowing away your changes:

  def self.init
    # get all known installed Ruby root dirs and write the root dirs
    # to 'config.yml', overwriting any existing config file.
    ir = installed_rubies

So it seems to me that you always end up with the auto-generated config.yml based on the registry key search. I don't know if it would make sense to have the copy happen after dk.rb init instead? That might also lead to surprising behavior.

ferventcoder commented 7 years ago

I thought dk init needed force to blow away the changes.