Skip to content

Instantly share code, notes, and snippets.

@atmos
Created July 24, 2008 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atmos/2290 to your computer and use it in GitHub Desktop.
Save atmos/2290 to your computer and use it in GitHub Desktop.
desc 'Clone a copy of all the required Merb repositories'
task 'merb:clone' do
if File.exists?("merb") then
puts("./merb already exists!")
exit
end
require("fileutils")
mkdir("merb")
cd("merb")
required_libraries.each do |r|
sh("git clone git://github.com/wycats/merb-#{r}.git")
end
end
desc 'Update your local Merb repositories. Run from inside the top-level merb directory.'
task 'merb:update' do
required_libraries.each do |r|
unless File.exists?(r) then
puts("merb-#{r} missing ... did you use merb:clone to set this up?")
exit
end
end
required_libraries.each do |r|
cd(r)
sh("git fetch")
sh("git checkout master")
sh("git rebase origin/master")
cd("..")
end
end
desc 'Uninstall all RubyGems related to Merb'
task 'merb:gems:wipe' do
windows = PLATFORM =~ /win32|cygwin/ rescue nil
sudo = windows ? ("") : ("sudo")
["merb", "merb-extlib", "merb-core", "merb-more", "merb-action-args", "merb-assets", "merb-builder", "merb-cache", "merb-freezer", "merb-gen", "merb-haml", "merb-mailer", "merb-parts", "merb_activerecord", "merb_helpers", "merb_sequel", "merb_param_protection", "merb_test_unit", "merb_stories"].each do |gem|
sh("#{sudo} gem uninstall #{gem} --all --ignore-dependencies --executables; true")
end
end
desc 'Pull fresh copies of Merb, uninstall existing gems, and re-install all the gems'
task 'merb:gems:refresh' => [ 'merb:gems:wipe', 'merb:update', 'merb:install' ] do
end
desc 'Install merb-core'
task 'merb:install:core' do
["extlib", "core"].each { |repos| install(repos) }
end
desc 'Install merb-more'
task 'merb:install:more' do
install("more")
end
desc 'Install merb-plugins'
task 'merb:install:plugins' do
install("plugins")
end
desc 'Install merb-core, merb-more, and merb-plugins'
task 'merb:install' => [ 'merb:install:core', 'merb:install:more', 'merb:install:plugins' ] do
end
desc 'Remove and reinstall Merb sake recipes'
task 'merb:sake:refresh' do
["clone", "update", "gems:wipe", "gems:refresh", "install", "install:core", "install:more", "sake:refresh"].each do |t|
sh("sake -u merb:#{t}")
end
sh("sake -i http://merbivore.com/merb-dev.sake")
end
desc 'Remove these merb-dev sake tasks. Including this one.'
task 'merb:sake:uninstall' do
sh("sake -u merb:gems:wipe merb:clone merb:gems:refresh merb:install merb:install:core merb:install:more merb:install:plugins merb:sake:refresh merb:update merb:sake:uninstall")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment