Skip to content

Instantly share code, notes, and snippets.

@lagartoflojo
Created April 15, 2011 01:15
Show Gist options
  • Save lagartoflojo/920943 to your computer and use it in GitHub Desktop.
Save lagartoflojo/920943 to your computer and use it in GitHub Desktop.
Agregar al final de deploy.rb para arreglar problemas con deploy de capistrano en Windows.
on :start, "bundle:fix_gemfile"
namespace :bundle do
desc "Fix Gemfile.lock to use *nix gems"
task :fix_gemfile do
gem_file = File.read("Gemfile")
replace = gem_file.gsub(/(.*)gem (.*)win32(.*)\n/, "")
File.open("Gemfile", "w") {|file| file.puts replace}
gem_file_lock = File.read("Gemfile.lock")
# remove windows specific gems
replace = gem_file_lock.gsub(/(.*)win32(.*)\n/, "")
# update the gems to have correct extensions
replace = replace.gsub(/-x86-mingw32/, "")
# store the correct platform
replace = replace.gsub(/PLATFORMS\n x86-mingw32\n/, "PLATFORMS\n ruby\n")
# remove any other instance of mingw
replace = replace.gsub(/(.*)mingw(.*)\n/, "")
File.open("Gemfile.lock", "w") {|file| file.puts replace}
# commit Gemfile.lock to svn, i.e. svn ci Gemfile.lock if there is any changes
run_locally 'svn ci Gemfile Gemfile.lock -m "updated Gemfile and Gemfile.lock with *nix version"'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment