erubis_rails_helper

DESCRIPTION:

This is a fix for Erubis integration with Rails 2.3. It is a drop in replacement for the rails helper in the Erubis gem.

The code makes a few tweaks to the Erubis 2.6.4 Rails Helper along with the Generator class. The main issue with getting Erubis and Rails 2.3 to work together is to replace “_buf” with “@output_buffer” in the generator code. Rails 2.3 relies on for “@output_buffer” to be used in the generated code to make helpers like capture_helper.rb work properly.

FEATURES/PROBLEMS:

  • Drop in replacement for the Erubis Rails Helper in the Erubis gem.

  • Using the tests from actionpack-2.3, this passes all but two tests currently. The two failures are because there are two end of line characters instead of one end of line characters. I think that is none critical for the moment.

SYNOPSIS:

inside config/environment.rb and the following
   config.gem 'erubis' , :version => '2.6.4'
   config.gem 'elkinsware-erubis_rails_helper', :lib => 'erubis_rails_helper', :source => 'http://gems.github.com'

#you can customize some of the options for Erubis still if you want to by
#add config/initializers/erubis_config.rb
   #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
   #Erubis::Helpers::RailsHelper.init_properties = {}
   Erubis::Helpers::RailsHelper.show_src = false
   Erubis::Helpers::RailsHelper.preprocessing = true

REQUIREMENTS:

  • Rails 2.3

  • Erubis 2.6.4

INSTALL:

  • sudo gem install elkinsware-erubis_rails_helper

LICENSE:

(The MIT License)

Copyright © 2009 Dave Elkins (elkinsware)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.