lazibi 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/.autotest +44 -2
  2. data/History.txt +10 -1
  3. data/Manifest.txt +114 -91
  4. data/README.txt +4 -125
  5. data/Rakefile +20 -10
  6. data/config/lazibi_config_template.rb +15 -0
  7. data/lib/core/beautify_engine.rb +10 -0
  8. data/lib/core/default_engine.rb +11 -0
  9. data/lib/core/engine_base.rb +74 -0
  10. data/lib/filter/beautify_filter.rb +148 -0
  11. data/lib/filter/filter_base.rb +19 -0
  12. data/lib/filter/optional_do_filter.rb +66 -0
  13. data/lib/filter/optional_end_filter.rb +124 -0
  14. data/lib/filter/syntax_guard_filter.rb +77 -0
  15. data/lib/helper/application_helper.rb +9 -0
  16. data/lib/helper/beautify_filter_helper.rb +52 -0
  17. data/lib/helper/filter_helper.rb +133 -0
  18. data/lib/helper/task_helper.rb +53 -45
  19. data/lib/lazibi.rb +1 -4
  20. data/lib/lazibi/version.rb +1 -1
  21. data/lib/task.rb +41 -32
  22. data/spec/core/beautify_engine_spec.rb +12 -0
  23. data/spec/core/default_engine_spec.rb +28 -0
  24. data/spec/core/engine_base_spec.rb +23 -0
  25. data/spec/filter/beautify_filter_spec.rb +64 -0
  26. data/spec/filter/filter_spec_helper.rb +9 -0
  27. data/spec/filter/optional_do_filter_spec.rb +56 -0
  28. data/spec/filter/optional_end_filter_spec.rb +84 -0
  29. data/spec/filter/syntax_guard_filter_spec.rb +35 -0
  30. data/spec/fixtures/beautify/metas/square_brackets.txt +6 -0
  31. data/{test/fixtures/functional/ruby → spec/fixtures/beautify/rbs}/square_brackets.txt +1 -1
  32. data/{test → spec}/fixtures/clean/comment_break.txt +0 -0
  33. data/{test → spec}/fixtures/clean/complex_string.txt +0 -0
  34. data/{test → spec}/fixtures/clean/end_concat.txt +0 -0
  35. data/{test → spec}/fixtures/clean/long_indent.txt +0 -0
  36. data/{test → spec}/fixtures/clean/mixed_re.txt +0 -0
  37. data/{test → spec}/fixtures/clean/only_if.txt +0 -0
  38. data/{test → spec}/fixtures/clean/re.txt +0 -0
  39. data/{test → spec}/fixtures/clean/semi_colon_after_end.txt +0 -0
  40. data/{test → spec}/fixtures/clean/sep_line.txt +0 -0
  41. data/{test → spec}/fixtures/clean/unless_problem.txt +0 -0
  42. data/{test → spec}/fixtures/meta/basic_class.txt +0 -0
  43. data/{test → spec}/fixtures/meta/case.txt +0 -0
  44. data/{test → spec}/fixtures/meta/class_with_def.txt +0 -0
  45. data/{test → spec}/fixtures/meta/comment.txt +0 -0
  46. data/{test → spec}/fixtures/meta/comment_after_end.txt +0 -0
  47. data/{test → spec}/fixtures/meta/eval_code.txt +0 -0
  48. data/{test → spec}/fixtures/meta/here_doc.txt +0 -0
  49. data/{test → spec}/fixtures/meta/inline_do_end.txt +0 -0
  50. data/{test → spec}/fixtures/meta/inline_end.txt +0 -0
  51. data/{test → spec}/fixtures/meta/loop.txt +0 -0
  52. data/{test → spec}/fixtures/meta/middle.txt +0 -0
  53. data/{test → spec}/fixtures/meta/multi_blocks.txt +0 -0
  54. data/{test → spec}/fixtures/meta/nested_comment.txt +0 -0
  55. data/{test → spec}/fixtures/meta/optional_do.txt +0 -0
  56. data/{test → spec}/fixtures/meta/optional_do_with_nasty_chars.txt +0 -0
  57. data/{test → spec}/fixtures/meta/partial_method.txt +0 -0
  58. data/{test → spec}/fixtures/meta/single_method.txt +0 -0
  59. data/{test → spec}/fixtures/meta/two_methods.txt +0 -0
  60. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/brackets_block.txt +0 -0
  61. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/classical.txt +0 -0
  62. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/describe.txt +0 -0
  63. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/do_block.txt +0 -0
  64. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/lambda.txt +0 -0
  65. data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/square_brackets.txt +2 -2
  66. data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/brackets_block.txt +0 -0
  67. data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/classical.txt +0 -0
  68. data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/describe.txt +0 -0
  69. data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/do_block.txt +0 -0
  70. data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/lambda.txt +0 -0
  71. data/spec/fixtures/optional_do/rbs/square_brackets.txt +6 -0
  72. data/{test → spec}/fixtures/real/basic_class.txt +0 -0
  73. data/{test → spec}/fixtures/real/case.txt +0 -0
  74. data/{test → spec}/fixtures/real/class_with_def.txt +0 -0
  75. data/{test → spec}/fixtures/real/comment.txt +0 -0
  76. data/{test → spec}/fixtures/real/comment_after_end.txt +0 -0
  77. data/{test → spec}/fixtures/real/comment_after_end_expected.txt +0 -0
  78. data/{test → spec}/fixtures/real/comment_break.txt +0 -0
  79. data/{test → spec}/fixtures/real/complex_string.txt +0 -0
  80. data/{test → spec}/fixtures/real/end_concat.txt +0 -0
  81. data/{test → spec}/fixtures/real/eval_code.txt +0 -0
  82. data/{test → spec}/fixtures/real/general_eval.txt +0 -0
  83. data/{test → spec}/fixtures/real/here_doc.txt +0 -0
  84. data/{test → spec}/fixtures/real/inline_do_end.txt +0 -0
  85. data/{test → spec}/fixtures/real/inline_end.txt +0 -0
  86. data/{test → spec}/fixtures/real/javascript.txt +0 -0
  87. data/{test → spec}/fixtures/real/long_indent.txt +0 -0
  88. data/{test → spec}/fixtures/real/loop.txt +0 -0
  89. data/{test → spec}/fixtures/real/middle.txt +0 -0
  90. data/{test → spec}/fixtures/real/mixed_re.txt +0 -0
  91. data/{test → spec}/fixtures/real/multi_blocks.txt +0 -0
  92. data/{test → spec}/fixtures/real/nested_comment.txt +0 -0
  93. data/{test → spec}/fixtures/real/only_if.txt +0 -0
  94. data/{test → spec}/fixtures/real/optional_do.txt +0 -0
  95. data/{test → spec}/fixtures/real/optional_do_with_nasty_chars.txt +0 -0
  96. data/{test → spec}/fixtures/real/partial_method.txt +0 -0
  97. data/{test → spec}/fixtures/real/re.txt +0 -0
  98. data/{test → spec}/fixtures/real/semi_colon_after_end.txt +0 -0
  99. data/{test → spec}/fixtures/real/sep_line.txt +0 -0
  100. data/{test → spec}/fixtures/real/single_method.txt +0 -0
  101. data/{test → spec}/fixtures/real/strange_syntax_1.txt +0 -0
  102. data/{test → spec}/fixtures/real/two_methods.txt +0 -0
  103. data/{test → spec}/fixtures/real/unless_problem.txt +0 -0
  104. data/spec/helper/filter_helper_spec.rb +35 -0
  105. data/spec/helper/task_helper_spec.rb +21 -0
  106. data/spec/lazibi_spec.rb +22 -0
  107. data/spec/spec_helper.rb +16 -0
  108. data/webgen/src/code/examples/migration.py.rb +10 -0
  109. data/webgen/src/code/examples/rspec.py.rb +7 -0
  110. data/webgen/src/css/blossom_base.css +172 -0
  111. data/webgen/src/css/blossom_v05.css +48 -0
  112. data/webgen/src/css/code.css +32 -0
  113. data/webgen/src/css/hack.css +13 -0
  114. data/webgen/src/css/print.css +178 -0
  115. data/webgen/src/default.template +90 -0
  116. data/webgen/src/development.page +19 -0
  117. data/webgen/src/documentation.page +44 -0
  118. data/webgen/src/faq.page +42 -0
  119. data/webgen/src/images/cover_landscape.jpg +0 -0
  120. data/webgen/src/images/example_picture03.jpg +0 -0
  121. data/webgen/src/images/example_picture04.jpg +0 -0
  122. data/webgen/src/index.page +45 -0
  123. data/webgen/src/installation.page +17 -0
  124. metadata +214 -175
  125. data/coverage/index.html +0 -476
  126. data/coverage/lib-helper-parser_helper_rb.html +0 -718
  127. data/coverage/lib-helper-task_helper_rb.html +0 -684
  128. data/coverage/lib-lazibi-version_rb.html +0 -640
  129. data/coverage/lib-lazibi_rb.html +0 -664
  130. data/coverage/lib-parser_rb.html +0 -787
  131. data/coverage/lib-task_rb.html +0 -751
  132. data/lib/helper/app_helper.rb +0 -0
  133. data/lib/helper/parser_helper.rb +0 -92
  134. data/lib/parser.rb +0 -194
  135. data/lib/vendor/beautifier.rb +0 -278
  136. data/test/test_functional.rb +0 -75
  137. data/test/test_helper.rb +0 -7
  138. data/test/test_unit.rb +0 -151
  139. data/website/index.html +0 -234
  140. data/website/index.txt +0 -135
  141. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  142. data/website/stylesheets/screen.css +0 -140
  143. data/website/template.rhtml +0 -48
@@ -0,0 +1,13 @@
1
+ .no{
2
+ display: none;
3
+ }
4
+
5
+ .CodeRay{
6
+ padding: 10px;
7
+ }
8
+
9
+ pre{
10
+ font-family: 'Monaco', 'Courier New', 'Terminal', monospace;
11
+ font-size: 80%;
12
+ line-height: 140%
13
+ }
@@ -0,0 +1,178 @@
1
+ /*
2
+ ** blue:blossom - print style
3
+ **
4
+ ** This file contains the print stylesheet.
5
+ **
6
+ ** April 14, 2007 - (version 1.0)
7
+ **
8
+ ** This is a part of the open source template
9
+ ** "blue:blossom" made by Jonas John (www.jonasjohn.de)
10
+ */
11
+
12
+ /*
13
+ General settings
14
+ ----------------
15
+ All margins, paddings and borders are set here
16
+ */
17
+
18
+ /* reset all margins, paddings and borders for specific elements */
19
+ body,div,p,img,form,h1,h2,h3,h4,h5,h6,ul,li {
20
+ margin: 0;
21
+ padding: 0;
22
+ border: 0;
23
+ }
24
+
25
+ body {
26
+ margin: 0.6em 0em 2em 0em;
27
+ text-align: center;
28
+ }
29
+
30
+
31
+ /* basics */
32
+ .centered { margin: 0 auto; text-align: left; }
33
+ .clear { clear: both; }
34
+ .image { padding: 3px; }
35
+
36
+ #inner_header { padding-bottom: 0.5em; }
37
+
38
+ /* header */
39
+ #inner_header h1 { padding: 0em; }
40
+
41
+ /* hide navigation */
42
+ #inner_header ul { display: none; }
43
+
44
+ /* hide cover */
45
+ #cover { display: none; }
46
+ #inner_header { border: none; }
47
+ #inner_content { border: none; }
48
+
49
+ /* content */
50
+ #content p { margin-top: 0.5em; }
51
+ #content a { text-decoration: none; }
52
+
53
+ /* image classes */
54
+ .img_left {
55
+ float: left;
56
+ margin: 0.5em 0.8em 0em 0em;
57
+ }
58
+
59
+ .img_right {
60
+ float: right;
61
+ margin: 0.5em 0em 0em 0.8em;
62
+ }
63
+
64
+ .image img {
65
+ display: block; margin: 0; padding: 0.1em;
66
+ }
67
+
68
+ #footer { padding: 0.5em 0em 0em 0em; }
69
+
70
+
71
+ /*
72
+ Sizes
73
+ -----
74
+ Here you can modify your page width and height
75
+ */
76
+
77
+ .full { width: 100%; }
78
+ .centered { width: 90%; }
79
+
80
+
81
+
82
+ /*
83
+ Colors
84
+ ------
85
+ Colors are set here.
86
+ */
87
+
88
+ body { background: none; }
89
+
90
+
91
+ /* header: */
92
+ /* header background */
93
+ #inner_header { background-color: #ffffff; }
94
+
95
+ /* content background */
96
+ #inner_content { background-color: #ffffff; }
97
+
98
+
99
+ #inner_header br { display: none; }
100
+
101
+ #inner_header h1 { color: #595959; }
102
+ #inner_header h1 a, #inner_header h1 a:link {
103
+ color: #595959;
104
+ text-decoration: none;
105
+ }
106
+
107
+ #content { border-top: 1px solid #cccccc; }
108
+
109
+ /* content */
110
+ #inner_content { background-color: #FFFFFF; }
111
+
112
+ #content h1 { color: #595959; margin-top: 0.5em; }
113
+ #content a, #content a:visited, #content a:link { color: #000000; background-color: #FFFFFF; text-decoration: underline; }
114
+ #content a:hover, #content a:active { color: #000000; background-color: #EEEEEE; }
115
+
116
+ .image { background-color: #cccccc; }
117
+
118
+
119
+ /* footer */
120
+ #footer { border-top: 1px solid #cccccc; }
121
+ #footer a:link, #footer a:visited { color: #000000; }
122
+ #footer a:hover, #footer a:active { color: #FFFFFF; }
123
+
124
+
125
+ /*
126
+ Fonts
127
+ -----
128
+ Font families and sizes are definied below.
129
+ */
130
+ body {
131
+ font-size: 100%;
132
+ font-family: "Trebuchet MS", Arial, sans-serif;
133
+ }
134
+
135
+ /* logo headline */
136
+ #inner_header h1 {
137
+ font-family: Arial;
138
+ font-size: 1.6em;
139
+ }
140
+
141
+ /* content headlines */
142
+ #content h1 {
143
+ font-family: Arial;
144
+ font-size: 1.3em;
145
+ }
146
+
147
+ /* content paragraphs */
148
+ #content p {
149
+ font-size: 0.8em;
150
+ color: #595959;
151
+ line-height: 1.5em;
152
+ }
153
+
154
+ /* footer font */
155
+ #footer { font-size: 0.6em; }
156
+
157
+
158
+ /*
159
+ Special for printing (mozilla only)
160
+ -----------------------------------
161
+ Special style rules that only apply
162
+ to Mozilla based browsers.
163
+ */
164
+
165
+
166
+ /* Prints the link url after the link text (mozilla/ff only) */
167
+ #content p a[href]:after {
168
+ content: " < " attr(href) ">";
169
+ font-size: 0.7em;
170
+ }
171
+
172
+ /* Prints the title after the acronyms (mozilla/ff only) */
173
+ acronym:after {
174
+ content: " (" attr(title) ")";
175
+ font-style: normal;
176
+ }
177
+
178
+ /* end of css - */
@@ -0,0 +1,90 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <title>Lazibi: Python like syntax for Ruby</title>
8
+ <!-- version 1.0 - released Apr 14, 2007 -->
9
+
10
+ <meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
11
+
12
+ <meta name="generator" content="Free template made by Jonas John (www.jonasjohn.de)" />
13
+ <meta name="description" content="put a good description in here" />
14
+ <meta name="keywords" content="and, insert, some, good, keywords" />
15
+
16
+ <!-- base stylesheet - construct -->
17
+ <link rel="stylesheet" type="text/css" href="css/code.css" media="screen, tv, projection" />
18
+
19
+ <link rel="stylesheet" type="text/css" href="css/blossom_base.css" media="screen, tv, projection" title="Default" />
20
+
21
+ <!-- additional stylesheet -->
22
+ <link rel="stylesheet" type="text/css" href="css/blossom_v05.css" media="screen, tv, projection" />
23
+
24
+ <link rel="stylesheet" type="text/css" href="css/hack.css" media="screen, tv, projection" />
25
+
26
+ <!-- print stylesheet (and print preview) -->
27
+ <link rel="stylesheet" type="text/css" href="css/print.css" media="print" />
28
+ <link rel="alternative stylesheet" type="text/css" href="css/print.css" media="screen" title="Print Preview" />
29
+
30
+ <!-- Navigational metadata (an accessibility feature - use opera to preview) -->
31
+ <link rel="top" href="index.html" title="Homepage" />
32
+ <link rel="up" href="index.html" title="Up" />
33
+ <link rel="first" href="index.html" title="First page" />
34
+ <link rel="previous" href="index.html" title="Previous page" />
35
+ <link rel="next" href="index.html" title="Next page" />
36
+ <link rel="last" href="index.html" title="Last page" />
37
+ <link rel="toc" href="index.html" title="Table of contents" />
38
+
39
+ <link rel="index" href="index.html" title="Site map" />
40
+
41
+ </head>
42
+
43
+ <body>
44
+
45
+ <div id="page">
46
+
47
+ <div id="header" class="full">
48
+ <div id="inner_header" class="centered">
49
+ <h1><a href="index.html" title="Lazibi">Lazibi</a></h1>
50
+ <ul>
51
+ <li><a href="index.html">home</a></li>
52
+ <li><a href="installation.html">installation</a></li>
53
+ <li><a href="documentation.html">documentation</a></li>
54
+ <li><a href="faq.html">FAQ</a></li>
55
+ <li><a href="development.html">development</a></li>
56
+ </ul>
57
+ <br class="clear" />&nbsp;
58
+ </div>
59
+ </div>
60
+
61
+ <div id="cover" class="full">
62
+ <div id="inner_cover" class="centered">
63
+ &nbsp;
64
+ </div>
65
+ </div>
66
+
67
+ <div class="full">
68
+ <div id="inner_content" class="centered">
69
+ <div id="content">
70
+
71
+ <!-- replace the texts trough your own one: -->
72
+ {block: }
73
+
74
+ <br class="clear" />
75
+
76
+ <p id="footer">
77
+ Copyright &copy; 2007 <a href="mailto:nfjinjing@gmail.com">Jinjing</a>.
78
+ <a href="http://www.jonasjohn.de/">Webdesign by Jonas John</a>.
79
+ </p>
80
+ </div>
81
+ </div>
82
+ </div>
83
+
84
+ <!-- i love clean source code -->
85
+
86
+ </div>
87
+
88
+ </body>
89
+ </html>
90
+
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Development
3
+ ---
4
+
5
+ h1. Project page
6
+
7
+ "lazibi":http://rubyforge.org/lazibi on RubyForge.
8
+
9
+ h1. Code coverage
10
+
11
+ "rcov":coverage/index.html
12
+
13
+ h1. Email-list
14
+
15
+ "lazibi-talk":http://groups.google.com/group/lazibi-talk in GoogleGroup.
16
+
17
+ h1. Thanks to
18
+
19
+ "webgen":http://webgen.rubyforge.org/
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: Documentation
3
+ ---
4
+
5
+ h1. Usage
6
+
7
+ Bootstrap
8
+
9
+ <pre>
10
+ mkdir shiny_project
11
+ cd shiny_project
12
+ # put trunk in real
13
+ svn co $svn_path/shiny_project/trunk real
14
+ lazibi
15
+ </pre>
16
+
17
+ Make sure everything still works
18
+
19
+ <pre>
20
+ _start_a_new_terminal_
21
+ cd shiny_project/real
22
+ rake test / autotest
23
+ </pre>
24
+
25
+ Start hacking in meta :/
26
+
27
+ <pre>
28
+ cd shiny_project
29
+ $your_editor meta
30
+ </pre>
31
+
32
+
33
+ h1. In Practice
34
+
35
+ Lazibi is written using Lazibi itself ( incrementally ). I think "autotest":http://www.zenspider.com/ZSS/Products/ZenTest/ is a must have, and Lazibi works well using TDD.
36
+
37
+ A few projects are used as test code:
38
+
39
+ ActiveRecord, ActionMailer, ActionPack, ActiveSupport, Mongrel, RSpec, redMine.
40
+
41
+ h1. Known issues
42
+
43
+ Here docs, eval, javascript related libs, and complex string evaluation are currently not supported.
44
+ Ruby code with above syntax will be preserved as is. So your code should still works, just no parse.
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: FAQ
3
+ ---
4
+
5
+ h1. Setup environment manually
6
+
7
+ <pre>
8
+ mkdir shiny_project
9
+ cd shiny_project
10
+
11
+ mkdir real
12
+ mkdir .backup
13
+ mkdir meta
14
+
15
+ lazibi
16
+ </pre>
17
+
18
+ create .py.rb files in corresponding directories inside 'meta', .rb files will be created and updated in 'real' as usual
19
+
20
+ h1. Exclude certain directories
21
+
22
+ [default is ^vendor]
23
+
24
+ Edit lazibi_config.rb in project/real/config/
25
+
26
+ <pre>
27
+ def exclude
28
+ ['^vendor', 'tmp']
29
+ end
30
+ </pre>
31
+
32
+ h1. RSpec taste
33
+
34
+ Optional do is only enabled for spec directory. You can customize this behavior by editing lazibi_config.rb in project/real/config/
35
+
36
+ <pre>
37
+ def filters
38
+ {:optional_do => ['^spec', '^dsl'], :optional_end => ['']}
39
+ end
40
+ </pre>
41
+
42
+ Personally I would not recommend using this filter outside the context of RSpec.
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: Home
3
+ ---
4
+ h1. Welcome
5
+
6
+ Lazibi is a pre-processor that allows one to use Python style indenting in Ruby.
7
+
8
+ h1. Examples
9
+
10
+ Sweeter RSpec [ Thanks Jay ]
11
+
12
+ {includeFile: {filename: code/examples/rspec.py.rb, highlight: ruby, escapeHTML: false}}
13
+
14
+
15
+ Even sexier migrations ( with sexy_migration Rails plugin )
16
+
17
+ {includeFile: {filename: code/examples/migration.py.rb, highlight: ruby, escapeHTML: false}}
18
+
19
+ h1. How?
20
+
21
+ <pre>
22
+ Beauty -----------------> Simply <-------- Your workspace
23
+ ^ /
24
+ \ Lazibi /
25
+ \ /
26
+ \ /
27
+ <----- Ruby ------<
28
+ | \
29
+ | \-----------------> SVN
30
+ |
31
+ |
32
+ |``````````|
33
+ | autotest |
34
+ |..........|
35
+ </pre>
36
+
37
+ h1. Ideals
38
+
39
+ Plug/unplug Lazibi should not matter. Ruby code stays the same in SCM.
40
+
41
+ Meta language definition should be customizable.
42
+
43
+ h1. License
44
+
45
+ Released under the MIT license (included)