erbal 1.0.rc8 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Envato, Ian Leitch.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -2,72 +2,43 @@
2
2
 
3
3
  == Intro
4
4
 
5
- Erbal is a lightweight ERB parser based on the Ragel State Machine Compiler (http://www.complang.org/ragel/) and written in C. It's very fast.
5
+ Erbal is a lightweight ERB parser that uses the Ragel State Machine Compiler (http://www.complang.org/ragel/). It's written in C, it's very fast. Erbal also produces faster Ruby code than Ruby's ERB implementation to give you a evaluation-time performance benefit.
6
6
 
7
- Please note that Erbal isn't intended as a full replacement for the ERB implementation that ships with Ruby. Erbal only implements parsing of the following tags:
7
+ == Using Erbal
8
8
 
9
- <%, <%=, <%#, -%>, %>
10
-
11
- This is to keep Erbal very simple and very fast. If there's a good case for implementing more features from ERB and it doesn't impact performance or add much complexity then I'll consider it. Personally I've never needed anything more.
9
+ >> require 'erbal'
10
+ >> src = Erbal.new("<% a=1 -%>a is: <%= a -%>").parse
11
+ => "@output_buffer = ''; a=1 ;\n@output_buffer << %Q`a is: \#{ a }`;@output_buffer"
12
+ >> eval(src)
13
+ => "a is: 1"
12
14
 
13
- == Using Erbal
15
+ Erbal.new takes an optional 2nd argument which is a hash of options, available options are:
14
16
 
15
- require 'erbal'
16
- e = Erbal.new("<% a=1 -%> a is: <%= a -%>", "@output_buffer")
17
- src = e.parse
18
- eval(src)
19
-
20
- == Rails
17
+ * `:buffer` The name of the output buffer, default is '@output_buffer'
18
+ * `:buffer_initial_value` The initial value of the output buffer, defaults to a blank string.
21
19
 
22
- In your after_initialize block in config/environment.rb add:
20
+ == Rails 2.3
23
21
 
24
- require 'erbal/rails'
22
+ Create the file 'config/initializers/erbal.rb' containing:
23
+
24
+ require 'erbal/rails23'
25
25
  ActionView::Template.register_template_handler :erb, ErbalTemplateHandler
26
26
 
27
- == Benchmarks
28
-
29
- This benchmark was performed on a MacBook Pro with a 2.4Ghz Intel Core 2 Duo and 4GB 667Mhz DDR2 SDRAM. Running Mac OS X 10.6 (Snow Leopard). The code to run it is located in benchmark/bench.rb
30
-
31
- Summary:
32
-
33
- Erbal is 14.6x faster than Ruby's ERB and 7.5x faster than Erubis.
34
-
35
- Details:
36
-
37
- Ruby: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
38
- Erubis: 2.6.5 using Erubis::FastEruby.
39
- Erbal: 0.0.2
40
-
41
- => Warming up.... done
42
- => 10000 runs repeated 6 times
43
-
44
- => Erb:
45
- 1) 13.01
46
- 2) 13.00
47
- 3) 13.01
48
- 4) 13.04
49
- 5) 13.13
50
- 6) 13.23
51
- => Average: 13.07
52
-
53
- => Erbal:
54
- 1) 0.90
55
- 2) 0.89
56
- 3) 0.89
57
- 4) 0.90
58
- 5) 0.89
59
- 6) 0.89
60
- => Average: 0.89
61
-
62
- => Erubis:
63
- 1) 6.63
64
- 2) 6.67
65
- 3) 6.69
66
- 4) 6.71
67
- 5) 6.72
68
- 6) 6.75
69
- => Average: 6.70
27
+ == Rails 3
28
+
29
+ I've not looked into yet.. patches are welcome! ;)
30
+
31
+ == Contributing
32
+
33
+ * Fork the project.
34
+ * Make your feature addition or bug fix.
35
+ * Add tests for it, specs live in the specs/ directory.
36
+ * Commit and send me a pull request.
70
37
 
71
38
  == Credits
72
39
 
73
- Many thanks to Adrian Thurston for writing the Ragel State Machine Compiler (http://www.complang.org/ragel/)!
40
+ Many thanks to Adrian Thurston for writing the Ragel State Machine Compiler (http://www.complang.org/ragel/)!
41
+
42
+ == Copyright
43
+
44
+ Copyright (c) 2010 Envato & Ian Leitch. See LICENSE for details.
File without changes
data/tasks/gem.rake CHANGED
@@ -2,7 +2,7 @@ require 'rake/gempackagetask'
2
2
  require 'yaml'
3
3
 
4
4
  WIN_SUFFIX = ENV['WIN_SUFFIX'] || 'i386-mswin32'
5
- ERBAL_VERSION = '1.0.rc8'
5
+ ERBAL_VERSION = '1.0'
6
6
 
7
7
  task :clean => :clobber_package
8
8
 
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
17
17
  s.homepage = 'http://github.com/ileitch/erbal'
18
18
  s.has_rdoc = false
19
19
 
20
- s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) +
20
+ s.files = %w(LICENSE CHANGELOG README.rdoc Rakefile) +
21
21
  Dir.glob("{lib,spec,tasks,benchmark}/**/*") +
22
22
  Dir.glob("ext/**/*.{h,c,rb,rl}")
23
23
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erbal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940497
5
- prerelease: true
4
+ hash: 15
5
+ prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - rc8
10
- version: 1.0.rc8
9
+ version: "1.0"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ian Leitch
@@ -28,11 +27,11 @@ extensions:
28
27
  extra_rdoc_files: []
29
28
 
30
29
  files:
31
- - COPYING
30
+ - LICENSE
32
31
  - CHANGELOG
33
32
  - README.rdoc
34
33
  - Rakefile
35
- - lib/erbal/rails.rb
34
+ - lib/erbal/rails23.rb
36
35
  - spec/erbal_spec.rb
37
36
  - spec/spec_helper.rb
38
37
  - tasks/ext.rake
@@ -66,14 +65,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
65
  required_rubygems_version: !ruby/object:Gem::Requirement
67
66
  none: false
68
67
  requirements:
69
- - - ">"
68
+ - - ">="
70
69
  - !ruby/object:Gem::Version
71
- hash: 25
70
+ hash: 3
72
71
  segments:
73
- - 1
74
- - 3
75
- - 1
76
- version: 1.3.1
72
+ - 0
73
+ version: "0"
77
74
  requirements: []
78
75
 
79
76
  rubyforge_project:
data/COPYING DELETED
@@ -1,18 +0,0 @@
1
- Copyright (c) 2009 Ian Leitch
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.