angry_mob_common_targets 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/LICENSE +21 -0
  2. data/README.md +38 -0
  3. data/lib/common_mob.rb +9 -0
  4. data/lib/common_mob/digest.rb +43 -0
  5. data/lib/common_mob/erb.rb +72 -0
  6. data/lib/common_mob/file.rb +55 -0
  7. data/lib/common_mob/patch.rb +51 -0
  8. data/lib/common_mob/resource_locator.rb +9 -0
  9. data/lib/common_mob/shell.rb +323 -0
  10. data/lib/common_mob/template.rb +23 -0
  11. data/lib/common_mob/version.rb +3 -0
  12. data/targets/crontab_patch.rb +37 -0
  13. data/targets/extract.rb +40 -0
  14. data/targets/fetch.rb +40 -0
  15. data/targets/files.rb +244 -0
  16. data/targets/git.rb +84 -0
  17. data/targets/group.rb +33 -0
  18. data/targets/packages.rb +94 -0
  19. data/targets/ruby.rb +13 -0
  20. data/targets/services.rb +184 -0
  21. data/targets/shell.rb +43 -0
  22. data/targets/user.rb +108 -0
  23. data/vendor/mustache/CONTRIBUTORS +9 -0
  24. data/vendor/mustache/HISTORY.md +135 -0
  25. data/vendor/mustache/LICENSE +20 -0
  26. data/vendor/mustache/README.md +405 -0
  27. data/vendor/mustache/Rakefile +103 -0
  28. data/vendor/mustache/benchmarks/complex.erb +15 -0
  29. data/vendor/mustache/benchmarks/complex.haml +12 -0
  30. data/vendor/mustache/benchmarks/helper.rb +20 -0
  31. data/vendor/mustache/benchmarks/simple.erb +5 -0
  32. data/vendor/mustache/benchmarks/speed.rb +78 -0
  33. data/vendor/mustache/bin/mustache +90 -0
  34. data/vendor/mustache/contrib/mustache-mode.el +278 -0
  35. data/vendor/mustache/contrib/mustache.vim +69 -0
  36. data/vendor/mustache/examples/hash.rb +16 -0
  37. data/vendor/mustache/examples/hash.yml +5 -0
  38. data/vendor/mustache/examples/projects.mustache +26 -0
  39. data/vendor/mustache/examples/projects.yml +28 -0
  40. data/vendor/mustache/examples/self.mustache +4 -0
  41. data/vendor/mustache/examples/self.yml +3 -0
  42. data/vendor/mustache/examples/simple.mustache +10 -0
  43. data/vendor/mustache/examples/simple.rb +24 -0
  44. data/vendor/mustache/lib/mustache.rb +358 -0
  45. data/vendor/mustache/lib/mustache/context.rb +108 -0
  46. data/vendor/mustache/lib/mustache/generator.rb +160 -0
  47. data/vendor/mustache/lib/mustache/parser.rb +230 -0
  48. data/vendor/mustache/lib/mustache/sinatra.rb +180 -0
  49. data/vendor/mustache/lib/mustache/template.rb +59 -0
  50. data/vendor/mustache/lib/mustache/version.rb +3 -0
  51. data/vendor/mustache/lib/rack/bug/panels/mustache_panel.rb +81 -0
  52. data/vendor/mustache/lib/rack/bug/panels/mustache_panel/mustache_extension.rb +27 -0
  53. data/vendor/mustache/lib/rack/bug/panels/mustache_panel/view.mustache +46 -0
  54. data/vendor/mustache/man/mustache.1 +180 -0
  55. data/vendor/mustache/man/mustache.1.html +204 -0
  56. data/vendor/mustache/man/mustache.1.ron +127 -0
  57. data/vendor/mustache/man/mustache.5 +576 -0
  58. data/vendor/mustache/man/mustache.5.html +415 -0
  59. data/vendor/mustache/man/mustache.5.ron +324 -0
  60. data/vendor/mustache/mustache.gemspec +32 -0
  61. data/vendor/mustache/test/autoloading_test.rb +52 -0
  62. data/vendor/mustache/test/fixtures/comments.mustache +1 -0
  63. data/vendor/mustache/test/fixtures/comments.rb +14 -0
  64. data/vendor/mustache/test/fixtures/complex_view.mustache +17 -0
  65. data/vendor/mustache/test/fixtures/complex_view.rb +34 -0
  66. data/vendor/mustache/test/fixtures/crazy_recursive.mustache +9 -0
  67. data/vendor/mustache/test/fixtures/crazy_recursive.rb +31 -0
  68. data/vendor/mustache/test/fixtures/delimiters.mustache +8 -0
  69. data/vendor/mustache/test/fixtures/delimiters.rb +23 -0
  70. data/vendor/mustache/test/fixtures/double_section.mustache +7 -0
  71. data/vendor/mustache/test/fixtures/double_section.rb +14 -0
  72. data/vendor/mustache/test/fixtures/escaped.mustache +1 -0
  73. data/vendor/mustache/test/fixtures/escaped.rb +14 -0
  74. data/vendor/mustache/test/fixtures/inner_partial.mustache +1 -0
  75. data/vendor/mustache/test/fixtures/inner_partial.txt +1 -0
  76. data/vendor/mustache/test/fixtures/inverted_section.mustache +7 -0
  77. data/vendor/mustache/test/fixtures/inverted_section.rb +14 -0
  78. data/vendor/mustache/test/fixtures/lambda.mustache +7 -0
  79. data/vendor/mustache/test/fixtures/lambda.rb +31 -0
  80. data/vendor/mustache/test/fixtures/namespaced.mustache +1 -0
  81. data/vendor/mustache/test/fixtures/namespaced.rb +25 -0
  82. data/vendor/mustache/test/fixtures/nested_objects.mustache +17 -0
  83. data/vendor/mustache/test/fixtures/nested_objects.rb +35 -0
  84. data/vendor/mustache/test/fixtures/node.mustache +8 -0
  85. data/vendor/mustache/test/fixtures/partial_with_module.mustache +3 -0
  86. data/vendor/mustache/test/fixtures/partial_with_module.rb +37 -0
  87. data/vendor/mustache/test/fixtures/passenger.conf +5 -0
  88. data/vendor/mustache/test/fixtures/passenger.rb +27 -0
  89. data/vendor/mustache/test/fixtures/recursive.mustache +4 -0
  90. data/vendor/mustache/test/fixtures/recursive.rb +14 -0
  91. data/vendor/mustache/test/fixtures/simple.mustache +5 -0
  92. data/vendor/mustache/test/fixtures/simple.rb +26 -0
  93. data/vendor/mustache/test/fixtures/template_partial.mustache +2 -0
  94. data/vendor/mustache/test/fixtures/template_partial.rb +18 -0
  95. data/vendor/mustache/test/fixtures/template_partial.txt +4 -0
  96. data/vendor/mustache/test/fixtures/unescaped.mustache +1 -0
  97. data/vendor/mustache/test/fixtures/unescaped.rb +14 -0
  98. data/vendor/mustache/test/fixtures/utf8.mustache +3 -0
  99. data/vendor/mustache/test/fixtures/utf8_partial.mustache +1 -0
  100. data/vendor/mustache/test/helper.rb +7 -0
  101. data/vendor/mustache/test/mustache_test.rb +536 -0
  102. data/vendor/mustache/test/parser_test.rb +54 -0
  103. data/vendor/mustache/test/partial_test.rb +168 -0
  104. 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 &lt; 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,14 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ require 'mustache'
3
+
4
+ class Comments < Mustache
5
+ self.path = File.dirname(__FILE__)
6
+
7
+ def title
8
+ "A Comedy of Errors"
9
+ end
10
+ end
11
+
12
+ if $0 == __FILE__
13
+ puts Comments.to_html
14
+ 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,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,9 @@
1
+ <html>
2
+ <body>
3
+ <ul>
4
+ {{#top_nodes}}
5
+ {{> node}}
6
+ {{/top_nodes}}
7
+ </ul>
8
+ </body>
9
+ </html>
@@ -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,8 @@
1
+ {{=<% %>=}}
2
+ * <% start %>
3
+ <%=| |=%>
4
+ |# middle |
5
+ * | item |
6
+ |/ middle |
7
+ |={{ }}=|
8
+ * {{ final }}
@@ -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,7 @@
1
+ {{#t}}
2
+ * first
3
+ {{/t}}
4
+ * {{two}}
5
+ {{#t}}
6
+ * third
7
+ {{/t}}
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ require 'mustache'
3
+
4
+ class DoubleSection < Mustache
5
+ self.path = File.dirname(__FILE__)
6
+
7
+ def t
8
+ true
9
+ end
10
+
11
+ def two
12
+ "second"
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ <h1>{{title}}</h1>
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ require 'mustache'
3
+
4
+ class Escaped < Mustache
5
+ self.path = File.dirname(__FILE__)
6
+
7
+ def title
8
+ "Bear > Shark"
9
+ end
10
+ end
11
+
12
+ if $0 == __FILE__
13
+ puts Escaped.to_html
14
+ end
@@ -0,0 +1 @@
1
+ Again, {{title}}!
@@ -0,0 +1 @@
1
+ ## Again, {{title}}! ##
@@ -0,0 +1,7 @@
1
+ {{^t}}
2
+ * first
3
+ {{/t}}
4
+ * {{two}}
5
+ {{^t}}
6
+ * third
7
+ {{/t}}
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ require 'mustache'
3
+
4
+ class InvertedSection < Mustache
5
+ self.path = File.dirname(__FILE__)
6
+
7
+ def t
8
+ false
9
+ end
10
+
11
+ def two
12
+ "second"
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ {{#rendered}}
2
+ Hi {{name}}.
3
+ {{/rendered}}
4
+
5
+ {{#not_rendered}}
6
+ Hi {{name}}.
7
+ {{/not_rendered}}
@@ -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
@@ -0,0 +1,8 @@
1
+ <li>
2
+ {{contents}}
3
+ <ul>
4
+ {{#children}}
5
+ {{> node}}
6
+ {{/children}}
7
+ </ul>
8
+ </li>