documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Rails 2.3.5 reports Jammit missing on Windows, Ruby 1.9.1 #42

Closed ghost closed 14 years ago

ghost commented 14 years ago

I am trying to run "rake db:test:clone" in my Windows dev environment and am getting:

...
C:/Ruby19/bin/rake:19:in load
C:/Ruby19/bin/rake:19:in <main>
Missing these required gems:
  jammit

You're running:
  ruby 1.9.1.378 at C:/Ruby19/bin/ruby.exe
  rubygems 1.3.5 at C:/Users/Shaun/.gem/ruby/1.9.1, C:/Ruby19/lib/ruby/gems/1.9.1

Run `rake gems:install` to install the missing gems.

I the same error message (with a different stack trace of course) when i run "ruby script/server"

I've tried running "rake gems:install" of course and that appears to execute correctly.

I have also tried to manually run "gem install jammit" which looks like it works: Successfully installed jammit-0.4.4 1 gem installed Installing ri documentation for jammit-0.4.4... Updating class cache with 1187 classes... Installing RDoc documentation for jammit-0.4.4...

When i run "gem list --local" is lists jammit 0.4.4 so i assume that its installed. Im not sure Rails doesnt think its there.

Also, I am able to run "rake db:create" without issue.

The same project on an OS X system runs without issue. Any thoughts on why this issue is occurring and how to fix?

Thanks

ghost commented 14 years ago

The issue is Windows specific -- you must "gem install win32-open3" to use Jammit, and the win32-open3 gem is currently not compatible with Ruby 1.9.1. I rolled back to Ruby 1.8.7 and I was able to install win32-open3 gem and Jammit worked as expected.

jashkenas commented 14 years ago

Thanks for figuring that out and closing the ticket. It's good to have on the record.

triemstr commented 14 years ago

Win32-open3 will never be compatible with Ruby 1.9.1. See: http://djberg96.livejournal.com/172756.html

So is this something that can be fixed and which module needs the fixing? Maybe open4 and popen4 aren't even needed.

I'm having this same problem and I only have one remaining box with 1.8.7 and can't use that as the only build box.

jashkenas commented 14 years ago

That blog posts suggests that win32-open3 is no longer necessary with Ruby 1.9.1. If you try to run the closure-compiler gem (which is where this issues is occurring), under Windows and Ruby 1.9.1, what do you see happening? Can you paste the error and stacktrace in this ticket?

triemstr commented 14 years ago

I don't know if I'm doing this right, but here's my file: test.rb -> require 'rubygems' require 'closure-compiler' Closure::Compiler.new.compile(File.open('public/javascripts/file.js', 'r'))

And output:

$ ruby test.rb --trace c:/ruby/lib/ruby/gems/1.9.1/gems/POpen4-0.1.4/lib/popen4.rb:9:in require': no such file to load -- win32/ope n3 (LoadError) from c:/ruby/lib/ruby/gems/1.9.1/gems/POpen4-0.1.4/lib/popen4.rb:9:in<top (required)>' from c:/ruby/lib/ruby/gems/1.9.1/gems/closure-compiler-0.2.2/lib/closure/compiler.rb:2:in require' from c:/ruby/lib/ruby/gems/1.9.1/gems/closure-compiler-0.2.2/lib/closure/compiler.rb:2:in<top (requ ired)>' from c:/ruby/lib/ruby/gems/1.9.1/gems/closure-compiler-0.2.2/lib/closure-compiler.rb:1:in require' from c:/ruby/lib/ruby/gems/1.9.1/gems/closure-compiler-0.2.2/lib/closure-compiler.rb:1:in<top (requ ired)>' from test.rb:2:in require' from test.rb:2:in

'

triemstr commented 14 years ago

It actually appeared to work with yui and 1.9.1 on windows (vista in this case)...good point that I was using closure which I was using because of a bug I was having with 1.8.7 and yui's Compressor...I may log it as a different bug...though I'm caring less about 1.8.7.

triemstr commented 14 years ago

Should we file this bug with closure?

documentcloud commented 14 years ago

triemstr: I've just pushed a new version of the closure-compiler gem (0.3.0), which hopefully fixes the problem you were encountering. It avoids any external popen-style gems, in favor of a homebrew implementation that doesn't use a grandchild process, thereby returning the correct exit code. Take a peek here:

http://github.com/documentcloud/closure-compiler/blob/master/lib/closure/popen.rb

And let me know if it works for you. Closing the ticket.

triemstr commented 14 years ago

No same problem as here: http://github.com/documentcloud/closure-compiler/issues#issue/4

documentcloud commented 14 years ago

My apologies. I rustled up a Windows VM to test on, and pushed out a 0.3.1 version of the gem that includes homebrew windows support. Here's the diff:

http://github.com/documentcloud/closure-compiler/commit/5acf2305c7a985b9e8db8ae4814432609c06cdfa

Give it a try.

triemstr commented 14 years ago

Same problem, but on line 30 now. My RUBY_PLATFORM is 'i386-mingw32' which is becoming more common with ruby 1.9.1+. So the match on line 7 doesn't work in popen.rb. I think you need both. I changed to mswin32|mingw32 and it got passed it. Would mswin|mingw also work in case the 32s go away some day?

Then I received a new error: popen.rb:10:in `require': no such file to load -- win32/open3 (LoadError)

So: I tried $ gem install win32-open3 ERROR: Error installing win32-open3: win32-open3 requires Ruby version < 1.9.0.

It seems that when I wrote up this bug I was using ruby 1.8.7, but then my computer died, got another one, and now I'm using ruby 1.9.1. So if you fix the mswin32|mingw32 problem, you then will still have problems getting it to work with 1.9.1. So unfortunately I can't test 1.8.7 but if that works for you, it may be good. 1.9.1 still needs help.

documentcloud commented 14 years ago

triemstr: I just pushed version 0.3.2 of the "closure-compiler" gem. Please give it a try and let me know if it's working for you. I added yet another popen code path for Ruby 1.9.1 on Windows, and tested the gem on Ruby 1.8.7 and Ruby 1.9.1, on both Windows XP, and Mac OS 10.6. Sorry for the bother and the broken gem.

triemstr commented 14 years ago

It works with Ruby 1.9.1 and Windows (Vista in this case)!!

Thanks for your persistence. I like the new smaller file sizes and I'm going to start testing jammit with closure more extensively and hope to stick with it. Thanks!!!