tongo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +20 -0
- data/README.md +80 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/lib/tongo.rb +20 -0
- data/lib/tongo/context.rb +9 -0
- data/lib/tongo/engine.rb +7 -0
- data/lib/tongo/generator.rb +63 -0
- data/lib/tongo/parser.rb +63 -0
- data/lib/tongo/template.rb +7 -0
- data/spec/integration/context_spec.rb +59 -0
- data/spec/integration/fixtures/example.tng +1 -0
- data/spec/integration/tilt_template_spec.rb +17 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/unit/tongo_generator_spec.rb +9 -0
- data/spec/unit/tongo_parser_spec.rb +31 -0
- data/tongo.gemspec +101 -0
- metadata +268 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.8.7
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tongo (0.0.1)
|
5
|
+
nokogiri
|
6
|
+
temple
|
7
|
+
tilt
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
diff-lcs (1.1.2)
|
13
|
+
git (1.2.5)
|
14
|
+
jeweler (1.5.2)
|
15
|
+
bundler (~> 1.0.0)
|
16
|
+
git (>= 1.2.5)
|
17
|
+
rake
|
18
|
+
nokogiri (1.4.4)
|
19
|
+
rake (0.8.7)
|
20
|
+
rcov (0.9.9)
|
21
|
+
rspec (2.5.0)
|
22
|
+
rspec-core (~> 2.5.0)
|
23
|
+
rspec-expectations (~> 2.5.0)
|
24
|
+
rspec-mocks (~> 2.5.0)
|
25
|
+
rspec-core (2.5.1)
|
26
|
+
rspec-expectations (2.5.0)
|
27
|
+
diff-lcs (~> 1.1.2)
|
28
|
+
rspec-mocks (2.5.0)
|
29
|
+
temple (0.1.8)
|
30
|
+
tilt (1.2.2)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
bundler
|
37
|
+
jeweler (~> 1.5.0.pre6)
|
38
|
+
rcov
|
39
|
+
rspec
|
40
|
+
tongo!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Rodrigo Alvarez
|
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.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
tongo
|
2
|
+
===
|
3
|
+
|
4
|
+
tongo is a ruby template engine based in [Radius](https://github.com/jlong/radius) and [Liquid](https://github.com/tobi/liquid).
|
5
|
+
I couldn't have done it without the help of [Temple](https://github.com/judofyr/temple), in my opinion, one of the most interesting projects I've ever seen.
|
6
|
+
Right now the implementation is pretty naïve, I haven't done any kind of optimizations and there are probably bugs sneaking around.
|
7
|
+
|
8
|
+
Here comes what you were looking for, an example:
|
9
|
+
|
10
|
+
|
11
|
+
Given a context like this one:
|
12
|
+
|
13
|
+
class CustomContext < Tongo::Context
|
14
|
+
tag :shout do
|
15
|
+
'ARGH!'
|
16
|
+
end
|
17
|
+
|
18
|
+
tag :whisper do
|
19
|
+
'shhh'
|
20
|
+
end
|
21
|
+
|
22
|
+
tag :upcase do |content|
|
23
|
+
content.upcase
|
24
|
+
end
|
25
|
+
|
26
|
+
tag :loop do |attrs,content|
|
27
|
+
number = (attrs['times'] || 1).to_i
|
28
|
+
result = ''
|
29
|
+
number.times { result << content }
|
30
|
+
result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
When you use it to handle this template:
|
35
|
+
|
36
|
+
<h1 class="highlight">Header</h1>
|
37
|
+
<ul>
|
38
|
+
<tng:loop times="3">
|
39
|
+
<li>Hello World</li>
|
40
|
+
</tng:loop>
|
41
|
+
</ul>
|
42
|
+
<tng:shout />
|
43
|
+
<strong><tng:shout /></strong>
|
44
|
+
<em>%{whisper | upcase}, %{shout}</em>
|
45
|
+
|
46
|
+
You should get this result:
|
47
|
+
|
48
|
+
|
49
|
+
<h1 class="highlight">Header</h1>
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li>Hello World</li>
|
53
|
+
|
54
|
+
<li>Hello World</li>
|
55
|
+
|
56
|
+
<li>Hello World</li>
|
57
|
+
|
58
|
+
</ul>
|
59
|
+
ARGH!
|
60
|
+
<strong>ARGH!</strong>
|
61
|
+
<em>SHHH, ARGH!</em>
|
62
|
+
|
63
|
+
So basically, it supports markup tags like <tng:whatever some="attribute">, that can be empty or nested, and text tags like %{whatever | filter}.
|
64
|
+
|
65
|
+
Contributing to tongo
|
66
|
+
---
|
67
|
+
|
68
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
69
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
70
|
+
* Fork the project
|
71
|
+
* Start a feature/bugfix branch
|
72
|
+
* Commit and push until you are happy with your contribution
|
73
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
74
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
75
|
+
|
76
|
+
Copyright
|
77
|
+
---
|
78
|
+
|
79
|
+
Copyright (c) 2011 Rodrigo Alvarez. See LICENSE.txt for
|
80
|
+
further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "tongo"
|
16
|
+
gem.homepage = "http://github.com/Papipo/tongo"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{ruby template engine based on radius and liquid}
|
19
|
+
gem.description = %Q{}
|
20
|
+
gem.email = "papipo@gmail.com"
|
21
|
+
gem.authors = ["Rodrigo Alvarez"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
gem.add_runtime_dependency 'temple'
|
25
|
+
gem.add_runtime_dependency 'tilt'
|
26
|
+
gem.add_runtime_dependency 'nokogiri'
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rspec/core'
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
37
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
38
|
+
spec.rcov = true
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :spec
|
42
|
+
|
43
|
+
require 'rake/rdoctask'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "tongo #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/tongo.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
unless Object.const_defined?('BasicObject')
|
2
|
+
class BasicObject
|
3
|
+
KEEP_METHODS = %w"__id__ __send__ instance_eval == equal? initialize"
|
4
|
+
|
5
|
+
def self.remove_methods!
|
6
|
+
m = (private_instance_methods + instance_methods) - KEEP_METHODS
|
7
|
+
m.each{|m| undef_method(m)}
|
8
|
+
end
|
9
|
+
remove_methods!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'temple'
|
14
|
+
require 'nokogiri'
|
15
|
+
|
16
|
+
require 'tongo/generator'
|
17
|
+
require 'tongo/parser'
|
18
|
+
require 'tongo/context'
|
19
|
+
require 'tongo/engine'
|
20
|
+
require 'tongo/template'
|
data/lib/tongo/engine.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
module Tongo
|
2
|
+
class Generator
|
3
|
+
|
4
|
+
TOKENIZER = /(\%\{.+?\})/
|
5
|
+
INTERPOLATION = /\%\{(.+?)\}/
|
6
|
+
|
7
|
+
def compile(exp)
|
8
|
+
"\"#{compile!(exp)}\""
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
def compile!(exp)
|
16
|
+
case exp.first
|
17
|
+
when :multi
|
18
|
+
exp[1..-1].map { |e| compile!(e) }.join
|
19
|
+
when :empty
|
20
|
+
"\#{#{exp[1]}(#{exp[2]})}"
|
21
|
+
when :nested
|
22
|
+
"\#{#{exp[1]}(#{exp[2].inspect}, \"#{compile!(exp[3])}\")}"
|
23
|
+
when :text
|
24
|
+
compiled_text(exp[1])
|
25
|
+
when :html
|
26
|
+
html(exp)
|
27
|
+
else
|
28
|
+
raise "Unhandled exp: #{exp.first}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def html(exp)
|
34
|
+
"<#{exp[1]}#{join_attributes(exp[2])}>#{compile!(exp[3])}</#{exp[1]}>"
|
35
|
+
end
|
36
|
+
|
37
|
+
def join_attributes(attributes)
|
38
|
+
return '' if attributes.empty?
|
39
|
+
attributes.inject([]) do |memo,attribute|
|
40
|
+
memo << "#{attribute[0]}=\\\"#{attribute[1]}\\\""
|
41
|
+
end.join('').tap { |result| result.replace(" #{result}") }
|
42
|
+
end
|
43
|
+
|
44
|
+
def tokenize_text(input)
|
45
|
+
input.split(TOKENIZER)
|
46
|
+
end
|
47
|
+
|
48
|
+
def compiled_text(input)
|
49
|
+
tokenize_text(input).map do |token|
|
50
|
+
(matchdata = token.match(INTERPOLATION)) ? handle_interpolation_token(token, matchdata) : token
|
51
|
+
end.join
|
52
|
+
end
|
53
|
+
|
54
|
+
def handle_interpolation_token(token, matchdata)
|
55
|
+
pattern, value = matchdata.values_at(0, 1)
|
56
|
+
expand_interpolation(value)
|
57
|
+
end
|
58
|
+
|
59
|
+
def expand_interpolation(interpolation)
|
60
|
+
interpolation.split('|').inject('') { |memo,element| "#{element.strip}(#{memo})" }.tap { |result| result.replace("\#{#{result}}") }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/tongo/parser.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
module Tongo
|
2
|
+
class Parser
|
3
|
+
def compile(src)
|
4
|
+
src = "<root xmlns:#{@ns}=\"http://blog.codecaster.es\">#{src}</root>"
|
5
|
+
doc = Nokogiri::XML::DocumentFragment.parse(src)
|
6
|
+
traverse_children(doc.children)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@ns = options[:ns] || 'tng'
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def traverse_children(doc, result = [:multi])
|
15
|
+
doc.children.each do |doc|
|
16
|
+
result << handle_node(doc)
|
17
|
+
end
|
18
|
+
result
|
19
|
+
end
|
20
|
+
|
21
|
+
def handle_node(node)
|
22
|
+
if node.text?
|
23
|
+
text(node)
|
24
|
+
elsif node.children.empty?
|
25
|
+
empty_node(node)
|
26
|
+
else
|
27
|
+
nested_node(node)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def ns
|
32
|
+
@ns
|
33
|
+
end
|
34
|
+
|
35
|
+
def nested_node(e)
|
36
|
+
(is_tongo?(e) ? tongo(e, true) : html(e)) << traverse_children(e)
|
37
|
+
end
|
38
|
+
|
39
|
+
def empty_node(e)
|
40
|
+
is_tongo?(e) ? tongo(e) : html(e)
|
41
|
+
end
|
42
|
+
|
43
|
+
def is_tongo?(e)
|
44
|
+
e.namespace && e.namespace.prefix == ns
|
45
|
+
end
|
46
|
+
|
47
|
+
def text(e)
|
48
|
+
[:text, e.text]
|
49
|
+
end
|
50
|
+
|
51
|
+
def html(e)
|
52
|
+
[:html, e.name, node_attributes_to_hash(e)]
|
53
|
+
end
|
54
|
+
|
55
|
+
def tongo(e, nested = false)
|
56
|
+
[nested ? :nested : :empty, e.name, node_attributes_to_hash(e)]
|
57
|
+
end
|
58
|
+
|
59
|
+
def node_attributes_to_hash(node)
|
60
|
+
node.attributes.inject({}) { |memo,attribute| memo.merge(attribute[0] => attribute[1].value) }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
class CustomContext < Tongo::Context
|
4
|
+
tag :shout do
|
5
|
+
'ARGH!'
|
6
|
+
end
|
7
|
+
|
8
|
+
tag :whisper do
|
9
|
+
'shhh'
|
10
|
+
end
|
11
|
+
|
12
|
+
tag :upcase do |content|
|
13
|
+
content.upcase
|
14
|
+
end
|
15
|
+
|
16
|
+
tag :loop do |attrs,content|
|
17
|
+
number = (attrs['times'] || 1).to_i
|
18
|
+
result = ''
|
19
|
+
number.times { result << content }
|
20
|
+
result
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe Tongo::Context do
|
25
|
+
before do
|
26
|
+
@src = <<-SRC
|
27
|
+
<h1 class="highlight">Header</h1>
|
28
|
+
<ul>
|
29
|
+
<tng:loop times="3">
|
30
|
+
<li>Hello World</li>
|
31
|
+
</tng:loop>
|
32
|
+
</ul>
|
33
|
+
<tng:shout />
|
34
|
+
<strong><tng:shout /></strong>
|
35
|
+
<em>%{whisper | upcase}, %{shout}</em>
|
36
|
+
SRC
|
37
|
+
|
38
|
+
@context = CustomContext.new
|
39
|
+
end
|
40
|
+
|
41
|
+
#Fixme indentation and extra lines
|
42
|
+
it "should render the expected result" do
|
43
|
+
Tongo::Template.new { @src }.render(@context).should == <<-RES
|
44
|
+
<h1 class="highlight">Header</h1>
|
45
|
+
<ul>
|
46
|
+
|
47
|
+
<li>Hello World</li>
|
48
|
+
|
49
|
+
<li>Hello World</li>
|
50
|
+
|
51
|
+
<li>Hello World</li>
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
ARGH!
|
55
|
+
<strong>ARGH!</strong>
|
56
|
+
<em>SHHH, ARGH!</em>
|
57
|
+
RES
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<strong>%{text}</strong>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
class CustomContext < Tongo::Context
|
4
|
+
tag :text do
|
5
|
+
'Some text here'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "a .tng template" do
|
10
|
+
before do
|
11
|
+
@template = Tilt.new(File.join(File.dirname(__FILE__), 'fixtures', 'example.tng'))
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should render the correct result" do
|
15
|
+
@template.render(CustomContext.new).strip.should == "<strong>Some text here</strong>"
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Tongo::Generator do
|
4
|
+
it { Tongo::Generator.new.send(:tokenize_text, '%{whisper}, %{shout}').should == ['', '%{whisper}', ', ', '%{shout}']}
|
5
|
+
it { Tongo::Generator.new.send(:tokenize_text, 'normal text %{interpolation} more text').should == ['normal text ', '%{interpolation}', ' more text']}
|
6
|
+
it { Tongo::Generator.new.send(:expand_interpolation, 'method | filter | more_filter').should == "\#{more_filter(filter(method()))}" }
|
7
|
+
it { Tongo::Generator.new.send(:compile!, [:text, 'testing, %{method | filter | more_filter} stuff']).should == 'testing, #{more_filter(filter(method()))} stuff' }
|
8
|
+
it { Tongo::Generator.new.send(:compile!, [:nested, 'loop', {'some' => 'attr'}, [:text, 'content']]).should == '#{loop({"some"=>"attr"}, "content")}' }
|
9
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
|
4
|
+
describe Tongo::Parser do
|
5
|
+
def compiled(src)
|
6
|
+
Tongo::Parser.new.compile(src)
|
7
|
+
end
|
8
|
+
|
9
|
+
it { compiled("Plain text").should == [:multi, [:text, "Plain text"]] }
|
10
|
+
it { compiled("<h1>Header</h1>").should == [:multi, [:html, "h1", {}, [:multi, [:text, "Header"]]]] }
|
11
|
+
it { compiled("<tng:test />").should == [:multi, [:empty, 'test', {}]]}
|
12
|
+
it { compiled("<tng:upcase>test</tng:upcase>").should == [:multi, [:nested, 'upcase', {}, [:multi, [:text, 'test']]]] }
|
13
|
+
it { compiled("%{my_method}").should == [:multi, [:text, '%{my_method}']] }
|
14
|
+
it do
|
15
|
+
compiled("<body><p class=\"first\">Paragraph</p><p>Another</p></body>").should ==
|
16
|
+
[:multi,
|
17
|
+
[:html, 'body', {}, [:multi,
|
18
|
+
[:html, 'p', {"class" => 'first'}, [:multi, [:text, 'Paragraph']]],
|
19
|
+
[:html, 'p', {}, [:multi, [:text, 'Another']]]
|
20
|
+
]]
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
it { compiled("<img src=\"image.jpg\">").should == [:multi, [:html, 'img', {"src" => "image.jpg"}]] }
|
25
|
+
it { compiled("<a href=\"/\">link</a>").should == [:multi, [:html, 'a', {"href" => "/"}, [:multi, [:text, 'link']]]] }
|
26
|
+
it { compiled("<tng:loop times=\"3\">test</tng:loop>").should == [:multi, [:nested, 'loop', {"times" => "3"}, [:multi, [:text, 'test']]]] }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe Tongo::Parser, "with a custom namespace" do
|
30
|
+
it { Tongo::Parser.new(:ns => 'pop').compile('<pop:custom />').should == [:multi, [:empty, 'custom', {}]] }
|
31
|
+
end
|
data/tongo.gemspec
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tongo}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rodrigo Alvarez"]
|
12
|
+
s.date = %q{2011-03-18}
|
13
|
+
s.description = %q{}
|
14
|
+
s.email = %q{papipo@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".rvmrc",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/tongo.rb",
|
30
|
+
"lib/tongo/context.rb",
|
31
|
+
"lib/tongo/engine.rb",
|
32
|
+
"lib/tongo/generator.rb",
|
33
|
+
"lib/tongo/parser.rb",
|
34
|
+
"lib/tongo/template.rb",
|
35
|
+
"spec/integration/context_spec.rb",
|
36
|
+
"spec/integration/fixtures/example.tng",
|
37
|
+
"spec/integration/tilt_template_spec.rb",
|
38
|
+
"spec/spec_helper.rb",
|
39
|
+
"spec/unit/tongo_generator_spec.rb",
|
40
|
+
"spec/unit/tongo_parser_spec.rb",
|
41
|
+
"tongo.gemspec"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/Papipo/tongo}
|
44
|
+
s.licenses = ["MIT"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.6.2}
|
47
|
+
s.summary = %q{ruby template engine based on radius and liquid}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/integration/context_spec.rb",
|
50
|
+
"spec/integration/tilt_template_spec.rb",
|
51
|
+
"spec/spec_helper.rb",
|
52
|
+
"spec/unit/tongo_generator_spec.rb",
|
53
|
+
"spec/unit/tongo_parser_spec.rb"
|
54
|
+
]
|
55
|
+
|
56
|
+
if s.respond_to? :specification_version then
|
57
|
+
s.specification_version = 3
|
58
|
+
|
59
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<tongo>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
64
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
68
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
69
|
+
s.add_runtime_dependency(%q<temple>, [">= 0"])
|
70
|
+
s.add_runtime_dependency(%q<tilt>, [">= 0"])
|
71
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<tongo>, [">= 0"])
|
74
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
75
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
76
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
77
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
78
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
79
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
80
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
81
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
82
|
+
s.add_dependency(%q<temple>, [">= 0"])
|
83
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
84
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
85
|
+
end
|
86
|
+
else
|
87
|
+
s.add_dependency(%q<tongo>, [">= 0"])
|
88
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
89
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
90
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
91
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
92
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
93
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
94
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre6"])
|
95
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
96
|
+
s.add_dependency(%q<temple>, [">= 0"])
|
97
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
98
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
metadata
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tongo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Rodrigo Alvarez
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-18 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
name: tongo
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
type: :development
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
name: rspec
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
prerelease: false
|
51
|
+
type: :development
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
name: bundler
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
prerelease: false
|
65
|
+
type: :development
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 1923832021
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 5
|
75
|
+
- 0
|
76
|
+
- pre
|
77
|
+
- 6
|
78
|
+
version: 1.5.0.pre6
|
79
|
+
name: jeweler
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
name: rcov
|
94
|
+
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
prerelease: false
|
97
|
+
type: :development
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
name: rspec
|
108
|
+
version_requirements: *id006
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
prerelease: false
|
111
|
+
type: :development
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
name: bundler
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
prerelease: false
|
125
|
+
type: :development
|
126
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 1923832021
|
132
|
+
segments:
|
133
|
+
- 1
|
134
|
+
- 5
|
135
|
+
- 0
|
136
|
+
- pre
|
137
|
+
- 6
|
138
|
+
version: 1.5.0.pre6
|
139
|
+
name: jeweler
|
140
|
+
version_requirements: *id008
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
prerelease: false
|
143
|
+
type: :development
|
144
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: 3
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
version: "0"
|
153
|
+
name: rcov
|
154
|
+
version_requirements: *id009
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
prerelease: false
|
157
|
+
type: :runtime
|
158
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 3
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
version: "0"
|
167
|
+
name: temple
|
168
|
+
version_requirements: *id010
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
prerelease: false
|
171
|
+
type: :runtime
|
172
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: 3
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
version: "0"
|
181
|
+
name: tilt
|
182
|
+
version_requirements: *id011
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
prerelease: false
|
185
|
+
type: :runtime
|
186
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
hash: 3
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
version: "0"
|
195
|
+
name: nokogiri
|
196
|
+
version_requirements: *id012
|
197
|
+
description: ""
|
198
|
+
email: papipo@gmail.com
|
199
|
+
executables: []
|
200
|
+
|
201
|
+
extensions: []
|
202
|
+
|
203
|
+
extra_rdoc_files:
|
204
|
+
- LICENSE.txt
|
205
|
+
- README.md
|
206
|
+
files:
|
207
|
+
- .document
|
208
|
+
- .rspec
|
209
|
+
- .rvmrc
|
210
|
+
- Gemfile
|
211
|
+
- Gemfile.lock
|
212
|
+
- LICENSE.txt
|
213
|
+
- README.md
|
214
|
+
- Rakefile
|
215
|
+
- VERSION
|
216
|
+
- lib/tongo.rb
|
217
|
+
- lib/tongo/context.rb
|
218
|
+
- lib/tongo/engine.rb
|
219
|
+
- lib/tongo/generator.rb
|
220
|
+
- lib/tongo/parser.rb
|
221
|
+
- lib/tongo/template.rb
|
222
|
+
- spec/integration/context_spec.rb
|
223
|
+
- spec/integration/fixtures/example.tng
|
224
|
+
- spec/integration/tilt_template_spec.rb
|
225
|
+
- spec/spec_helper.rb
|
226
|
+
- spec/unit/tongo_generator_spec.rb
|
227
|
+
- spec/unit/tongo_parser_spec.rb
|
228
|
+
- tongo.gemspec
|
229
|
+
has_rdoc: true
|
230
|
+
homepage: http://github.com/Papipo/tongo
|
231
|
+
licenses:
|
232
|
+
- MIT
|
233
|
+
post_install_message:
|
234
|
+
rdoc_options: []
|
235
|
+
|
236
|
+
require_paths:
|
237
|
+
- lib
|
238
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
239
|
+
none: false
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
hash: 3
|
244
|
+
segments:
|
245
|
+
- 0
|
246
|
+
version: "0"
|
247
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
|
+
none: false
|
249
|
+
requirements:
|
250
|
+
- - ">="
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
hash: 3
|
253
|
+
segments:
|
254
|
+
- 0
|
255
|
+
version: "0"
|
256
|
+
requirements: []
|
257
|
+
|
258
|
+
rubyforge_project:
|
259
|
+
rubygems_version: 1.6.2
|
260
|
+
signing_key:
|
261
|
+
specification_version: 3
|
262
|
+
summary: ruby template engine based on radius and liquid
|
263
|
+
test_files:
|
264
|
+
- spec/integration/context_spec.rb
|
265
|
+
- spec/integration/tilt_template_spec.rb
|
266
|
+
- spec/spec_helper.rb
|
267
|
+
- spec/unit/tongo_generator_spec.rb
|
268
|
+
- spec/unit/tongo_parser_spec.rb
|