I’m trying to follow the guide here: http://docs.cloudfoundry.com/frameworks/ruby/rails-3-1.html
And I have worked out many problems already such as the jquery gem, but there is no documention that I can find that addresses the will_paginate gem. Anyone have any ideas why cloudfoundry hates will_paginate?
From cloud_controller.stderr.log
ERROR: While executing gem ... (ArgumentError)
invalid byte sequence in US-ASCII
/var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_task.rb:90:in `block in install_gems': Failed installing will_paginate-3.0.3.gem (RuntimeError)
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_task.rb:78:in `each'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_task.rb:78:in `install_gems'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_task.rb:47:in `install'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_support.rb:34:in `compile_gems'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/rails3/plugin.rb:49:in `block in stage_application'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/rails3/plugin.rb:45:in `chdir'
from /var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/rails3/plugin.rb:45:in `stage_application'
from /var/vcap/data/packages/cloud_controller/32/cloud_controller/script/run_plugin.rb:30:in `<main>'
I can also confirm deploying a Rails application to cloudfoundry.com with will_paginate bundled in works OK.
If you could post the contents of your Gemfile it would be of great help, having read around the issue a little I think the error with will_paginate may be a red herring.
It’s also worth noting that you don’t actually have to use Rails 3.1, the lastest version, 3.2.5 also works fine.
==== UPDATE ====
Ok, I replicated the issue with micro CloudFoundry and a test application with the same Gemfile used by eightyoctane in his answer.
The problem isn’t actually an issue with will_paginate as such but the encoding of the files within the gem itself. will_paginate was authored by Mislav Marohnić, I literally just copied his name from the gemspec on github, notice the double character in his name! Stay with me on this one…
There is a subtle difference in the way Cloudfoundry.com and Micro Cloudfoundry install gems, both of them use the ‘env’ tool to set an environment for running ‘gem install’, however, Micro Cloudfoundry is running a slightly older version of the vcap-staging gem which does not include env options to set the language to UTF8 and by default env seems to be using US-ASCII.
So, to fix this little problem all you have to do is ssh in to your Micro Cloudfoundry instance and as root, edit;
/var/vcap/packages/cloud_controller/cloud_controller/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.37/lib/vcap/staging/plugin/gemfile_support.rb
and change the following block;
to look like;
You shouldn’t need to restart anything at all, just push the app again and everything should work fine.