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,6 @@
1
+ it "should read several example names from file if --example is given an existing file name" do
2
+ options = parse(["--example", File.dirname(__FILE__) + '/examples.txt'])
3
+ options.examples.should eql([
4
+ "Sir, if you were my husband, I would poison your drink.",
5
+ "Madam, if you were my wife, I would drink it."])
6
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'beautify_filter'
3
+
4
+ include Filter
5
+
6
+ module Lazibi
7
+ module Spec
8
+
9
+ describe 'FilterHelper' do
10
+ include Helper::FilterHelper
11
+ it 'should detect start anchor' do
12
+ start_anchor?( 'class' ).should == true
13
+ start_anchor?( 'do |abc| ').should == true
14
+ start_anchor?( 'do |abc,def| ').should == true
15
+ start_anchor?( '"abc do "').should == false
16
+ start_anchor?( '"abc do |"').should == false
17
+ start_anchor?( 'lambda').should == false
18
+ end
19
+
20
+ it 'should detect end anchor' do
21
+ end_anchor?( 'lambda' ).should == false
22
+ end
23
+
24
+ it 'should detect middle anchor' do
25
+ middle_anchor?( '' ).should == false
26
+ middle_anchor?( 'rescue' ).should == true
27
+ middle_anchor?( 'lambda').should == false
28
+ end
29
+
30
+ it 'should detect comment at end' do
31
+ comment_at_end(' dab #abcd').should_not be_nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'task_helper'
3
+
4
+ module Lazibi
5
+ module Spec
6
+ describe 'TaskHelper' do
7
+ include Helper::TaskHelper
8
+
9
+ it 'should test_convert_path' do
10
+ convert_path( 'meta/abc.py.rb' ).should == 'real/abc.rb'
11
+ convert_path( 'real/abc.rb' ).should == 'meta/abc.py.rb'
12
+ convert_path( 'meta/lib/abc.py.rb' ).should == 'real/lib/abc.rb'
13
+ end
14
+
15
+
16
+ it 'should soft filters' do
17
+ sort_filter([:optional_end, :optional_do, :beautify]).should == [:beautify, :optional_end, :optional_do]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ module Lazibi
4
+ module Spec
5
+
6
+ describe 'Lazibi' do
7
+ before(:all) do
8
+ @r = Lazibi::Runner.new
9
+ @r.load_config
10
+ end
11
+
12
+ it 'should load default config' do
13
+ @r.config[:exclude].should_not be_nil
14
+ end
15
+
16
+ it 'should skip vendor by default' do
17
+ @r.skip_path?('meta/vendor').should == true
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
3
+ $:.unshift(File.dirname(__FILE__) + '/../lib/helper')
4
+ $:.unshift(File.dirname(__FILE__) + '/../lib/core')
5
+ $:.unshift(File.dirname(__FILE__) + '/../lib/filter')
6
+
7
+ require 'lazibi'
8
+ require 'application_helper'
9
+
10
+ include Lazibi
11
+
12
+ module Lazibi
13
+ module Spec
14
+ FIXTURE_DIR = File.dirname(__FILE__) + '/fixtures/'
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class CreateOrders < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :orders do
4
+ fkey :user
5
+ fkey :auction
6
+ integer :bid_type
7
+ timestamps!
8
+
9
+ def self.down
10
+ drop_table :orders
@@ -0,0 +1,7 @@
1
+ describe Bowling
2
+ before(:each)
3
+ @bowling = Bowling.new
4
+
5
+ it "should score 0 for gutter game"
6
+ 20.times { @bowling.hit(0) }
7
+ @bowling.score.should == 0
@@ -0,0 +1,172 @@
1
+ /*
2
+ ** blue:blossom - base stylesheet
3
+ **
4
+ ** This file contains the base styles that are used
5
+ ** in every style variation.
6
+ **
7
+ ** April 14, 2007 - (version 1.0)
8
+ **
9
+ ** This is a part of the open source template
10
+ ** "blue:blossom" made by Jonas John (www.jonasjohn.de)
11
+ */
12
+
13
+ /*
14
+ General settings
15
+ ----------------
16
+ All margins, paddings and borders are set here
17
+ */
18
+
19
+ /* reset all margins, paddings and borders for specific elements */
20
+ body,div,p,img,form,h1,h2,h3,h4,h5,h6,ul,li {
21
+ margin: 0;
22
+ padding: 0;
23
+ border: 0;
24
+ }
25
+
26
+ body {
27
+ margin: 0.6em 0em 2em 0em;
28
+ text-align: center;
29
+ }
30
+
31
+ /* basics */
32
+ .centered { margin: 0 auto; text-align: left; }
33
+ .clear { clear: both; }
34
+ #content { padding: 0.7em 0.9em 0.7em 0.45em; }
35
+ .image { padding: 3px; }
36
+
37
+ /* header */
38
+ #inner_header { padding-bottom: 0.2em; }
39
+ #inner_header h1 { padding: 0.2em 0.25em; }
40
+
41
+ /* navigation */
42
+ #inner_header ul { list-style-type: none; padding: 0.2em 0em 0.3em 0.4em; }
43
+ #inner_header ul li { list-style-type: none; float: left; margin: 0em 0.3em 0em 0em; }
44
+ #inner_header ul li a {
45
+ float: left;
46
+ padding: 0.35em 1em;
47
+ text-decoration: none;
48
+
49
+ }
50
+ #inner_header br { display: none; }
51
+
52
+ #inner_cover { background-repeat: no-repeat; }
53
+
54
+
55
+ /* content */
56
+ #content p { margin-top: 0.5em; }
57
+ #content a { text-decoration: none; }
58
+
59
+ /* image classes */
60
+ .img_left {
61
+ float: left;
62
+ margin: 0.5em 0.8em 0em 0em;
63
+ }
64
+
65
+ .img_right {
66
+ float: right;
67
+ margin: 0.5em 0em 0em 0.8em;
68
+ }
69
+
70
+ .image img {
71
+ display: block; margin: 0; padding: 0;
72
+ }
73
+
74
+ #footer { padding: 2em 0.5em 0.5em 0.5em; }
75
+
76
+
77
+ /*
78
+ Sizes
79
+ -----
80
+ Here you can modify your page width and height
81
+ */
82
+
83
+ .full { width: 100%; }
84
+ .centered { width: 540px; width: 33.8em; }
85
+ #inner_cover { height: 120px; }
86
+
87
+
88
+
89
+ /*
90
+ Colors
91
+ ------
92
+ Colors are set here.
93
+ */
94
+
95
+ body { background-color: #FFFFFF; }
96
+
97
+ /* header: */
98
+ #inner_header { background-color: #FFFFFF; }
99
+
100
+ #inner_header h1 { color: #595959; }
101
+ #inner_header h1 a, #inner_header h1 a:link {
102
+ color: #595959;
103
+ text-decoration: none;
104
+ }
105
+
106
+ #inner_header ul li a {
107
+ background-color: #D9ECFD;
108
+ color: #000000;
109
+ border-bottom: 1px solid #CAD9B2;
110
+ border-right: 1px solid #CAD9B2;
111
+ }
112
+
113
+ #inner_header ul li a:hover {
114
+ background-color: #000000;
115
+ color: #FFFFFF;
116
+ }
117
+
118
+ /* content */
119
+ #inner_content { background-color: #FFFFFF; }
120
+
121
+ #content h1 { color: #595959; }
122
+ #content a { background-color: #D9ECFD; color: #000000; padding: 1px; }
123
+ #content a:hover { background-color: #000000; color: #FFFFFF; }
124
+
125
+ .image { background-color: #3B4629; }
126
+
127
+
128
+ /* footer */
129
+ #footer { }
130
+ #footer a:link, #footer a:visited { color: #000000; }
131
+ #footer a:hover, #footer a:active { color: #FFFFFF; }
132
+
133
+
134
+ /*
135
+ Fonts
136
+ -----
137
+ Font families and sizes are definied below.
138
+ */
139
+ body { font-size: 100%; }
140
+
141
+ /* logo headline */
142
+ #inner_header h1 {
143
+ font-family: Arial, Verdana, sans-serif;
144
+ font-size: 1.5em;
145
+ }
146
+
147
+ /* navigation font */
148
+ #inner_header ul li {
149
+ font-family: Verdana, Arial, sans-serif;
150
+ font-size: 0.7em;
151
+ }
152
+
153
+ /* content headlines */
154
+ #content h1 {
155
+ font-family: Arial, Verdana, sans-serif;
156
+ font-size: 1.2em;
157
+ padding-top: 0.5em;
158
+ }
159
+
160
+ /* content paragraphs */
161
+ #content p {
162
+ font-family: Verdana, Arial, sans-serif;
163
+ font-size: 0.7em;
164
+ color: #595959;
165
+ line-height: 1.64em;
166
+ }
167
+
168
+ /* footer font */
169
+ #footer { font-size: 0.6em; }
170
+
171
+
172
+ /* end of css - */
@@ -0,0 +1,48 @@
1
+ /*
2
+ ** blue:blossom - design variation 05 - "blue landscape"
3
+ **
4
+ ** This file contains a design variation of the base
5
+ ** stylesheet.
6
+ **
7
+ ** April 14, 2007 - (version 1.0)
8
+ **
9
+ ** This is a part of the open source template
10
+ ** "blue:blossom" made by Jonas John (www.jonasjohn.de)
11
+ */
12
+
13
+ /* cover picture */
14
+ #inner_cover {
15
+ background-image: url("../images/cover_landscape.jpg");
16
+ }
17
+
18
+ /* area next to the cover image: */
19
+ #cover {
20
+ background-color: #D0DDED;
21
+ }
22
+
23
+ /* image colors: */
24
+ .image {
25
+ background-color: #98B5D8;
26
+ }
27
+
28
+ .image:hover {
29
+ background-color: #497CBA;
30
+ }
31
+
32
+ /* navigation */
33
+ #inner_header ul li a:hover, #inner_header ul li a:active {
34
+ background-color: #497CBA;
35
+ color: #FFFFFF;
36
+ }
37
+ #inner_header ul li {
38
+ background-color: #497CBA;
39
+ color: #FFFFFF;
40
+ }
41
+
42
+ #inner_header h1 { color: #80A1CC; }
43
+
44
+ /* content link colors */
45
+ #content a:hover, #content a:active {
46
+ background-color: #497CBA;
47
+ color: #FFFFFF;
48
+ }
@@ -0,0 +1,32 @@
1
+
2
+ /* START webgen download tag */
3
+ .webgen-file-icon, .webgen-download-icon { vertical-align: middle; }
4
+ /* STOP webgen download tag */
5
+ .CodeRay {
6
+ background-color: #f8f8f8;
7
+ border: 1px solid silver;
8
+ font-family: 'Courier New', 'Terminal', monospace;
9
+ color: #100;
10
+ }
11
+ .CodeRay pre { margin: 0px }
12
+
13
+ div.CodeRay { }
14
+
15
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px }
16
+
17
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
18
+ table.CodeRay td { padding: 2px 4px; vertical-align: top }
19
+
20
+ .CodeRay .line_numbers, .CodeRay .no {
21
+ background-color: #def;
22
+ color: gray;
23
+ text-align: right;
24
+ }
25
+ .CodeRay .line_numbers tt { font-weight: bold }
26
+ .CodeRay .no { padding: 0px 4px }
27
+ .CodeRay .code { width: 100% }
28
+
29
+ ol.CodeRay { font-size: 10pt }
30
+ ol.CodeRay li { white-space: pre }
31
+
32
+ .CodeRay .code pre { overflow: auto }