angry_mob_common_targets 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.md +38 -0
- data/lib/common_mob.rb +9 -0
- data/lib/common_mob/digest.rb +43 -0
- data/lib/common_mob/erb.rb +72 -0
- data/lib/common_mob/file.rb +55 -0
- data/lib/common_mob/patch.rb +51 -0
- data/lib/common_mob/resource_locator.rb +9 -0
- data/lib/common_mob/shell.rb +323 -0
- data/lib/common_mob/template.rb +23 -0
- data/lib/common_mob/version.rb +3 -0
- data/targets/crontab_patch.rb +37 -0
- data/targets/extract.rb +40 -0
- data/targets/fetch.rb +40 -0
- data/targets/files.rb +244 -0
- data/targets/git.rb +84 -0
- data/targets/group.rb +33 -0
- data/targets/packages.rb +94 -0
- data/targets/ruby.rb +13 -0
- data/targets/services.rb +184 -0
- data/targets/shell.rb +43 -0
- data/targets/user.rb +108 -0
- data/vendor/mustache/CONTRIBUTORS +9 -0
- data/vendor/mustache/HISTORY.md +135 -0
- data/vendor/mustache/LICENSE +20 -0
- data/vendor/mustache/README.md +405 -0
- data/vendor/mustache/Rakefile +103 -0
- data/vendor/mustache/benchmarks/complex.erb +15 -0
- data/vendor/mustache/benchmarks/complex.haml +12 -0
- data/vendor/mustache/benchmarks/helper.rb +20 -0
- data/vendor/mustache/benchmarks/simple.erb +5 -0
- data/vendor/mustache/benchmarks/speed.rb +78 -0
- data/vendor/mustache/bin/mustache +90 -0
- data/vendor/mustache/contrib/mustache-mode.el +278 -0
- data/vendor/mustache/contrib/mustache.vim +69 -0
- data/vendor/mustache/examples/hash.rb +16 -0
- data/vendor/mustache/examples/hash.yml +5 -0
- data/vendor/mustache/examples/projects.mustache +26 -0
- data/vendor/mustache/examples/projects.yml +28 -0
- data/vendor/mustache/examples/self.mustache +4 -0
- data/vendor/mustache/examples/self.yml +3 -0
- data/vendor/mustache/examples/simple.mustache +10 -0
- data/vendor/mustache/examples/simple.rb +24 -0
- data/vendor/mustache/lib/mustache.rb +358 -0
- data/vendor/mustache/lib/mustache/context.rb +108 -0
- data/vendor/mustache/lib/mustache/generator.rb +160 -0
- data/vendor/mustache/lib/mustache/parser.rb +230 -0
- data/vendor/mustache/lib/mustache/sinatra.rb +180 -0
- data/vendor/mustache/lib/mustache/template.rb +59 -0
- data/vendor/mustache/lib/mustache/version.rb +3 -0
- data/vendor/mustache/lib/rack/bug/panels/mustache_panel.rb +81 -0
- data/vendor/mustache/lib/rack/bug/panels/mustache_panel/mustache_extension.rb +27 -0
- data/vendor/mustache/lib/rack/bug/panels/mustache_panel/view.mustache +46 -0
- data/vendor/mustache/man/mustache.1 +180 -0
- data/vendor/mustache/man/mustache.1.html +204 -0
- data/vendor/mustache/man/mustache.1.ron +127 -0
- data/vendor/mustache/man/mustache.5 +576 -0
- data/vendor/mustache/man/mustache.5.html +415 -0
- data/vendor/mustache/man/mustache.5.ron +324 -0
- data/vendor/mustache/mustache.gemspec +32 -0
- data/vendor/mustache/test/autoloading_test.rb +52 -0
- data/vendor/mustache/test/fixtures/comments.mustache +1 -0
- data/vendor/mustache/test/fixtures/comments.rb +14 -0
- data/vendor/mustache/test/fixtures/complex_view.mustache +17 -0
- data/vendor/mustache/test/fixtures/complex_view.rb +34 -0
- data/vendor/mustache/test/fixtures/crazy_recursive.mustache +9 -0
- data/vendor/mustache/test/fixtures/crazy_recursive.rb +31 -0
- data/vendor/mustache/test/fixtures/delimiters.mustache +8 -0
- data/vendor/mustache/test/fixtures/delimiters.rb +23 -0
- data/vendor/mustache/test/fixtures/double_section.mustache +7 -0
- data/vendor/mustache/test/fixtures/double_section.rb +14 -0
- data/vendor/mustache/test/fixtures/escaped.mustache +1 -0
- data/vendor/mustache/test/fixtures/escaped.rb +14 -0
- data/vendor/mustache/test/fixtures/inner_partial.mustache +1 -0
- data/vendor/mustache/test/fixtures/inner_partial.txt +1 -0
- data/vendor/mustache/test/fixtures/inverted_section.mustache +7 -0
- data/vendor/mustache/test/fixtures/inverted_section.rb +14 -0
- data/vendor/mustache/test/fixtures/lambda.mustache +7 -0
- data/vendor/mustache/test/fixtures/lambda.rb +31 -0
- data/vendor/mustache/test/fixtures/namespaced.mustache +1 -0
- data/vendor/mustache/test/fixtures/namespaced.rb +25 -0
- data/vendor/mustache/test/fixtures/nested_objects.mustache +17 -0
- data/vendor/mustache/test/fixtures/nested_objects.rb +35 -0
- data/vendor/mustache/test/fixtures/node.mustache +8 -0
- data/vendor/mustache/test/fixtures/partial_with_module.mustache +3 -0
- data/vendor/mustache/test/fixtures/partial_with_module.rb +37 -0
- data/vendor/mustache/test/fixtures/passenger.conf +5 -0
- data/vendor/mustache/test/fixtures/passenger.rb +27 -0
- data/vendor/mustache/test/fixtures/recursive.mustache +4 -0
- data/vendor/mustache/test/fixtures/recursive.rb +14 -0
- data/vendor/mustache/test/fixtures/simple.mustache +5 -0
- data/vendor/mustache/test/fixtures/simple.rb +26 -0
- data/vendor/mustache/test/fixtures/template_partial.mustache +2 -0
- data/vendor/mustache/test/fixtures/template_partial.rb +18 -0
- data/vendor/mustache/test/fixtures/template_partial.txt +4 -0
- data/vendor/mustache/test/fixtures/unescaped.mustache +1 -0
- data/vendor/mustache/test/fixtures/unescaped.rb +14 -0
- data/vendor/mustache/test/fixtures/utf8.mustache +3 -0
- data/vendor/mustache/test/fixtures/utf8_partial.mustache +1 -0
- data/vendor/mustache/test/helper.rb +7 -0
- data/vendor/mustache/test/mustache_test.rb +536 -0
- data/vendor/mustache/test/parser_test.rb +54 -0
- data/vendor/mustache/test/partial_test.rb +168 -0
- metadata +167 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift 'lib'
|
2
|
+
require 'mustache/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "mustache"
|
6
|
+
s.version = Mustache::Version
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
+
s.summary =
|
9
|
+
"Mustache is a framework-agnostic way to render logic-free views."
|
10
|
+
s.homepage = "http://github.com/defunkt/mustache"
|
11
|
+
s.email = "chris@ozmm.org"
|
12
|
+
s.authors = [ "Chris Wanstrath" ]
|
13
|
+
s.files = %w( README.md Rakefile LICENSE )
|
14
|
+
s.files += Dir.glob("lib/**/*")
|
15
|
+
s.files += Dir.glob("bin/**/*")
|
16
|
+
s.files += Dir.glob("man/**/*")
|
17
|
+
s.files += Dir.glob("test/**/*")
|
18
|
+
s.executables = %w( mustache )
|
19
|
+
s.description = <<desc
|
20
|
+
Inspired by ctemplate, Mustache is a framework-agnostic way to render
|
21
|
+
logic-free views.
|
22
|
+
|
23
|
+
As ctemplates says, "It emphasizes separating logic from presentation:
|
24
|
+
it is impossible to embed application logic in this template
|
25
|
+
language.
|
26
|
+
|
27
|
+
Think of Mustache as a replacement for your views. Instead of views
|
28
|
+
consisting of ERB or HAML with random helpers and arbitrary logic,
|
29
|
+
your views are broken into two parts: a Ruby class and an HTML
|
30
|
+
template.
|
31
|
+
desc
|
32
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
module TestViews; end
|
5
|
+
|
6
|
+
class AutoloadingTest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_autoload
|
12
|
+
klass = Mustache.view_class(:Comments)
|
13
|
+
assert_equal Comments, klass
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_autoload_lowercase
|
17
|
+
klass = Mustache.view_class(:comments)
|
18
|
+
assert_equal Comments, klass
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_autoload_nil
|
22
|
+
klass = Mustache.view_class(nil)
|
23
|
+
assert_equal Mustache, klass
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_autoload_empty_string
|
27
|
+
klass = Mustache.view_class('')
|
28
|
+
assert_equal Mustache, klass
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_namespaced_autoload
|
32
|
+
Mustache.view_namespace = TestViews
|
33
|
+
klass = Mustache.view_class('Namespaced')
|
34
|
+
assert_equal TestViews::Namespaced, klass
|
35
|
+
assert_equal <<-end_render.strip, klass.render
|
36
|
+
<h1>Dragon < Tiger</h1>
|
37
|
+
end_render
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_namespaced_partial_autoload
|
41
|
+
Mustache.view_namespace = TestViews
|
42
|
+
klass = Mustache.view_class(:namespaced_with_partial)
|
43
|
+
assert_equal TestViews::NamespacedWithPartial, klass
|
44
|
+
assert_equal <<-end_render.strip, klass.render
|
45
|
+
My opinion: Again, Victory!
|
46
|
+
end_render
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_bad_constant_name
|
50
|
+
assert_equal Mustache, Mustache.view_class(404)
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>{{title}}{{! just something interesting... #or not... }}</h1>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1>{{header}}</h1>
|
2
|
+
{{#list}}
|
3
|
+
<ul>
|
4
|
+
{{#item}}
|
5
|
+
{{#current}}
|
6
|
+
<li><strong>{{name}}</strong></li>
|
7
|
+
{{/current}}
|
8
|
+
{{#link}}
|
9
|
+
<li><a href="{{url}}">{{name}}</a></li>
|
10
|
+
{{/link}}
|
11
|
+
{{/item}}
|
12
|
+
</ul>
|
13
|
+
{{/list}}
|
14
|
+
|
15
|
+
{{^list}}
|
16
|
+
<p>The list is empty.</p>
|
17
|
+
{{/list}}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
|
4
|
+
class ComplexView < Mustache
|
5
|
+
self.path = File.dirname(__FILE__)
|
6
|
+
|
7
|
+
def header
|
8
|
+
"Colors"
|
9
|
+
end
|
10
|
+
|
11
|
+
def item
|
12
|
+
items = []
|
13
|
+
items << { :name => 'red', :current => true, :url => '#Red' }
|
14
|
+
items << { :name => 'green', :current => false, :url => '#Green' }
|
15
|
+
items << { :name => 'blue', :current => false, :url => '#Blue' }
|
16
|
+
items
|
17
|
+
end
|
18
|
+
|
19
|
+
def link
|
20
|
+
not self[:current]
|
21
|
+
end
|
22
|
+
|
23
|
+
def list
|
24
|
+
not item.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
def empty
|
28
|
+
item.empty?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if $0 == __FILE__
|
33
|
+
puts ComplexView.to_html
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
|
4
|
+
class CrazyRecursive < Mustache
|
5
|
+
self.path = File.dirname(__FILE__)
|
6
|
+
|
7
|
+
def top_nodes
|
8
|
+
[{ :contents => "1",
|
9
|
+
:children =>
|
10
|
+
[{ :contents => "2",
|
11
|
+
:children =>
|
12
|
+
[{ :contents => "3",
|
13
|
+
:children => []
|
14
|
+
}]
|
15
|
+
},
|
16
|
+
{ :contents => "4",
|
17
|
+
:children =>
|
18
|
+
[{ :contents => "5",
|
19
|
+
:children =>
|
20
|
+
[{ :contents => "6",
|
21
|
+
:children => []
|
22
|
+
}]
|
23
|
+
}]
|
24
|
+
}]
|
25
|
+
}]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if $0 == __FILE__
|
30
|
+
puts CrazyRecursive.to_html
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
|
4
|
+
class Delimiters < Mustache
|
5
|
+
self.path = File.dirname(__FILE__)
|
6
|
+
|
7
|
+
def start
|
8
|
+
"It worked the first time."
|
9
|
+
end
|
10
|
+
|
11
|
+
def middle
|
12
|
+
[ { :item => "And it worked the second time." },
|
13
|
+
{ :item => "As well as the third." } ]
|
14
|
+
end
|
15
|
+
|
16
|
+
def final
|
17
|
+
"Then, surprisingly, it worked the final time."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if $0 == __FILE__
|
22
|
+
puts Delimiters.to_html
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>{{title}}</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
Again, {{title}}!
|
@@ -0,0 +1 @@
|
|
1
|
+
## Again, {{title}}! ##
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
|
4
|
+
class Lambda < Mustache
|
5
|
+
self.path = File.dirname(__FILE__)
|
6
|
+
|
7
|
+
attr_reader :calls
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
super
|
11
|
+
@calls = 0
|
12
|
+
@cached = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def rendered
|
16
|
+
lambda do |text|
|
17
|
+
return @cached if @cached
|
18
|
+
|
19
|
+
@calls += 1
|
20
|
+
@cached = render(text)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def not_rendered
|
25
|
+
lambda { |text| text }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if $0 == __FILE__
|
30
|
+
puts Lambda.to_html(Lambda.template, :name => "Jonny")
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>{{title}}</h1>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
|
4
|
+
module TestViews
|
5
|
+
class Namespaced < Mustache
|
6
|
+
self.path = File.dirname(__FILE__)
|
7
|
+
|
8
|
+
def title
|
9
|
+
"Dragon < Tiger"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class NamespacedWithPartial < Mustache
|
14
|
+
self.path = File.dirname(__FILE__)
|
15
|
+
self.template = "My opinion: {{>inner_partial}}"
|
16
|
+
|
17
|
+
def title
|
18
|
+
"Victory"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
if $0 == __FILE__
|
24
|
+
puts TestViews::Namespaced.to_html
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1>{{header}}</h1>
|
2
|
+
{{#list}}
|
3
|
+
<ul>
|
4
|
+
{{#item}}
|
5
|
+
{{#current}}
|
6
|
+
<li><strong>{{name}}</strong></li>
|
7
|
+
{{/current}}
|
8
|
+
{{#link}}
|
9
|
+
<li><a href="{{url}}">{{name}}</a></li>
|
10
|
+
{{/link}}
|
11
|
+
{{/item}}
|
12
|
+
</ul>
|
13
|
+
{{/list}}
|
14
|
+
|
15
|
+
{{^list}}
|
16
|
+
<p>The list is empty.</p>
|
17
|
+
{{/list}}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mustache'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
class NestedObjects < Mustache
|
6
|
+
self.path = File.dirname(__FILE__)
|
7
|
+
|
8
|
+
def header
|
9
|
+
"Colors"
|
10
|
+
end
|
11
|
+
|
12
|
+
def item
|
13
|
+
items = []
|
14
|
+
items << OpenStruct.new(:name => 'red', :current => true, :url => '#Red')
|
15
|
+
items << OpenStruct.new(:name => 'green', :current => false, :url => '#Green')
|
16
|
+
items << OpenStruct.new(:name => 'blue', :current => false, :url => '#Blue')
|
17
|
+
items
|
18
|
+
end
|
19
|
+
|
20
|
+
def link
|
21
|
+
not self[:current]
|
22
|
+
end
|
23
|
+
|
24
|
+
def list
|
25
|
+
not item.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
def empty
|
29
|
+
item.empty?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if $0 == __FILE__
|
34
|
+
puts NestedObjects.to_html
|
35
|
+
end
|