Wednesday, May 16, 2012

Dependency Issue with Gemfiles and Webrick

I've been trying to configure webrick to use SSL on all pages of my application.

I added

gem 'rack-ssl', :require => 'rack/ssl'

to my gem file and

config.middleware.insert_before ActionDispatch::Static, "Rack::SSL"
config.force_ssl = true

to my /config/application.rb file. And I configured webrick to use my self signed certificate by modifying my /script/rails file to looke like so

require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'

module Rails
class Server < ::Rack::Server
def default_options
:Port => 3001,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
#:pid => File.expand_path("tmp/pids/"),
:config => File.expand_path(""),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER,
:SSLPrivateKey =>"home/sureweb/rubystuff/server.cert.key").read),
:SSLCertificate =>"home/sureweb/rubystuff/server.cert.crt").read),
:SSLCACertificateFile => 'home/sureweb/rubystuff/server.crt',
:SSLCertName => [["CN", WEBrick::Utils::getservername]]

APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'

But every time I run rails s I get a message saying

You have already activated activesupport 3.2.3, but your Gemfile requires activesupport 3.0.12. Using bundle exec may solve this. (Gem::LoadError)

Normally I could solve this by removing the version 3.2.3 but I have numerous other gems that depend on it so that is not an option. Is there another way to get this working?

No comments:

Post a Comment