tagz 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/a.rb +11 -0
  2. data/gemspec.rb +27 -0
  3. data/gen_readme.rb +32 -0
  4. data/install.rb +210 -0
  5. data/lib/tagz.rb +376 -0
  6. data/lib/tagz/rails.rb +198 -0
  7. data/rails/README +182 -0
  8. data/rails/Rakefile +10 -0
  9. data/rails/app/controllers/application.rb +7 -0
  10. data/rails/app/controllers/tagz_controller.rb +51 -0
  11. data/rails/app/helpers/application_helper.rb +3 -0
  12. data/rails/app/helpers/tagz_helper.rb +2 -0
  13. data/rails/app/views/layouts/layout.rb +16 -0
  14. data/rails/app/views/tagz/b.rb +19 -0
  15. data/rails/app/views/tagz/c.rb +9 -0
  16. data/rails/app/views/tagz/d.rhtml +17 -0
  17. data/rails/app/views/tagz/e.rb +3 -0
  18. data/rails/config/boot.rb +45 -0
  19. data/rails/config/database.yml +36 -0
  20. data/rails/config/environment.rb +65 -0
  21. data/rails/config/environments/development.rb +21 -0
  22. data/rails/config/environments/production.rb +18 -0
  23. data/rails/config/environments/test.rb +19 -0
  24. data/rails/config/lighttpd.conf +54 -0
  25. data/rails/config/routes.rb +23 -0
  26. data/rails/doc/README_FOR_APP +2 -0
  27. data/rails/log/development.log +6713 -0
  28. data/rails/log/fastcgi.crash.log +103 -0
  29. data/rails/log/lighttpd.access.log +171 -0
  30. data/rails/log/lighttpd.error.log +116 -0
  31. data/rails/log/production.log +0 -0
  32. data/rails/log/server.log +0 -0
  33. data/rails/log/test.log +0 -0
  34. data/rails/public/404.html +30 -0
  35. data/rails/public/500.html +30 -0
  36. data/rails/public/dispatch.cgi +10 -0
  37. data/rails/public/dispatch.fcgi +24 -0
  38. data/rails/public/dispatch.rb +10 -0
  39. data/rails/public/favicon.ico +0 -0
  40. data/rails/public/images/rails.png +0 -0
  41. data/rails/public/index.html +277 -0
  42. data/rails/public/javascripts/application.js +2 -0
  43. data/rails/public/javascripts/controls.js +833 -0
  44. data/rails/public/javascripts/dragdrop.js +942 -0
  45. data/rails/public/javascripts/effects.js +1088 -0
  46. data/rails/public/javascripts/prototype.js +2515 -0
  47. data/rails/public/robots.txt +1 -0
  48. data/rails/script/about +3 -0
  49. data/rails/script/breakpointer +3 -0
  50. data/rails/script/console +3 -0
  51. data/rails/script/destroy +3 -0
  52. data/rails/script/generate +3 -0
  53. data/rails/script/performance/benchmarker +3 -0
  54. data/rails/script/performance/profiler +3 -0
  55. data/rails/script/plugin +3 -0
  56. data/rails/script/process/inspector +3 -0
  57. data/rails/script/process/reaper +3 -0
  58. data/rails/script/process/spawner +3 -0
  59. data/rails/script/runner +3 -0
  60. data/rails/script/server +4 -0
  61. data/rails/test/functional/tagz_controller_test.rb +18 -0
  62. data/rails/test/test_helper.rb +28 -0
  63. data/rails/tmp/cache/index.html-gzip-1958902-7552-1181801882 +0 -0
  64. data/rails/tmp/cache/javascripts/effects.js-gzip-1958907-38200-1181801882 +0 -0
  65. data/rails/tmp/cache/javascripts/prototype.js-gzip-1958906-71260-1181801882 +0 -0
  66. data/rails/tmp/sessions/ruby_sess.365e696810aa7418 +0 -0
  67. data/rails/tmp/sessions/ruby_sess.3ab0cb2f589d3855 +0 -0
  68. data/rails/tmp/sessions/ruby_sess.c812e68d96a6e99f +0 -0
  69. data/rails/tmp/sessions/ruby_sess.e0a954440a7e27d7 +0 -0
  70. data/sample/a.rb +9 -0
  71. data/test/tagz.rb +436 -0
  72. data/tidy +3 -0
  73. metadata +161 -0
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/breakpointer'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ ARGV.unshift 'lighttpd' if ARGV.empty?
3
+ require File.dirname(__FILE__) + '/../config/boot'
4
+ require 'commands/server'
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'tagz_controller'
3
+
4
+ # Re-raise errors caught by the controller.
5
+ class TagzController; def rescue_action(e) raise e end; end
6
+
7
+ class TagzControllerTest < Test::Unit::TestCase
8
+ def setup
9
+ @controller = TagzController.new
10
+ @request = ActionController::TestRequest.new
11
+ @response = ActionController::TestResponse.new
12
+ end
13
+
14
+ # Replace this with your real tests.
15
+ def test_truth
16
+ assert true
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class Test::Unit::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ self.use_transactional_fixtures = true
19
+
20
+ # Instantiated fixtures are slow, but give you @david where otherwise you
21
+ # would need people(:david). If you don't want to migrate your existing
22
+ # test cases which use the @david style and don't mind the speed hit (each
23
+ # instantiated fixtures translates to a database query per test method),
24
+ # then set this back to true.
25
+ self.use_instantiated_fixtures = false
26
+
27
+ # Add more helper methods to be used by all tests here...
28
+ end
@@ -0,0 +1,9 @@
1
+ require 'tagz'
2
+ #
3
+ # the simplest way to use tagz is to include the module and genrate something
4
+ # tagged
5
+ #
6
+
7
+ include Tagz
8
+
9
+ puts html_{ body_{ 'content' } }
@@ -0,0 +1,436 @@
1
+ require 'test/unit'
2
+ STDOUT.sync = true
3
+ $:.unshift 'lib'
4
+ $:.unshift '../lib'
5
+ $:.unshift '.'
6
+ require 'tagz'
7
+
8
+ class TagzTest < Test::Unit::TestCase
9
+ include Tagz
10
+ def test_000 #--{{{
11
+ expected = '<foo ></foo>'
12
+ actual = (
13
+ foo_
14
+ _foo
15
+ )
16
+ assert_equal expected, actual
17
+ end #--}}}
18
+ def test_010 #--{{{
19
+ expected = '<foo ><bar ></bar></foo>'
20
+ actual = (
21
+ foo_
22
+ bar_
23
+ _bar
24
+ _foo
25
+ )
26
+ assert_equal expected, actual
27
+ end #--}}}
28
+ def test_020 #--{{{
29
+ expected = '<foo ><bar /></foo>'
30
+ actual = (
31
+ foo_
32
+ bar_{}
33
+ _foo
34
+ )
35
+ assert_equal expected, actual
36
+ end #--}}}
37
+ def test_030 #--{{{
38
+ expected = '<foo ><bar /></foo>'
39
+ actual = (
40
+ foo_{
41
+ bar_{}
42
+ }
43
+ )
44
+ assert_equal expected, actual
45
+ end #--}}}
46
+ def test_040 #--{{{
47
+ expected = '<foo >bar</foo>'
48
+ actual = (
49
+ foo_{ 'bar' }
50
+ )
51
+ assert_equal expected, actual
52
+ end #--}}}
53
+ def test_050 #--{{{
54
+ expected = '<foo ><bar >foobar</bar></foo>'
55
+ actual = (
56
+ foo_{
57
+ bar_{ 'foobar' }
58
+ }
59
+ )
60
+ assert_equal expected, actual
61
+ end #--}}}
62
+ def test_060 #--{{{
63
+ expected = '<foo key="value" ><bar a="b" >foobar</bar></foo>'
64
+ actual = (
65
+ foo_('key' => 'value'){
66
+ bar_(:a => :b){ 'foobar' }
67
+ }
68
+ )
69
+ assert_equal expected, actual
70
+ end #--}}}
71
+ def test_070 #--{{{
72
+ expected = '<foo /><bar />'
73
+ actual = (
74
+ foo_{} + bar_{}
75
+ )
76
+ assert_equal expected, actual
77
+ end #--}}}
78
+ def test_080 #--{{{
79
+ assert_raises(Tagz::NotOpen) do
80
+ foo_{ _bar }
81
+ end
82
+ end #--}}}
83
+ def test_090 #--{{{
84
+ assert_raises(Tagz::NotOpen) do
85
+ _foo
86
+ end
87
+ end #--}}}
88
+ def test_100 #--{{{
89
+ assert_nothing_raised do
90
+ foo_
91
+ _foo
92
+ end
93
+ end #--}}}
94
+ def test_110 #--{{{
95
+ expected = '<foo ><bar >foobar</bar></foo>'
96
+ actual = (
97
+ foo_{
98
+ bar_{ 'foobar' }
99
+ 'this content is ignored'
100
+ }
101
+ )
102
+ assert_equal expected, actual
103
+ end #--}}}
104
+ def test_120 #--{{{
105
+ expected = '<foo ><bar >foobar</bar><baz >barfoo</baz></foo>'
106
+ actual = (
107
+ foo_{
108
+ bar_{ 'foobar' }
109
+ baz_{ 'barfoo' }
110
+ }
111
+ )
112
+ assert_equal expected, actual
113
+ end #--}}}
114
+ def test_121 #--{{{
115
+ expected = '<foo ><bar >foobar</bar><baz >barfoo</baz></foo>'
116
+ actual = (
117
+ foo_{
118
+ bar_{ 'foobar' }
119
+ baz_{ 'barfoo' }
120
+ }
121
+ )
122
+ assert_equal expected, actual
123
+ end #--}}}
124
+ def test_130 #--{{{
125
+ expected = '<foo >a<bar >foobar</bar>b<baz >barfoo</baz></foo>'
126
+ actual = (
127
+ foo_{ |tag|
128
+ tag << 'a'
129
+ bar_{ 'foobar' }
130
+ tag << 'b'
131
+ baz_{ 'barfoo' }
132
+ }
133
+ )
134
+ assert_equal expected, actual
135
+ end #--}}}
136
+ def test_140 #--{{{
137
+ expected = '<foo ><bar >baz</bar></foo>'
138
+ actual = (
139
+ foo_{
140
+ bar_ << 'baz'
141
+ _bar
142
+ }
143
+ )
144
+ assert_equal expected, actual
145
+ end #--}}}
146
+ def test_150 #--{{{
147
+ expected = '<foo ><bar >bar<baz >baz</baz></bar></foo>'
148
+ actual = (
149
+ foo_{
150
+ bar_ << 'bar'
151
+ tag = baz_
152
+ tag << 'baz'
153
+ _baz
154
+ _bar
155
+ }
156
+ )
157
+ assert_equal expected, actual
158
+ end #--}}}
159
+ def test_160 #--{{{
160
+ expected = '<foo >a<bar >b</bar></foo>'
161
+ actual = (
162
+ foo_{ |foo|
163
+ foo << 'a'
164
+ bar_{ |bar|
165
+ bar << 'b'
166
+ }
167
+ }
168
+ )
169
+ assert_equal expected, actual
170
+ end #--}}}
171
+ def test_170 #--{{{
172
+ expected = '<html ><body ><ul ><li >a</li><li >b</li><li >c</li></ul></body></html>'
173
+ @list = %w( a b c )
174
+ actual = (
175
+ html_{
176
+ body_{
177
+ ul_{
178
+ @list.each{|elem| li_{ elem } }
179
+ }
180
+ }
181
+ }
182
+ )
183
+ assert_equal expected, actual
184
+ end #--}}}
185
+ def test_180 #--{{{
186
+ expected = '<html ><body >42</body></html>'
187
+ actual = (
188
+ html_{
189
+ b = body_
190
+ b << 42
191
+ _body
192
+ }
193
+ )
194
+ assert_equal expected, actual
195
+ end #--}}}
196
+ def test_190 #--{{{
197
+ expected = '<html ><body >42</body></html>'
198
+ actual = (
199
+ html_{
200
+ body_
201
+ tagz << 42 ### tagz is always the current tag!
202
+ _body
203
+ }
204
+ )
205
+ assert_equal expected, actual
206
+ end #--}}}
207
+ def test_200 #--{{{
208
+ expected = '<html ><body >42</body></html>'
209
+ actual = (
210
+ html_{
211
+ body_{
212
+ tagz << 42 ### tagz is always the current tag!
213
+ }
214
+ }
215
+ )
216
+ assert_equal expected, actual
217
+ end #--}}}
218
+ def test_210 #--{{{
219
+ expected = '<html ><body >42</body></html>'
220
+ actual = (
221
+ html_{
222
+ body_{ |body|
223
+ body << 42
224
+ }
225
+ }
226
+ )
227
+ assert_equal expected, actual
228
+ end #--}}}
229
+ def test_220 #--{{{
230
+ expected = '<html ><body >42</body></html>'
231
+ actual = (
232
+ 'html'.tag do
233
+ 'body'.tag do
234
+ 42
235
+ end
236
+ end
237
+ )
238
+ assert_equal expected, actual
239
+ end #--}}}
240
+ def test_230 #--{{{
241
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
242
+ actual = (
243
+ html_{
244
+ body_{
245
+ div_('k="v"'){ "content" }
246
+ }
247
+ }
248
+ )
249
+ assert_equal expected, actual
250
+ end #--}}}
251
+ def test_240 #--{{{
252
+ expected = '<html ><body ><div k="v" >content</body></html>'
253
+ actual = (
254
+ html_{
255
+ body_{
256
+ div_ "content", :k => :v
257
+ }
258
+ }
259
+ )
260
+ assert_equal expected, actual
261
+ end #--}}}
262
+ def test_241 #--{{{
263
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
264
+ actual = (
265
+ html_{
266
+ body_{
267
+ div_ "content", :k => :v
268
+ _div
269
+ }
270
+ }
271
+ )
272
+ assert_equal expected, actual
273
+ end #--}}}
274
+ def test_250 #--{{{
275
+ expected = '<html ><body ><div k="v" >content and more content</div></body></html>'
276
+ actual = (
277
+ html_{
278
+ body_{
279
+ div_('k="v"', "content"){ ' and more content' }
280
+ }
281
+ }
282
+ )
283
+ assert_equal expected, actual
284
+ end #--}}}
285
+ def test_260 #--{{{
286
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
287
+ actual = (
288
+ html_{
289
+ body_{
290
+ div_ :k => :v
291
+ tagz << "content"
292
+ _div
293
+ }
294
+ }
295
+ )
296
+ assert_equal expected, actual
297
+ end #--}}}
298
+ def test_270 #--{{{
299
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
300
+ actual = (
301
+ html_{
302
+ body_{
303
+ div_ :k => :v
304
+ _ "content"
305
+ _div
306
+ }
307
+ }
308
+ )
309
+ assert_equal expected, actual
310
+ end #--}}}
311
+ def test_280 #--{{{
312
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
313
+ actual = (
314
+ html_{
315
+ body_{
316
+ div_ :k => :v
317
+ __{ "content" }
318
+ _div
319
+ }
320
+ }
321
+ )
322
+ assert_equal expected, actual
323
+ end #--}}}
324
+ def test_280 #--{{{
325
+ expected = 'content'
326
+ actual = (
327
+ __{ "content" }
328
+ )
329
+ assert_equal expected, actual
330
+ end #--}}}
331
+ def test_280 #--{{{
332
+ expected = 'content'
333
+ actual = (
334
+ __ "content"
335
+ )
336
+ assert_equal expected, actual
337
+ end #--}}}
338
+ def test_290 #--{{{
339
+ expected = 'foobar'
340
+ actual = (
341
+ _{
342
+ __ 'foo'
343
+ __ 'bar'
344
+ }
345
+ )
346
+ assert_equal expected, actual
347
+ end #--}}}
348
+ def test_300 #--{{{
349
+ expected = 'foobar'
350
+ actual = (
351
+ _{ __ 'foo', 'bar' }
352
+ )
353
+ assert_equal expected, actual
354
+ end #--}}}
355
+ def test_310 #--{{{
356
+ expected = '<html ><body ><div k="v" >foobar</div></body></html>'
357
+ actual = (
358
+ html_{
359
+ body_{
360
+ div_! "foo", "bar", :k => :v
361
+ }
362
+ }
363
+ )
364
+ assert_equal expected, actual
365
+ end #--}}}
366
+ def test_320 #--{{{
367
+ expected = '<html ><body ><a href="a" >a</a><span >|</span><a href="b" >b</a><span >|</span><a href="c" >c</a></body></html>'
368
+ links = %w( a b c )
369
+ actual = (
370
+ html_{
371
+ body_{
372
+ links.map{|link| e(:a, :href => link){ link }}.join e(:span){ '|' }
373
+ }
374
+ }
375
+ )
376
+ assert_equal expected, actual
377
+ end #--}}}
378
+ def test_330 #--{{{
379
+ expected = '<a ><b ><c >'
380
+ actual = (
381
+ tagz {
382
+ a_
383
+ b_
384
+ c_
385
+ }
386
+ )
387
+ assert_equal expected, actual
388
+ end #--}}}
389
+ def test_340 #--{{{
390
+ expected = '<a ><b ><c ></a>'
391
+ actual = (
392
+ a_ {
393
+ b_
394
+ c_
395
+ }
396
+ )
397
+ assert_equal expected, actual
398
+ end #--}}}
399
+ def test_350 #--{{{
400
+ expected = '<a ><b ><c >content</a>'
401
+ actual = (
402
+ a_ {
403
+ b_
404
+ c_ "content"
405
+ }
406
+ )
407
+ assert_equal expected, actual
408
+ end #--}}}
409
+ def test_360 #--{{{
410
+ expected = '<a ><b >content<c ><d >more content</a>'
411
+ actual = (
412
+ a_ {
413
+ b_ "content"
414
+ c_
415
+ d_ "more content"
416
+ }
417
+ )
418
+ assert_equal expected, actual
419
+ end #--}}}
420
+ def test_370 #--{{{
421
+ expected = 'ab'
422
+ actual = (
423
+ re = 'a'
424
+ re << tagz{'b'}
425
+ re
426
+ )
427
+ assert_equal expected, actual
428
+ end #--}}}
429
+ def test_380 #--{{{
430
+ expected = 'ab'
431
+ actual = (
432
+ tagz{ 'a' } + tagz{ 'b' }
433
+ )
434
+ assert_equal expected, actual
435
+ end #--}}}
436
+ end