Skip to content

Instantly share code, notes, and snippets.

@jonforums
Created April 9, 2011 19:50
Show Gist options
  • Save jonforums/911713 to your computer and use it in GitHub Desktop.
Save jonforums/911713 to your computer and use it in GitHub Desktop.
Support thin source gem builds on Windows
diff --git a/lib/thin.rb b/lib/thin.rb
index 10b5ff3..83e96ba 100644
--- a/lib/thin.rb
+++ b/lib/thin.rb
@@ -41,8 +41,14 @@ require "#{Thin::ROOT}/rack/adapter/loader"
if Thin.win?
# Select proper binary under Windows
- major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
- require "#{Thin::ROOT}/#{major_ruby_version}/thin_parser"
+ begin
+ # fat binary gem
+ major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
+ require "#{Thin::ROOT}/#{major_ruby_version}/thin_parser"
+ rescue LoadError
+ # source gem (eg - gem install thin --platform=ruby)
+ require "#{Thin::ROOT}/thin_parser"
+ end
else
require "#{Thin::ROOT}/thin_parser"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment