Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a development version on Windows #547

Open
carols10cents opened this issue Jul 17, 2012 · 19 comments
Open

Running a development version on Windows #547

carols10cents opened this issue Jul 17, 2012 · 19 comments
Labels

Comments

@carols10cents
Copy link
Contributor

Being a former Ruby Windows dev, I know they DO exist, and we should all be trying to make it better to develop in Ruby on Windows.

First problem I know about -- we have unicorn in the Gemfile, which I doubt is required for development, and that (more specifically its dependency kgio) is only supported on unix systems.

@jrgifford
Copy link
Contributor

What exactly does rstat.us use unicorn for? I would assume it's just for production, right?

@wilkie
Copy link
Contributor

wilkie commented Sep 13, 2012

yep. just for production. webrick is used in development, although thin could possibly be used too if somebody wanted. but unicorn is not. unicorn is unix/unixish only.

@tgraham
Copy link
Member

tgraham commented Sep 26, 2012

Why wouldn't you let the individual pick their web server? If you want to leave unicorn in, move it to the production group and comment it out with a "strongly recommended" comment about why it's there. That way it's not used in dev mode and can't afflict the afflicted windows ruby devs, all both on them ;)

@carols10cents
Copy link
Contributor Author

@tgraham that sounds like a good plan-- I'd be happy to merge in a pull request along those lines :)

@Peeja
Copy link

Peeja commented Dec 2, 2012

Now that rstat.us uses Thin instead of Unicorn, does it run on Windows?

@colindean
Copy link
Contributor

A quick bit of research shows, yes, Thin does run on Windows, but it may take some finagling. One must install a pre-release version of eventmachine. This step may no longer be necessary, but was as of June 2012.

http://stackoverflow.com/questions/3649252/cannot-install-thin-on-windows

@wilkie
Copy link
Contributor

wilkie commented Dec 3, 2012

Thin runs fine in windows. No finagling necessary.

@Peeja
Copy link

Peeja commented Dec 3, 2012

Can we close this issue then? Or is there something else in rstat.us that doesn't work on Windows?

@carols10cents
Copy link
Contributor Author

In order for me to feel comfortable closing this, I would like someone to actually try running the current code on windows.

I just tried on my aging netbook and I couldn't even get bundle install to work :( Nope, don't miss developing on windows at all.

@usmanbashir
Copy link
Member

I mainly develop on Windows using Vagrant but for this I will try to run it natively and report back as I know how painful it used to be to develop natively on Windows back when I started working with Ruby.

@wilkie
Copy link
Contributor

wilkie commented Dec 4, 2012

So, I had to remove therubyracer from my Gemfile (which I thought wasn't there?) and then it would bundle just fine with 'bundle install --without production' to avoid installing unicorn.

Then it complained about there not being a 'libxml2-2.dll' which is NotOurFault, but I found the dll and copied it somewhere visible by the path. We should look at patching libxml-ruby to correct for this.

The DLL was in rubyroot\lib\ruby\gems\1.9.1\gems\libxml-ruby-2.3.3-x86-mingw32\lib\libs when it should have probably just been in the parent directory.

After doing this manual operation, the site loaded just fine. It only took me probably 10 minutes to figure all of this out.

I feel a little dirty now, though.

@usmanbashir
Copy link
Member

Using RubyInstaller+DevKit I was also able to get it working but only after removing "unicorn" and "therubyracer" from the Gemfile and copying "libxml2-2.dll" to a more visible path location.

Other then that, I don't see any other issues so far.

@steveklabnik
Copy link
Contributor

I told you therubyracer is an antipattern. ;)

@wilkie
Copy link
Contributor

wilkie commented Dec 6, 2012

Again, therubyracer may be necessary on some Linux environments that do not have a js engine. Windows and OS X already have one installed by force on the system, which the js parts of the application will discover and use.

It would be nice to be able to specify an engine like this just in case, but have it not be used if it's unnecessary, but that's not one of Bundler's usecases. Generally, therubyracer is something that should only be used in a Linux environment and, long story short, Bundler does not have a good way to specify the platform.

@colindean
Copy link
Contributor

I did some quick research on specifying the platform in bundler and came up with this:

https://github.com/carlhuda/bundler/wiki/Platform-as-a-parameter

It's possible to fake it using groups, but I agree that such is a less than ideal solution.

@tgraham
Copy link
Member

tgraham commented Dec 6, 2012

I would think that using either RUBY_PLATFORM =~ /stuff to match here/ or a :platform => :ruby for therubyracer would solve this. I don't have a windows machine to test that theory though.

@carols10cents
Copy link
Contributor Author

Thank you everyone! This was a big help <3 <3 <3

Would anyone like to get a patch in to update the README with Windows setup instructions:

  • Link to rubyinstaller.org
  • Link to the DevKit install instructions
  • Explain where to move the dll from and to (and a link to a page explaining this?)
  • Specify that they'll need to do bundle install --without production

Then another potential patch would be handling therubyracer. Looking at the link @colindean mentioned, it looks like there's a way within the Gemfile to only use therubyracer on linux without requiring everyone to use --without:

gem 'therubyracer', :require => RUBY_PLATFORM.include?('linux') && 'therubyracer'

Anyone?

@jrgifford
Copy link
Contributor

@carols10cents so, let me get this straight: you want to be able to have therubyracer only on linux, but outside of the bundler test group? Just want to know before I PR.

@carols10cents
Copy link
Contributor Author

I think therubyracer can stay in the :test bundler group, just add that conditional :require so that it won't actually be required unless you're on linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants