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,54 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__)
2
+ require 'helper'
3
+
4
+ class ParserTest < Test::Unit::TestCase
5
+ def test_parser
6
+ lexer = Mustache::Parser.new
7
+ tokens = lexer.compile(<<-EOF)
8
+ <h1>{{header}}</h1>
9
+ {{#items}}
10
+ {{#first}}
11
+ <li><strong>{{name}}</strong></li>
12
+ {{/first}}
13
+ {{#link}}
14
+ <li><a href="{{url}}">{{name}}</a></li>
15
+ {{/link}}
16
+ {{/items}}
17
+
18
+ {{#empty}}
19
+ <p>The list is empty.</p>
20
+ {{/empty}}
21
+ EOF
22
+
23
+ expected = [:multi,
24
+ [:static, "<h1>"],
25
+ [:mustache, :etag, "header"],
26
+ [:static, "</h1>\n"],
27
+ [:mustache,
28
+ :section,
29
+ "items",
30
+ [:multi,
31
+ [:mustache,
32
+ :section,
33
+ "first",
34
+ [:multi,
35
+ [:static, "<li><strong>"],
36
+ [:mustache, :etag, "name"],
37
+ [:static, "</strong></li>\n"]]],
38
+ [:mustache,
39
+ :section,
40
+ "link",
41
+ [:multi,
42
+ [:static, "<li><a href=\""],
43
+ [:mustache, :etag, "url"],
44
+ [:static, "\">"],
45
+ [:mustache, :etag, "name"],
46
+ [:static, "</a></li>\n"]]]]],
47
+ [:mustache,
48
+ :section,
49
+ "empty",
50
+ [:multi, [:static, "<p>The list is empty.</p>\n"]]]]
51
+
52
+ assert_equal expected, tokens
53
+ end
54
+ end
@@ -0,0 +1,168 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__)
2
+ require 'helper'
3
+
4
+ class PartialTest < Test::Unit::TestCase
5
+ def test_view_partial
6
+ assert_equal <<-end_partial.strip, PartialWithModule.render
7
+ <h1>Welcome</h1>
8
+ Hello Bob
9
+ You have just won $100000!
10
+
11
+ <h3>Fair enough, right?</h3>
12
+ end_partial
13
+ end
14
+
15
+ def test_partial_with_slashes
16
+ klass = Class.new(Mustache)
17
+ klass.template = '{{> test/fixtures/inner_partial}}'
18
+ view = klass.new
19
+ view[:title] = 'success'
20
+
21
+ assert_equal "Again, success!", view.render
22
+ end
23
+
24
+ def test_view_partial_inherits_context
25
+ klass = Class.new(TemplatePartial)
26
+ klass.template_path = File.dirname(__FILE__) + '/fixtures'
27
+ view = klass.new
28
+ view[:titles] = [{:title => :One}, {:title => :Two}]
29
+ view.template = <<-end_template
30
+ <h1>Context Test</h1>
31
+ <ul>
32
+ {{#titles}}
33
+ <li>{{>inner_partial}}</li>
34
+ {{/titles}}
35
+ </ul>
36
+ end_template
37
+ assert_equal <<-end_partial, view.render
38
+ <h1>Context Test</h1>
39
+ <ul>
40
+ <li>Again, One!</li>
41
+ <li>Again, Two!</li>
42
+ </ul>
43
+ end_partial
44
+ end
45
+
46
+ def test_view_partial_inherits_context_of_class_methods
47
+ klass = Class.new(TemplatePartial)
48
+ klass.template_path = File.dirname(__FILE__) + '/fixtures'
49
+ klass.send(:define_method, :titles) do
50
+ [{:title => :One}, {:title => :Two}]
51
+ end
52
+ view = klass.new
53
+ view.template = <<-end_template
54
+ <h1>Context Test</h1>
55
+ <ul>
56
+ {{#titles}}
57
+ <li>{{>inner_partial}}</li>
58
+ {{/titles}}
59
+ </ul>
60
+ end_template
61
+ assert_equal <<-end_partial, view.render
62
+ <h1>Context Test</h1>
63
+ <ul>
64
+ <li>Again, One!</li>
65
+ <li>Again, Two!</li>
66
+ </ul>
67
+ end_partial
68
+ end
69
+
70
+ def test_template_partial
71
+ assert_equal <<-end_partial.strip, TemplatePartial.render
72
+ <h1>Welcome</h1>
73
+ Again, Welcome!
74
+ end_partial
75
+ end
76
+
77
+ def test_template_partial_with_custom_extension
78
+ partial = Class.new(TemplatePartial)
79
+ partial.template_extension = 'txt'
80
+ partial.template_path = File.dirname(__FILE__) + '/fixtures'
81
+
82
+ assert_equal <<-end_partial.strip, partial.render.strip
83
+ Welcome
84
+ -------
85
+
86
+ ## Again, Welcome! ##
87
+ end_partial
88
+ end
89
+
90
+ def test_recursive_paritals
91
+ assert_equal <<-end_partial, Recursive.render
92
+ It works!
93
+ end_partial
94
+ end
95
+
96
+ def test_crazy_recursive_partials
97
+ assert_equal <<-end_partial.strip, CrazyRecursive.render
98
+ <html>
99
+ <body>
100
+ <ul>
101
+ <li>
102
+ 1
103
+ <ul>
104
+ <li>
105
+ 2
106
+ <ul>
107
+ <li>
108
+ 3
109
+ <ul>
110
+ </ul>
111
+ </li>
112
+ </ul>
113
+ </li>
114
+ <li>
115
+ 4
116
+ <ul>
117
+ <li>
118
+ 5
119
+ <ul>
120
+ <li>
121
+ 6
122
+ <ul>
123
+ </ul>
124
+ </li>
125
+ </ul>
126
+ </li>
127
+ </ul>
128
+ </li>
129
+ </ul>
130
+ </li>
131
+ </ul>
132
+ </body>
133
+ </html>
134
+ end_partial
135
+ end
136
+
137
+ def test_partials_use_proper_context
138
+ assert_equal "OuterThing OuterThing", OuterThing.render('{{name}} {{> p}}')
139
+
140
+ assert_equal "InnerThing InnerThing", InnerThing.render('{{name}} {{> p}}')
141
+
142
+ assert_equal "OuterThing InnerThing InnerThing",
143
+ OuterThing.render('{{name}} {{#inner}}{{name}} {{> p}}{{/inner}}')
144
+ end
145
+
146
+ def test_partials_render_returned_strings
147
+ assert_equal "ok", MiddleThing.render('{{> some_partial }}')
148
+ end
149
+ end
150
+
151
+ class InnerThing < Mustache
152
+ def partial(p) self.class end
153
+ def name; self.class end
154
+ end
155
+
156
+ class OuterThing < Mustache
157
+ def inner
158
+ InnerThing.new
159
+ end
160
+
161
+ def partial(p) self.class end
162
+ def name; self.class end
163
+ end
164
+
165
+ class MiddleThing < Mustache
166
+ def partial(name) "{{#{name}}}" end
167
+ def some_partial; "ok" end
168
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: angry_mob_common_targets
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Lachie Cox
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-07 00:00:00 +10:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: AngryMob Common Targets are a set of essential, reusable targets to get you started with AngryMob.
22
+ email:
23
+ - lachie.cox@plus2.com.au
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/common_mob/digest.rb
32
+ - lib/common_mob/erb.rb
33
+ - lib/common_mob/file.rb
34
+ - lib/common_mob/patch.rb
35
+ - lib/common_mob/resource_locator.rb
36
+ - lib/common_mob/shell.rb
37
+ - lib/common_mob/template.rb
38
+ - lib/common_mob/version.rb
39
+ - lib/common_mob.rb
40
+ - targets/crontab_patch.rb
41
+ - targets/extract.rb
42
+ - targets/fetch.rb
43
+ - targets/files.rb
44
+ - targets/git.rb
45
+ - targets/group.rb
46
+ - targets/packages.rb
47
+ - targets/ruby.rb
48
+ - targets/services.rb
49
+ - targets/shell.rb
50
+ - targets/user.rb
51
+ - vendor/mustache/benchmarks/complex.erb
52
+ - vendor/mustache/benchmarks/complex.haml
53
+ - vendor/mustache/benchmarks/helper.rb
54
+ - vendor/mustache/benchmarks/simple.erb
55
+ - vendor/mustache/benchmarks/speed.rb
56
+ - vendor/mustache/bin/mustache
57
+ - vendor/mustache/contrib/mustache-mode.el
58
+ - vendor/mustache/contrib/mustache.vim
59
+ - vendor/mustache/CONTRIBUTORS
60
+ - vendor/mustache/examples/hash.rb
61
+ - vendor/mustache/examples/hash.yml
62
+ - vendor/mustache/examples/projects.mustache
63
+ - vendor/mustache/examples/projects.yml
64
+ - vendor/mustache/examples/self.mustache
65
+ - vendor/mustache/examples/self.yml
66
+ - vendor/mustache/examples/simple.mustache
67
+ - vendor/mustache/examples/simple.rb
68
+ - vendor/mustache/HISTORY.md
69
+ - vendor/mustache/lib/mustache/context.rb
70
+ - vendor/mustache/lib/mustache/generator.rb
71
+ - vendor/mustache/lib/mustache/parser.rb
72
+ - vendor/mustache/lib/mustache/sinatra.rb
73
+ - vendor/mustache/lib/mustache/template.rb
74
+ - vendor/mustache/lib/mustache/version.rb
75
+ - vendor/mustache/lib/mustache.rb
76
+ - vendor/mustache/lib/rack/bug/panels/mustache_panel/mustache_extension.rb
77
+ - vendor/mustache/lib/rack/bug/panels/mustache_panel/view.mustache
78
+ - vendor/mustache/lib/rack/bug/panels/mustache_panel.rb
79
+ - vendor/mustache/LICENSE
80
+ - vendor/mustache/man/mustache.1
81
+ - vendor/mustache/man/mustache.1.html
82
+ - vendor/mustache/man/mustache.1.ron
83
+ - vendor/mustache/man/mustache.5
84
+ - vendor/mustache/man/mustache.5.html
85
+ - vendor/mustache/man/mustache.5.ron
86
+ - vendor/mustache/mustache.gemspec
87
+ - vendor/mustache/Rakefile
88
+ - vendor/mustache/README.md
89
+ - vendor/mustache/test/autoloading_test.rb
90
+ - vendor/mustache/test/fixtures/comments.mustache
91
+ - vendor/mustache/test/fixtures/comments.rb
92
+ - vendor/mustache/test/fixtures/complex_view.mustache
93
+ - vendor/mustache/test/fixtures/complex_view.rb
94
+ - vendor/mustache/test/fixtures/crazy_recursive.mustache
95
+ - vendor/mustache/test/fixtures/crazy_recursive.rb
96
+ - vendor/mustache/test/fixtures/delimiters.mustache
97
+ - vendor/mustache/test/fixtures/delimiters.rb
98
+ - vendor/mustache/test/fixtures/double_section.mustache
99
+ - vendor/mustache/test/fixtures/double_section.rb
100
+ - vendor/mustache/test/fixtures/escaped.mustache
101
+ - vendor/mustache/test/fixtures/escaped.rb
102
+ - vendor/mustache/test/fixtures/inner_partial.mustache
103
+ - vendor/mustache/test/fixtures/inner_partial.txt
104
+ - vendor/mustache/test/fixtures/inverted_section.mustache
105
+ - vendor/mustache/test/fixtures/inverted_section.rb
106
+ - vendor/mustache/test/fixtures/lambda.mustache
107
+ - vendor/mustache/test/fixtures/lambda.rb
108
+ - vendor/mustache/test/fixtures/namespaced.mustache
109
+ - vendor/mustache/test/fixtures/namespaced.rb
110
+ - vendor/mustache/test/fixtures/nested_objects.mustache
111
+ - vendor/mustache/test/fixtures/nested_objects.rb
112
+ - vendor/mustache/test/fixtures/node.mustache
113
+ - vendor/mustache/test/fixtures/partial_with_module.mustache
114
+ - vendor/mustache/test/fixtures/partial_with_module.rb
115
+ - vendor/mustache/test/fixtures/passenger.conf
116
+ - vendor/mustache/test/fixtures/passenger.rb
117
+ - vendor/mustache/test/fixtures/recursive.mustache
118
+ - vendor/mustache/test/fixtures/recursive.rb
119
+ - vendor/mustache/test/fixtures/simple.mustache
120
+ - vendor/mustache/test/fixtures/simple.rb
121
+ - vendor/mustache/test/fixtures/template_partial.mustache
122
+ - vendor/mustache/test/fixtures/template_partial.rb
123
+ - vendor/mustache/test/fixtures/template_partial.txt
124
+ - vendor/mustache/test/fixtures/unescaped.mustache
125
+ - vendor/mustache/test/fixtures/unescaped.rb
126
+ - vendor/mustache/test/fixtures/utf8.mustache
127
+ - vendor/mustache/test/fixtures/utf8_partial.mustache
128
+ - vendor/mustache/test/helper.rb
129
+ - vendor/mustache/test/mustache_test.rb
130
+ - vendor/mustache/test/parser_test.rb
131
+ - vendor/mustache/test/partial_test.rb
132
+ - LICENSE
133
+ - README.md
134
+ has_rdoc: true
135
+ homepage: http://github.com/plus2/common_mob
136
+ licenses: []
137
+
138
+ post_install_message:
139
+ rdoc_options: []
140
+
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ segments:
148
+ - 0
149
+ version: "0"
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ segments:
155
+ - 1
156
+ - 3
157
+ - 6
158
+ version: 1.3.6
159
+ requirements: []
160
+
161
+ rubyforge_project: angry_mob_common_targets
162
+ rubygems_version: 1.3.6
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Common targets to use with AngryMob
166
+ test_files: []
167
+