11.11.07

Installing Merb on Windows required Rakefile tweaks for sudo and chmod

Posted in Programming, Ruby, merb at 12:32 am by Robert Horvick

[Update: Merb is now working on Windows and the errors described in this post have been fixed in the latest svn trunk]  

Following the merb installation stepson my Vista laptop I discovered that the “rake install” was failing because the Rakefile contained explicit calls to sudo (and chmod).

When executing “rake install” the result was:

 C:\InstantRails\merb>rake install
(in C:/InstantRails/merb)
rake package
(in C:/InstantRails/merb)
  Successfully built RubyGem
  Name: merb
  Version: 0.4.1
  File: merb-0.4.1.gem
sudo gem install pkg/merb-0.4.1 --no-rdoc --no-ri
rake aborted!
Command failed with status (0): [sudo gem install pkg/merb-0.4.1 --no-rdoc ...]
C:/InstantRails/merb/rakefile:76
(See full trace by running task with –trace) 

 I modified the Rakefile to not use sudo on win32 (replacing it with “” instead) and to only execute chmod when not win32.  The patch is:

Index: Rakefile
===================================================================
--- Rakefile (revision 937)
+++ Rakefile (working copy)
@@ -16,6 +16,8 @@
 NAME = "merb"
 VERS = "0.4.1"
 CLEAN.include ['**/.*.sw?', '*.gem', '.config']
+
+SUDO = (PLATFORM =~ /win32/)? “” : “sudo”
 
 setup_clean [ "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", 'coverage', "cache"]
 
@@ -73,11 +75,11 @@
 
 task :install do
   sh %{rake package}
-  sh %{sudo gem install pkg/#{NAME}-#{VERS} –no-rdoc –no-ri}
+  sh %{#{SUDO} gem install pkg/#{NAME}-#{VERS} –no-rdoc –no-ri}
 end
 
 task :uninstall => [:clean] do
-  sh %{sudo gem uninstall #{NAME}}
+  sh %{#{SUDO} gem uninstall #{NAME}}
 end
 
 desc “run webgen”
@@ -89,7 +91,7 @@
 task :doc_rforge do
   sh %{rake doc}
   sh %{rake doc_webgen}
-  sh %{sudo chmod -R 755 doc}
+  sh %{#{SUDO} chmod -R 755 doc} if not PLATFORM =~ /win32/
   sh %{scp -r -p doc/site/output/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb}
   sh %{scp -r -p doc/rdoc/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb/rdoc}
 end

I haven’t really thought about what the consequences of this change are but I did file a bug at the merb Trac in the event they want to fix platform blockers at this point in the dev cycle.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

2 Comments »

  1. Merb on Windows: environment variables INLINEDIR or HOME required | Ghost On Third said,

    November 11, 2007 at 1:56 pm

    [...] ← Installing Merb on Windows required Rakefile tweaks for sudo and chmod [...]

  2. Michael said,

    November 13, 2007 at 7:28 pm

    I’ve added your ticket to the list of things that need to be covered for Merb 0.4.2.

Leave a Comment