11.11.07

Merb on Windows: environment variables required.

Posted in Programming, Ruby, merb at 1:56 pm by Robert Horvick

[Update: Merb is now working on Windows]  

After getting merb installed I created a project using “merb myapp” - this worked fine.  Next I tried just running “merb” to see where I was at.

Merb started with these options:---:merb_root: C:/InstantRails/projects/merb_1/myapp 

:reloader_time: 0.5
:cache_templates: false
:use_mutex: true
:session_id_cookie_only: true
:session_secret_key: C:/INSTANTRAILS/PROJECTS/MERB_1/MYAPP5259
:host: 0.0.0.0 

:query_string_whitelist: []
:reloader: true
:exception_details: true
:environment: development
:port: “4000″
Define INLINEDIR or HOME in your environment and try again

The error “Define INLINEDIR or HOME in your environment and try again” was not expected but I’m game.

I looked around for a place to define environment variables (since “:environment: development” seemed to hint that there would be one).

So I tried the obvious directory listing:

C:\InstantRails\projects\merb_1\myapp>dir development.rb /s 

 Volume in drive C has no label. 

 Volume Serial Number is 2256-DBBA 

Directory of C:\InstantRails\projects\merb_1\myapp\config\environments 

11/11/2007  12:48 AM                44 development.rb 

               1 File(s)             44 bytes 

I opened it and changed it’s contents to:

puts "Loaded DEVELOPMENT Environment..." 

ENV['INLINEDIR'] = “C:/Users/Robert/AppData/Local/Temp”

But the error persisted.  So I just set INLINEDIR in the environment.

Further … but now a new error:

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:397:in ``': No such file or directory - cl -nologo -LD -Werror  -MD -Zi -O2b2xg- -G6 -I C:/InstantRails/ruby/lib/ruby/1.8/i386-mswin32 -I C:/InstantRails/ruby/include -o "C:/Users/Robert/AppData/Local/Temp/.ruby_inline/Inline_ParseTree_fa12.so" "C:/Users/Robert/AppData/Local/Temp/.ruby_inline/Inline_ParseTree_fa12.c"  -link /LIBPATH:"C:/InstantRails/ruby/lib" /DEFAULTLIB:"msvcrt-ruby18.lib" /INCREMENTAL:no /EXPORT:Init_Inline_ParseTree_fa12 (Errno::ENOENT) 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:397:in `build' 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:679:in `inline' 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ParseTree-2.0.2/lib/parse_tree.rb:243 

 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' 

 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib/ruby2ruby.rb:4 

 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require' 

 from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require' 

  ... 13 levels... 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb/server.rb:500:in `run' 

 from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.4.1/bin/merb:6 

 from C:/InstantRails/ruby/bin/merb:16:in `load' 

 from C:/InstantRails/ruby/bin/merb:16

Is it just me or does that look like it’s trying to run a C compiler?

Investigating now…

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

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]

Next entries »