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
data/.autotest CHANGED
@@ -1,2 +1,44 @@
1
- require 'autotest/redgreen'
2
- require 'autotest/growl'
1
+ require 'autotest/growl'
2
+
3
+ # Just like Autotest::Fixtures, but for specs
4
+ module Autotest::SpecFixtures
5
+ Autotest.add_hook :initialize do |at|
6
+ at.test_mappings['^spec/fixtures/(.*)s.yml'] = proc { |filename, matches|
7
+ at.files_matching(/spec\/\w+\/#{matches[1]}(_\w+)?.*_spec.rb$/)
8
+ }
9
+ end
10
+ end
11
+
12
+ # Just like Autotest::RedGreen, but for specs
13
+ module Autotest::SpecRedGreen
14
+ BAR = "=" * 80
15
+
16
+ Autotest.add_hook :ran_command do |at|
17
+ # TODO: submit a patch for RedGreen to make the match and code configurable
18
+ if at.results.last.match(/^(\d+) examples?, (\d+) failures?$/)
19
+ code = ($2 != "0") ? 31 : 32
20
+ puts "\e[#{code}m#{BAR}\e[0m\n\n"
21
+ end
22
+ end
23
+ end
24
+
25
+ # Speak failures via Apple's speech synth
26
+
27
+ module Autotest::Speak
28
+ def self.speak message
29
+ # system %(osascript -e 'say "#{message}"')
30
+ end
31
+
32
+ Autotest.add_hook :red do |at|
33
+ failures = at.files_to_test.size
34
+ speak "#{failures} example#{failures == 0 || failures > 1 ? 's' : nil} failed."
35
+ end
36
+
37
+ # Autotest.add_hook :green do |at|
38
+ # speak "Specs passed."
39
+ # end
40
+
41
+ Autotest.add_hook :all_good do |at|
42
+ speak "All specs passed."
43
+ end
44
+ end
data/History.txt CHANGED
@@ -1,10 +1,19 @@
1
+ == 0.1.14 2007-06-29
2
+
3
+ * Features
4
+ * Completely re-factored source code
5
+ * Move from unit test to rspec, reused _all_ the previous fixtures and test cases
6
+ * The engine can hook any filters with complete configuration
7
+ * Designed with future easy custom pre-processor filters plugin in mind
8
+ * Ruby based configuration file
9
+
1
10
  == 0.1.13 2007-06-22
2
11
 
3
12
  * Bugs
4
13
  * {} and lambda syntax for optioanl_do
5
14
  * correctly parse inline def; end
6
15
 
7
- Features
16
+ * Features
8
17
  * Passed all spec tests for RSpec with optional_do filter on
9
18
 
10
19
  == 0.1.12 2007-06-21
data/Manifest.txt CHANGED
@@ -5,100 +5,123 @@ Manifest.txt
5
5
  README.txt
6
6
  Rakefile
7
7
  bin/lazibi
8
- coverage/index.html
9
- coverage/lib-helper-parser_helper_rb.html
10
- coverage/lib-helper-task_helper_rb.html
11
- coverage/lib-lazibi-version_rb.html
12
- coverage/lib-lazibi_rb.html
13
- coverage/lib-parser_rb.html
14
- coverage/lib-task_rb.html
15
- lib/helper/app_helper.rb
16
- lib/helper/parser_helper.rb
8
+ config/lazibi_config_template.rb
9
+ lib/core/beautify_engine.rb
10
+ lib/core/default_engine.rb
11
+ lib/core/engine_base.rb
12
+ lib/filter/beautify_filter.rb
13
+ lib/filter/filter_base.rb
14
+ lib/filter/optional_do_filter.rb
15
+ lib/filter/optional_end_filter.rb
16
+ lib/filter/syntax_guard_filter.rb
17
+ lib/helper/application_helper.rb
18
+ lib/helper/beautify_filter_helper.rb
19
+ lib/helper/filter_helper.rb
17
20
  lib/helper/task_helper.rb
18
21
  lib/lazibi.rb
19
22
  lib/lazibi/version.rb
20
- lib/parser.rb
21
23
  lib/task.rb
22
- lib/vendor/beautifier.rb
23
24
  scripts/rdoc2html
24
25
  scripts/txt2html
25
- test/fixtures/clean/comment_break.txt
26
- test/fixtures/clean/complex_string.txt
27
- test/fixtures/clean/end_concat.txt
28
- test/fixtures/clean/long_indent.txt
29
- test/fixtures/clean/mixed_re.txt
30
- test/fixtures/clean/only_if.txt
31
- test/fixtures/clean/re.txt
32
- test/fixtures/clean/semi_colon_after_end.txt
33
- test/fixtures/clean/sep_line.txt
34
- test/fixtures/clean/unless_problem.txt
35
- test/fixtures/functional/ruby/brackets_block.txt
36
- test/fixtures/functional/ruby/classical.txt
37
- test/fixtures/functional/ruby/describe.txt
38
- test/fixtures/functional/ruby/do_block.txt
39
- test/fixtures/functional/ruby/lambda.txt
40
- test/fixtures/functional/ruby/square_brackets.txt
41
- test/fixtures/functional/simply/brackets_block.txt
42
- test/fixtures/functional/simply/classical.txt
43
- test/fixtures/functional/simply/describe.txt
44
- test/fixtures/functional/simply/do_block.txt
45
- test/fixtures/functional/simply/lambda.txt
46
- test/fixtures/functional/simply/square_brackets.txt
47
- test/fixtures/meta/basic_class.txt
48
- test/fixtures/meta/case.txt
49
- test/fixtures/meta/class_with_def.txt
50
- test/fixtures/meta/comment.txt
51
- test/fixtures/meta/comment_after_end.txt
52
- test/fixtures/meta/eval_code.txt
53
- test/fixtures/meta/here_doc.txt
54
- test/fixtures/meta/inline_do_end.txt
55
- test/fixtures/meta/inline_end.txt
56
- test/fixtures/meta/loop.txt
57
- test/fixtures/meta/middle.txt
58
- test/fixtures/meta/multi_blocks.txt
59
- test/fixtures/meta/nested_comment.txt
60
- test/fixtures/meta/optional_do.txt
61
- test/fixtures/meta/optional_do_with_nasty_chars.txt
62
- test/fixtures/meta/partial_method.txt
63
- test/fixtures/meta/single_method.txt
64
- test/fixtures/meta/two_methods.txt
65
- test/fixtures/real/basic_class.txt
66
- test/fixtures/real/case.txt
67
- test/fixtures/real/class_with_def.txt
68
- test/fixtures/real/comment.txt
69
- test/fixtures/real/comment_after_end.txt
70
- test/fixtures/real/comment_after_end_expected.txt
71
- test/fixtures/real/comment_break.txt
72
- test/fixtures/real/complex_string.txt
73
- test/fixtures/real/end_concat.txt
74
- test/fixtures/real/eval_code.txt
75
- test/fixtures/real/general_eval.txt
76
- test/fixtures/real/here_doc.txt
77
- test/fixtures/real/inline_do_end.txt
78
- test/fixtures/real/inline_end.txt
79
- test/fixtures/real/javascript.txt
80
- test/fixtures/real/long_indent.txt
81
- test/fixtures/real/loop.txt
82
- test/fixtures/real/middle.txt
83
- test/fixtures/real/mixed_re.txt
84
- test/fixtures/real/multi_blocks.txt
85
- test/fixtures/real/nested_comment.txt
86
- test/fixtures/real/only_if.txt
87
- test/fixtures/real/optional_do.txt
88
- test/fixtures/real/optional_do_with_nasty_chars.txt
89
- test/fixtures/real/partial_method.txt
90
- test/fixtures/real/re.txt
91
- test/fixtures/real/semi_colon_after_end.txt
92
- test/fixtures/real/sep_line.txt
93
- test/fixtures/real/single_method.txt
94
- test/fixtures/real/strange_syntax_1.txt
95
- test/fixtures/real/two_methods.txt
96
- test/fixtures/real/unless_problem.txt
97
- test/test_functional.rb
98
- test/test_helper.rb
99
- test/test_unit.rb
100
- website/index.html
101
- website/index.txt
102
- website/javascripts/rounded_corners_lite.inc.js
103
- website/stylesheets/screen.css
104
- website/template.rhtml
26
+ spec/core/beautify_engine_spec.rb
27
+ spec/core/default_engine_spec.rb
28
+ spec/core/engine_base_spec.rb
29
+ spec/filter/beautify_filter_spec.rb
30
+ spec/filter/filter_spec_helper.rb
31
+ spec/filter/optional_do_filter_spec.rb
32
+ spec/filter/optional_end_filter_spec.rb
33
+ spec/filter/syntax_guard_filter_spec.rb
34
+ spec/fixtures/beautify/metas/square_brackets.txt
35
+ spec/fixtures/beautify/rbs/square_brackets.txt
36
+ spec/fixtures/clean/comment_break.txt
37
+ spec/fixtures/clean/complex_string.txt
38
+ spec/fixtures/clean/end_concat.txt
39
+ spec/fixtures/clean/long_indent.txt
40
+ spec/fixtures/clean/mixed_re.txt
41
+ spec/fixtures/clean/only_if.txt
42
+ spec/fixtures/clean/re.txt
43
+ spec/fixtures/clean/semi_colon_after_end.txt
44
+ spec/fixtures/clean/sep_line.txt
45
+ spec/fixtures/clean/unless_problem.txt
46
+ spec/fixtures/meta/basic_class.txt
47
+ spec/fixtures/meta/case.txt
48
+ spec/fixtures/meta/class_with_def.txt
49
+ spec/fixtures/meta/comment.txt
50
+ spec/fixtures/meta/comment_after_end.txt
51
+ spec/fixtures/meta/eval_code.txt
52
+ spec/fixtures/meta/here_doc.txt
53
+ spec/fixtures/meta/inline_do_end.txt
54
+ spec/fixtures/meta/inline_end.txt
55
+ spec/fixtures/meta/loop.txt
56
+ spec/fixtures/meta/middle.txt
57
+ spec/fixtures/meta/multi_blocks.txt
58
+ spec/fixtures/meta/nested_comment.txt
59
+ spec/fixtures/meta/optional_do.txt
60
+ spec/fixtures/meta/optional_do_with_nasty_chars.txt
61
+ spec/fixtures/meta/partial_method.txt
62
+ spec/fixtures/meta/single_method.txt
63
+ spec/fixtures/meta/two_methods.txt
64
+ spec/fixtures/optional_do/metas/brackets_block.txt
65
+ spec/fixtures/optional_do/metas/classical.txt
66
+ spec/fixtures/optional_do/metas/describe.txt
67
+ spec/fixtures/optional_do/metas/do_block.txt
68
+ spec/fixtures/optional_do/metas/lambda.txt
69
+ spec/fixtures/optional_do/metas/square_brackets.txt
70
+ spec/fixtures/optional_do/rbs/brackets_block.txt
71
+ spec/fixtures/optional_do/rbs/classical.txt
72
+ spec/fixtures/optional_do/rbs/describe.txt
73
+ spec/fixtures/optional_do/rbs/do_block.txt
74
+ spec/fixtures/optional_do/rbs/lambda.txt
75
+ spec/fixtures/optional_do/rbs/square_brackets.txt
76
+ spec/fixtures/real/basic_class.txt
77
+ spec/fixtures/real/case.txt
78
+ spec/fixtures/real/class_with_def.txt
79
+ spec/fixtures/real/comment.txt
80
+ spec/fixtures/real/comment_after_end.txt
81
+ spec/fixtures/real/comment_after_end_expected.txt
82
+ spec/fixtures/real/comment_break.txt
83
+ spec/fixtures/real/complex_string.txt
84
+ spec/fixtures/real/end_concat.txt
85
+ spec/fixtures/real/eval_code.txt
86
+ spec/fixtures/real/general_eval.txt
87
+ spec/fixtures/real/here_doc.txt
88
+ spec/fixtures/real/inline_do_end.txt
89
+ spec/fixtures/real/inline_end.txt
90
+ spec/fixtures/real/javascript.txt
91
+ spec/fixtures/real/long_indent.txt
92
+ spec/fixtures/real/loop.txt
93
+ spec/fixtures/real/middle.txt
94
+ spec/fixtures/real/mixed_re.txt
95
+ spec/fixtures/real/multi_blocks.txt
96
+ spec/fixtures/real/nested_comment.txt
97
+ spec/fixtures/real/only_if.txt
98
+ spec/fixtures/real/optional_do.txt
99
+ spec/fixtures/real/optional_do_with_nasty_chars.txt
100
+ spec/fixtures/real/partial_method.txt
101
+ spec/fixtures/real/re.txt
102
+ spec/fixtures/real/semi_colon_after_end.txt
103
+ spec/fixtures/real/sep_line.txt
104
+ spec/fixtures/real/single_method.txt
105
+ spec/fixtures/real/strange_syntax_1.txt
106
+ spec/fixtures/real/two_methods.txt
107
+ spec/fixtures/real/unless_problem.txt
108
+ spec/helper/filter_helper_spec.rb
109
+ spec/helper/task_helper_spec.rb
110
+ spec/lazibi_spec.rb
111
+ spec/spec_helper.rb
112
+ webgen/src/code/examples/migration.py.rb
113
+ webgen/src/code/examples/rspec.py.rb
114
+ webgen/src/css/blossom_base.css
115
+ webgen/src/css/blossom_v05.css
116
+ webgen/src/css/code.css
117
+ webgen/src/css/hack.css
118
+ webgen/src/css/print.css
119
+ webgen/src/default.template
120
+ webgen/src/development.page
121
+ webgen/src/documentation.page
122
+ webgen/src/faq.page
123
+ webgen/src/images/cover_landscape.jpg
124
+ webgen/src/images/example_picture03.jpg
125
+ webgen/src/images/example_picture04.jpg
126
+ webgen/src/index.page
127
+ webgen/src/installation.page
data/README.txt CHANGED
@@ -1,133 +1,12 @@
1
1
  == Welcome to Lazibi
2
2
 
3
- Lazibi is a preprocessor that allows you to use Python style indentation in Ruby.
3
+ Lazibi is a pre-processor that allows one to use Python style indenting in Ruby.
4
4
 
5
- The idea is to edit .py.rb files in a meta directory and let the engine generates .rb files in
6
- the real directory for you in real time.
5
+ == Documentation
7
6
 
8
- == Examples
9
-
10
- Sweeter RSpec [ Thanks Jay ]
11
-
12
- describe Bowling
13
- before(:each)
14
- @bowling = Bowling.new
15
-
16
- it "should score 0 for gutter game"
17
- 20.times { @bowling.hit(0) }
18
- @bowling.score.should == 0
19
-
20
- More DIY Rails controller
21
-
22
- class AuctionsController < ApplicationController
23
-
24
- def index
25
- @auctions = Auction.paginate :page => params[:page]
26
-
27
- respond_to do |format|
28
- format.html # index.rhtml
29
- format.xml { render :xml => @auctions.to_xml }
30
-
31
-
32
- Even sexier migrations ( with sexy_migration Rails plugin )
33
-
34
- class CreateOrders < ActiveRecord::Migration
35
- def self.up
36
- create_table :orders do
37
- fkey :user
38
- fkey :auction
39
- integer :bid_type
40
- timestamps!
41
-
42
- def self.down
43
- drop_table :orders
44
-
45
- == Download
46
-
47
- gem install lazibi
48
- svn checkout svn://rubyforge.org/var/svn/lazibi/trunk lazibi
49
-
50
- == Usage
51
-
52
- Bootstrap
53
-
54
- mkdir shiny_project
55
- cd shiny_project
56
- # put trunk in real
57
- svn co $svn_path/shiny_project/trunk real
58
- lazibi
59
-
60
- Make sure everything still works
61
-
62
- _start_a_new_terminal_
63
- cd shiny_project/real
64
- rake test / autotest
7
+ rake webgen
65
8
 
66
- Start hacking in meta :/
67
-
68
- cd shiny_project
69
- $your_editor meta
70
-
71
- == Tips
72
-
73
- === Manually create meta files
74
-
75
- * Bootstrap your project as usual, just don't run lazibi
76
-
77
- * setup environment
78
-
79
- mkdir .backup
80
- mkdir meta
81
-
82
- * run lazibi
83
-
84
- * create .py.rb files in corresponding directories inside 'meta', .rb files will be created and updated in 'real' as usual
85
-
86
- === Prevent certain directories from being parsed during bootstrap ( default is ^vendor )
87
-
88
- * Create .lazibi in project/real path
89
-
90
- exclude:
91
- - ^vendor
92
- - ^tmp
93
- - etc
94
-
95
- === RSpec taste
96
-
97
- * Optional do is only enabled for spec directory. You can customize this behavior by editing .lazibi config file.
98
-
99
- filters:
100
- optional_do:
101
- - ^spec
102
- - ^test
103
- - etc
104
-
105
- * Personally I would not recommend using this filter outside the context of RSpec
106
- * It's not well tested
107
- * Anything more complex then simple description will get unreadable
108
-
109
- == In Practice
110
-
111
- Lazibi is written using Lazibi itself ( incrementally ). Personally I think autotest from http://www.zenspider.com/ZSS/Products/ZenTest/ is a must have, and Lazibi works pretty well using TDD.
112
-
113
- A few projects are used as test code:
114
- ActiveRecord, ActionMailer, ActionPack, ActiveSupport, Mongrel, RSpec, redMine.
115
-
116
- Lazibi was used to generate .py.rb files from these projects, and then to .rb files back ( this is the default process ). Tests were then run to ensure compatibility.
117
-
118
- == Known issues
119
-
120
- Here docs, eval, javascript related libs, and complex string evaluation are currently not supported.
121
- Ruby code with above syntax will be preserved as is. So your code should still works, just no parse. In other words, if you don't want your code to be parsed, simply add a dummy here doc string...
122
-
123
- == Talk
124
-
125
- http://groups.google.com/group/lazibi-talk
126
-
127
- == To Do
128
-
129
- * Maybe a custom filter for RSpec runner? Still learning though...
130
- * Two way sync between real and meta
9
+ open webgen/output/index.html in your browser
131
10
 
132
11
  == Author
133
12
  * Jinjing (mailto:nfjinjing@gmail.com)
data/Rakefile CHANGED
@@ -8,13 +8,14 @@ require 'rake/rdoctask'
8
8
  require 'rake/contrib/rubyforgepublisher'
9
9
  require 'fileutils'
10
10
  require 'hoe'
11
+ require 'spec/rake/spectask'
11
12
 
12
13
  include FileUtils
13
14
  require File.join(File.dirname(__FILE__), 'lib', 'lazibi', 'version')
14
15
 
15
16
  AUTHOR = 'Jinjing' # can also be an array of Authors
16
17
  EMAIL = "nfjinjing@gmail.com"
17
- DESCRIPTION = "Python like syntax for Ruby"
18
+ DESCRIPTION = "Python like indenting for Ruby"
18
19
  GEM_NAME = 'lazibi' # what ppl will type to install your gem
19
20
 
20
21
  @config_file = "~/.rubyforge/user-config.yml"
@@ -44,7 +45,7 @@ REV = nil
44
45
  # UNCOMMENT IF REQUIRED:
45
46
  # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
46
47
  VERS = Lazibi::VERSION::STRING + (REV ? ".#{REV}" : "")
47
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
48
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', 'webgen/output', 'coverage']
48
49
  RDOC_OPTS = ['--quiet', '--title', 'lazibi documentation',
49
50
  "--opname", "index.html",
50
51
  "--line-numbers",
@@ -71,7 +72,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
71
72
 
72
73
  # == Optional
73
74
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
74
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
75
+ p.extra_deps = [ ['hoe', '>= 1.2.1'], ['webgen', '>= 0.4.4'], ['activesupport', '>=1.4.2']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
75
76
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
76
77
  end
77
78
 
@@ -80,22 +81,21 @@ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PRO
80
81
  hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
81
82
 
82
83
  desc 'Generate website files'
83
- task :website_generate do
84
- Dir['website/**/*.txt'].each do |txt|
85
- sh %{ ruby scripts/rdoc2html #{txt} > #{txt.gsub(/txt$/,'html')} }
86
- end
84
+ task :webgen_main do
85
+ sh %{ rm -rf webgen/output}
86
+ sh %{ webgen -d webgen}
87
87
  end
88
88
 
89
89
  desc 'Upload website files to rubyforge'
90
90
  task :website_upload do
91
91
  host = "#{rubyforge_username}@rubyforge.org"
92
92
  remote_dir = "/var/www/gforge-projects/#{PATH}/"
93
- local_dir = 'website'
93
+ local_dir = 'webgen/output'
94
94
  sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
95
95
  end
96
96
 
97
97
  desc 'Generate and upload website files'
98
- task :website => [:website_generate, :website_upload, :publish_docs]
98
+ task :website => [:webgen, :website_upload]
99
99
 
100
100
  desc 'Release the website and new gem version'
101
101
  task :deploy => [:check_version, :website, :release] do
@@ -107,7 +107,7 @@ task :deploy => [:check_version, :website, :release] do
107
107
  end
108
108
 
109
109
  desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
110
- task :local_deploy => [:website_generate, :install_gem]
110
+ task :local_deploy => [:webgen, :install_gem]
111
111
 
112
112
  task :check_version do
113
113
  unless ENV['VERSION']
@@ -121,3 +121,13 @@ task :check_version do
121
121
  end
122
122
 
123
123
 
124
+ desc "Run all specs with RCov"
125
+ Spec::Rake::SpecTask.new('specs_with_rcov') do |t|
126
+ t.spec_files = FileList['spec/**/*.rb']
127
+ t.rcov = true
128
+ t.rcov_opts = ['--exclude', 'spec']
129
+ end
130
+
131
+ task :webgen => [:webgen_main, :specs_with_rcov] do
132
+ sh %{mv coverage webgen/output}
133
+ end