ssejs 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +31 -0
- data/VERSION +1 -1
- data/lib/ssejs.rb +2 -1
- data/ssejs.gemspec +4 -4
- metadata +6 -6
- data/README.rdoc +0 -17
data/README.markdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Ssejs: Server Side Embedded JavaScript
|
2
|
+
|
3
|
+
Ssejs lets you render [Embedded JavaScript Templates](http://embeddedjs.com/) on the server in Ruby using [Google's V8 JavaScript Engine](http://code.google.com/p/v8/).
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'ssejs'
|
7
|
+
|
8
|
+
ejs = "<ul>
|
9
|
+
<% for(var i=0; i<foo.length; i++) { %>
|
10
|
+
<li><%= foo[i] %></li>
|
11
|
+
<% } %>
|
12
|
+
</ul>"
|
13
|
+
|
14
|
+
puts Ssejs::render(ejs, :foo => ['bar', 'baz'])
|
15
|
+
|
16
|
+
Outputs:
|
17
|
+
|
18
|
+
<ul>
|
19
|
+
<li>bar</li>
|
20
|
+
<li>baz</li>
|
21
|
+
</ul>
|
22
|
+
|
23
|
+
## Note on Patches/Pull Requests
|
24
|
+
|
25
|
+
* Fork the project.
|
26
|
+
* Make your feature addition or bug fix.
|
27
|
+
* Add tests for it. This is important so I don't break it in a
|
28
|
+
future version unintentionally.
|
29
|
+
* Commit, do not mess with rakefile, version, or history.
|
30
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
31
|
+
* Send me a pull request. Bonus points for topic branches.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/ssejs.rb
CHANGED
@@ -2,9 +2,10 @@ require 'rubygems'
|
|
2
2
|
require 'v8'
|
3
3
|
|
4
4
|
module Ssejs
|
5
|
-
def self.render(template, vars = {})
|
5
|
+
def self.render(template, vars = {}, libs = [])
|
6
6
|
V8::Context.new do |cxt|
|
7
7
|
cxt.load("#{File.dirname(__FILE__)}/ejs.js")
|
8
|
+
libs.each { cxt.load(lib) }
|
8
9
|
cxt['vars'] = vars
|
9
10
|
cxt['template'] = template
|
10
11
|
return cxt.eval("new EJS({text: template}).render(vars)")
|
data/ssejs.gemspec
CHANGED
@@ -5,22 +5,22 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ssejs}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jim Patterson"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-10}
|
13
13
|
s.description = %q{Server Side Embeded Javascript in Ruby}
|
14
14
|
s.email = %q{jpatterson@yammer-inc.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.
|
17
|
+
"README.markdown"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"LICENSE",
|
23
|
-
"README.
|
23
|
+
"README.markdown",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"lib/ejs.js",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssejs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Patterson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-10 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,12 +56,12 @@ extensions: []
|
|
56
56
|
|
57
57
|
extra_rdoc_files:
|
58
58
|
- LICENSE
|
59
|
-
- README.
|
59
|
+
- README.markdown
|
60
60
|
files:
|
61
61
|
- .document
|
62
62
|
- .gitignore
|
63
63
|
- LICENSE
|
64
|
-
- README.
|
64
|
+
- README.markdown
|
65
65
|
- Rakefile
|
66
66
|
- VERSION
|
67
67
|
- lib/ejs.js
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= ssejs
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Jim Patterson. See LICENSE for details.
|