ruby_template_handler 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +13 -0
- data/README.markdown +7 -0
- data/Rakefile +36 -0
- data/lib/ruby_template_handler.rb +4 -0
- data/lib/ruby_template_handler/handler.rb +17 -0
- data/lib/ruby_template_handler/version.rb +11 -0
- data/rails/init.rb +2 -0
- metadata +125 -0
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2010 Aurora Feint, Inc.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
7
|
+
require "ruby_template_handler/version"
|
8
|
+
|
9
|
+
desc "builds the gem"
|
10
|
+
task :build do
|
11
|
+
FileUtils.mkdir_p "pkg"
|
12
|
+
system "gem build ruby_template_handler.gemspec && mv *.gem pkg/"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
Rake::TestTask.new(:test) do |test|
|
17
|
+
test.libs << 'lib' << 'test'
|
18
|
+
test.pattern = 'test/**/test_*.rb'
|
19
|
+
test.verbose = true
|
20
|
+
end
|
21
|
+
|
22
|
+
task :default => :test
|
23
|
+
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'yard'
|
27
|
+
|
28
|
+
YARD::Rake::YardocTask.new do |t|
|
29
|
+
t.files = ['lib/**/*.rb', "README.markdown", "LICENSE"]
|
30
|
+
t.options = ["--private", "--protected", '-odoc']
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :yard do
|
34
|
+
puts "The yard gem couldn't be loaded."
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RubyTemplateHandler
|
2
|
+
class Handler < ActionView::TemplateHandler
|
3
|
+
include ActionView::TemplateHandlers::Compilable
|
4
|
+
|
5
|
+
def compile(template)
|
6
|
+
unless File.basename(template.filename).starts_with?('_')
|
7
|
+
src = 'ActiveSupport::JSON.encode(code.call)'
|
8
|
+
else
|
9
|
+
src = "code.call"
|
10
|
+
end
|
11
|
+
|
12
|
+
"code = lambda{#{template.source}};" +
|
13
|
+
"self.output_buffer = (#{src})"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/rails/init.rb
ADDED
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_template_handler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Scott Fleckenstein
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-16 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: shoulda
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 11
|
30
|
+
- 1
|
31
|
+
version: 2.11.1
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: yard
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 5
|
44
|
+
- 3
|
45
|
+
version: 0.5.3
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: mocha
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 9
|
58
|
+
- 8
|
59
|
+
version: 0.9.8
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: actionpack
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 2
|
71
|
+
- 3
|
72
|
+
- 5
|
73
|
+
version: 2.3.5
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
description: A Rails view template handler that renders Ruby objects to JSON.
|
77
|
+
email: nullstyle@gmail.com
|
78
|
+
executables: []
|
79
|
+
|
80
|
+
extensions: []
|
81
|
+
|
82
|
+
extra_rdoc_files: []
|
83
|
+
|
84
|
+
files:
|
85
|
+
- lib/ruby_template_handler/handler.rb
|
86
|
+
- lib/ruby_template_handler/version.rb
|
87
|
+
- lib/ruby_template_handler.rb
|
88
|
+
- LICENSE
|
89
|
+
- README.markdown
|
90
|
+
- Rakefile
|
91
|
+
- rails/init.rb
|
92
|
+
has_rdoc: true
|
93
|
+
homepage: http://github.com/aurorafeint/ruby_template_handler
|
94
|
+
licenses: []
|
95
|
+
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
segments:
|
113
|
+
- 1
|
114
|
+
- 3
|
115
|
+
- 6
|
116
|
+
version: 1.3.6
|
117
|
+
requirements: []
|
118
|
+
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.3.6
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Produce JSON views using pure-ruby
|
124
|
+
test_files: []
|
125
|
+
|