Bryan,We just switched from the 1.4.0.pre6 to git master and things did improve, but they are not perfect:
1. Hobo rake tasks have been lost
* I can't do a hobo:generate_taglibs
2. rails s does not work in development
* the "http://localhost:3000/" gets stripped
FYI, here is our Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'json'
gem 'whiskey_disk'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '< 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
# See https://github.com/sstephenson/execjs#readme for more
supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
gem "hobo", :git => "git://github.com/tablatom/hobo.git"
gem "hobo_rapid", "1.4.0.pre6"
gem "hobo_jquery", "1.4.0.pre6"
gem "hobo_jquery_ui", "1.4.0.pre6"
gem "hobo_clean", "1.4.0.pre6"
gem "jquery-ui-themes", "~> 0.0.4"
# The asset pipeline in Rails is really slow in development mode.
# Hobo has a lot of assets, so speed it up with rails-dev-tweaks
gem "rails-dev-tweaks", "~> 0.6.1", :group => :development
gem "hobo_clean_admin", "1.4.0.pre6"
Are the rest of the hobo gem configurations correct? Or should we be
referring to a github repository for those as well?
Also, I was looking at the following code in hobo/app/helpers/hobo_route_helper.rb:
def recognize_page_path
# round tripping params through the router will remove
# unnecessary params
url = params[:page_path] || url_for(params)
if ENV['RAILS_RELATIVE_URL_ROOT']
url.gsub!(/^#{ENV['RAILS_RELATIVE_URL_ROOT']}/, "")
url.gsub!(/^https?:\/\/.*?#{ENV['RAILS_RELATIVE_URL_ROOT']}/, "")
end
Rails.application.routes.recognize_path(url)
end
I have some questions:
1. What happens if the ENV['RAILS_RELATIVE_URL_ROOT'] is set to "/"?
Should it be stripped off or left?
2. What happens on the second gsub if ENV['RAILS_RELATIVE_URL_ROOT'] is set to /app and there is a /apple route? Won't it strip off too much? (I believe, but have not tested, that "http://www.server.com/app/apples/1" will get mapped to "les/1"). 3. I think that the gsub! can be replaced by sub! because you are anchoring the match to the beginning of the string. Would the following (untested) code be an improvement: if relative_root = ENV['RAILS_RELATIVE_URL_ROOT'] url.sub! %r<https?://[^/]*>, "" # remove the protocol, server and port (if present) url.sub! url.sub %r<^#{relative_root}>, "" end Regards, Henry On 12-05-15 09:19 AM, Bryan Larsen wrote:
I can't comment on Rails 3.2, but I can comment on relative_url_root, since we use that in our deployments, so fixing bugs to make that work is a high priority. To use a relative url on Hobo 1.3, you have to be running the latest 1-3-stable from Github (I should really package that as 1.3.1 soon), and then add this to config/environments/production.rb: config.action_controller.relative_url_root = "/portal" config.action_controller.asset_path = "/portal%s" /portal is our relative root. To use a relative url on Hobo 1.4, make sure you are running master, and then make sure you have this in your routes.rb: root :to => 'front#index' match ENV['RAILS_RELATIVE_URL_ROOT'] => 'front#index' if ENV['RAILS_RELATIVE_URL_ROOT'] That hack will be added to all newly generated applications, but may not be in your app if you generated it more than a couple of weeks ago. On 1.4, you do not need the two 1.3 config settings, they must be removed. Bryan P.S. it would be nice if you found another bug preventing Hobo 1.4 from working with relative_url_root. That would mean that I would HAVE to upgrade Hobo to 3.2 ASAP. :) On Mon, May 14, 2012 at 6:38 PM, Henry Baragar <[email protected]> wrote:Hi Bryan, A month ago you said that "hopefully soon I'll fix it (Hobo 1.4) to work with rails 3.2". Is there an ETA for this? (I know, I should not ask such questions without being prepared to dig in and help get it done). The reason I ask is that config.action_controller.relative_url_root (and ENV['RAILS_RELATIVE_URL_ROOT']) is broken in Rails 3.1.4 but apparently fixed in 3.2. Cheers, Henry -- Henry Baragar Instantiated Software
-- Henry Baragar Instantiated Software 416-907-8454 x42
smime.p7s
Description: S/MIME Cryptographic Signature
