elkinsware-erubis_rails_helper 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -4
- data/lib/erubis_rails_helper.rb +12 -6
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -7,6 +7,9 @@
|
|
7
7
|
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.
|
8
8
|
The fix is minor and I am submitting it to Erubis but until it is fixed this will work.
|
9
9
|
|
10
|
+
The code is a copy of the rails_helper in Erubis 2.6.4 with a couple of slight modifications to
|
11
|
+
get the code to work with Rails 2.3.
|
12
|
+
|
10
13
|
== FEATURES/PROBLEMS:
|
11
14
|
|
12
15
|
* Drop in replacement for the Erubis Rails Helper in the Erubis gem.
|
@@ -16,13 +19,14 @@ The fix is minor and I am submitting it to Erubis but until it is fixed this wil
|
|
16
19
|
FIX (code sample of usage)
|
17
20
|
inside config/environment.rb and the following
|
18
21
|
config.gem 'erubis' , :version => '2.6.4'
|
19
|
-
config.gem 'erubis_rails_helper'
|
20
|
-
|
22
|
+
config.gem 'elkinsware-erubis_rails_helper', :lib => 'erubis_rails_helper', :source => 'http://gems.github.com'
|
23
|
+
|
24
|
+
#you can customize some of the options for Erubis still if you want to.
|
21
25
|
add config/initializers/erubis_config.rb
|
22
26
|
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
|
23
27
|
#Erubis::Helpers::RailsHelper.init_properties = {}
|
24
|
-
Erubis::Helpers::RailsHelper.show_src = false
|
25
|
-
Erubis::Helpers::RailsHelper.preprocessing = true
|
28
|
+
#Erubis::Helpers::RailsHelper.show_src = false
|
29
|
+
#Erubis::Helpers::RailsHelper.preprocessing = true
|
26
30
|
|
27
31
|
== REQUIREMENTS:
|
28
32
|
|
data/lib/erubis_rails_helper.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
#This code is a copy of /lib/erubis/helper/rails_helper.rb from Erubis 2.6.4 as a base and then some modifications
|
2
|
+
# to make it work with Rails 2.3. The only significant change is the addition of OutputBufferEnhancer module
|
3
|
+
# and including this module in the Eruby and FastEruby class.
|
4
|
+
|
5
|
+
if defined?(Rails) and defined?(ActionController)
|
5
6
|
$stderr.puts %[This erubis_rails requires actionpack 2.2.2 or higher]
|
6
7
|
end
|
7
8
|
|
@@ -14,23 +15,27 @@ rescue LoadError
|
|
14
15
|
end
|
15
16
|
|
16
17
|
module Erubis
|
18
|
+
|
19
|
+
#FOR_FIX: Added to make Erubis and Rails 2.3 work together
|
17
20
|
module OutputBufferEnhancer
|
18
21
|
|
19
22
|
def self.desc # :nodoc:
|
20
|
-
"set '
|
23
|
+
"set 'output_buffer = _buf = \"\";'"
|
21
24
|
end
|
22
25
|
|
23
26
|
def add_preamble(src)
|
24
|
-
src << "__in_erubis_template=true;
|
27
|
+
src << "__in_erubis_template=true; output_buffer = _buf = '';"
|
25
28
|
end
|
26
29
|
|
27
30
|
end
|
28
31
|
|
32
|
+
#FOR_FIX: Changed to make Erubis and Rails 2.3 work together
|
29
33
|
class Eruby
|
30
34
|
#include ErboutEnhancer # will generate '_erbout = _buf = ""; '
|
31
35
|
include OutputBufferEnhancer
|
32
36
|
end
|
33
37
|
|
38
|
+
#FOR_FIX: Changed to make Erubis and Rails 2.3 work together
|
34
39
|
class FastEruby
|
35
40
|
#include ErboutEnhancer # will generate '_erbout = _buf = ""; '
|
36
41
|
include OutputBufferEnhancer
|
@@ -367,6 +372,7 @@ end ###
|
|
367
372
|
|
368
373
|
|
369
374
|
## finish
|
375
|
+
#FOR_FIX: Changed this for logging and feedback that this gem is being loaded on startup
|
370
376
|
if defined?(Rails) and defined?(ActionController)
|
371
377
|
ActionController::Base.new.logger.info "** Erubis #{::Erubis::VERSION}"
|
372
378
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elkinsware-erubis_rails_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Elkins
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|