lazibi 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +44 -2
- data/History.txt +10 -1
- data/Manifest.txt +114 -91
- data/README.txt +4 -125
- data/Rakefile +20 -10
- data/config/lazibi_config_template.rb +15 -0
- data/lib/core/beautify_engine.rb +10 -0
- data/lib/core/default_engine.rb +11 -0
- data/lib/core/engine_base.rb +74 -0
- data/lib/filter/beautify_filter.rb +148 -0
- data/lib/filter/filter_base.rb +19 -0
- data/lib/filter/optional_do_filter.rb +66 -0
- data/lib/filter/optional_end_filter.rb +124 -0
- data/lib/filter/syntax_guard_filter.rb +77 -0
- data/lib/helper/application_helper.rb +9 -0
- data/lib/helper/beautify_filter_helper.rb +52 -0
- data/lib/helper/filter_helper.rb +133 -0
- data/lib/helper/task_helper.rb +53 -45
- data/lib/lazibi.rb +1 -4
- data/lib/lazibi/version.rb +1 -1
- data/lib/task.rb +41 -32
- data/spec/core/beautify_engine_spec.rb +12 -0
- data/spec/core/default_engine_spec.rb +28 -0
- data/spec/core/engine_base_spec.rb +23 -0
- data/spec/filter/beautify_filter_spec.rb +64 -0
- data/spec/filter/filter_spec_helper.rb +9 -0
- data/spec/filter/optional_do_filter_spec.rb +56 -0
- data/spec/filter/optional_end_filter_spec.rb +84 -0
- data/spec/filter/syntax_guard_filter_spec.rb +35 -0
- data/spec/fixtures/beautify/metas/square_brackets.txt +6 -0
- data/{test/fixtures/functional/ruby → spec/fixtures/beautify/rbs}/square_brackets.txt +1 -1
- data/{test → spec}/fixtures/clean/comment_break.txt +0 -0
- data/{test → spec}/fixtures/clean/complex_string.txt +0 -0
- data/{test → spec}/fixtures/clean/end_concat.txt +0 -0
- data/{test → spec}/fixtures/clean/long_indent.txt +0 -0
- data/{test → spec}/fixtures/clean/mixed_re.txt +0 -0
- data/{test → spec}/fixtures/clean/only_if.txt +0 -0
- data/{test → spec}/fixtures/clean/re.txt +0 -0
- data/{test → spec}/fixtures/clean/semi_colon_after_end.txt +0 -0
- data/{test → spec}/fixtures/clean/sep_line.txt +0 -0
- data/{test → spec}/fixtures/clean/unless_problem.txt +0 -0
- data/{test → spec}/fixtures/meta/basic_class.txt +0 -0
- data/{test → spec}/fixtures/meta/case.txt +0 -0
- data/{test → spec}/fixtures/meta/class_with_def.txt +0 -0
- data/{test → spec}/fixtures/meta/comment.txt +0 -0
- data/{test → spec}/fixtures/meta/comment_after_end.txt +0 -0
- data/{test → spec}/fixtures/meta/eval_code.txt +0 -0
- data/{test → spec}/fixtures/meta/here_doc.txt +0 -0
- data/{test → spec}/fixtures/meta/inline_do_end.txt +0 -0
- data/{test → spec}/fixtures/meta/inline_end.txt +0 -0
- data/{test → spec}/fixtures/meta/loop.txt +0 -0
- data/{test → spec}/fixtures/meta/middle.txt +0 -0
- data/{test → spec}/fixtures/meta/multi_blocks.txt +0 -0
- data/{test → spec}/fixtures/meta/nested_comment.txt +0 -0
- data/{test → spec}/fixtures/meta/optional_do.txt +0 -0
- data/{test → spec}/fixtures/meta/optional_do_with_nasty_chars.txt +0 -0
- data/{test → spec}/fixtures/meta/partial_method.txt +0 -0
- data/{test → spec}/fixtures/meta/single_method.txt +0 -0
- data/{test → spec}/fixtures/meta/two_methods.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/brackets_block.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/classical.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/describe.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/do_block.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/lambda.txt +0 -0
- data/{test/fixtures/functional/simply → spec/fixtures/optional_do/metas}/square_brackets.txt +2 -2
- data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/brackets_block.txt +0 -0
- data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/classical.txt +0 -0
- data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/describe.txt +0 -0
- data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/do_block.txt +0 -0
- data/{test/fixtures/functional/ruby → spec/fixtures/optional_do/rbs}/lambda.txt +0 -0
- data/spec/fixtures/optional_do/rbs/square_brackets.txt +6 -0
- data/{test → spec}/fixtures/real/basic_class.txt +0 -0
- data/{test → spec}/fixtures/real/case.txt +0 -0
- data/{test → spec}/fixtures/real/class_with_def.txt +0 -0
- data/{test → spec}/fixtures/real/comment.txt +0 -0
- data/{test → spec}/fixtures/real/comment_after_end.txt +0 -0
- data/{test → spec}/fixtures/real/comment_after_end_expected.txt +0 -0
- data/{test → spec}/fixtures/real/comment_break.txt +0 -0
- data/{test → spec}/fixtures/real/complex_string.txt +0 -0
- data/{test → spec}/fixtures/real/end_concat.txt +0 -0
- data/{test → spec}/fixtures/real/eval_code.txt +0 -0
- data/{test → spec}/fixtures/real/general_eval.txt +0 -0
- data/{test → spec}/fixtures/real/here_doc.txt +0 -0
- data/{test → spec}/fixtures/real/inline_do_end.txt +0 -0
- data/{test → spec}/fixtures/real/inline_end.txt +0 -0
- data/{test → spec}/fixtures/real/javascript.txt +0 -0
- data/{test → spec}/fixtures/real/long_indent.txt +0 -0
- data/{test → spec}/fixtures/real/loop.txt +0 -0
- data/{test → spec}/fixtures/real/middle.txt +0 -0
- data/{test → spec}/fixtures/real/mixed_re.txt +0 -0
- data/{test → spec}/fixtures/real/multi_blocks.txt +0 -0
- data/{test → spec}/fixtures/real/nested_comment.txt +0 -0
- data/{test → spec}/fixtures/real/only_if.txt +0 -0
- data/{test → spec}/fixtures/real/optional_do.txt +0 -0
- data/{test → spec}/fixtures/real/optional_do_with_nasty_chars.txt +0 -0
- data/{test → spec}/fixtures/real/partial_method.txt +0 -0
- data/{test → spec}/fixtures/real/re.txt +0 -0
- data/{test → spec}/fixtures/real/semi_colon_after_end.txt +0 -0
- data/{test → spec}/fixtures/real/sep_line.txt +0 -0
- data/{test → spec}/fixtures/real/single_method.txt +0 -0
- data/{test → spec}/fixtures/real/strange_syntax_1.txt +0 -0
- data/{test → spec}/fixtures/real/two_methods.txt +0 -0
- data/{test → spec}/fixtures/real/unless_problem.txt +0 -0
- data/spec/helper/filter_helper_spec.rb +35 -0
- data/spec/helper/task_helper_spec.rb +21 -0
- data/spec/lazibi_spec.rb +22 -0
- data/spec/spec_helper.rb +16 -0
- data/webgen/src/code/examples/migration.py.rb +10 -0
- data/webgen/src/code/examples/rspec.py.rb +7 -0
- data/webgen/src/css/blossom_base.css +172 -0
- data/webgen/src/css/blossom_v05.css +48 -0
- data/webgen/src/css/code.css +32 -0
- data/webgen/src/css/hack.css +13 -0
- data/webgen/src/css/print.css +178 -0
- data/webgen/src/default.template +90 -0
- data/webgen/src/development.page +19 -0
- data/webgen/src/documentation.page +44 -0
- data/webgen/src/faq.page +42 -0
- data/webgen/src/images/cover_landscape.jpg +0 -0
- data/webgen/src/images/example_picture03.jpg +0 -0
- data/webgen/src/images/example_picture04.jpg +0 -0
- data/webgen/src/index.page +45 -0
- data/webgen/src/installation.page +17 -0
- metadata +214 -175
- data/coverage/index.html +0 -476
- data/coverage/lib-helper-parser_helper_rb.html +0 -718
- data/coverage/lib-helper-task_helper_rb.html +0 -684
- data/coverage/lib-lazibi-version_rb.html +0 -640
- data/coverage/lib-lazibi_rb.html +0 -664
- data/coverage/lib-parser_rb.html +0 -787
- data/coverage/lib-task_rb.html +0 -751
- data/lib/helper/app_helper.rb +0 -0
- data/lib/helper/parser_helper.rb +0 -92
- data/lib/parser.rb +0 -194
- data/lib/vendor/beautifier.rb +0 -278
- data/test/test_functional.rb +0 -75
- data/test/test_helper.rb +0 -7
- data/test/test_unit.rb +0 -151
- data/website/index.html +0 -234
- data/website/index.txt +0 -135
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -140
- data/website/template.rhtml +0 -48
data/test/test_functional.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'pp'
|
3
|
-
|
4
|
-
class TestLazibiFunctional < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
# load fixtures
|
8
|
-
@ruby = {}
|
9
|
-
@beauty = {}
|
10
|
-
@simply = {}
|
11
|
-
|
12
|
-
ruby_dir = File.dirname(__FILE__) + '/fixtures/functional/ruby'
|
13
|
-
Dir.open(ruby_dir).each do |fn|
|
14
|
-
next unless fn =~ /[.]txt$/
|
15
|
-
@ruby[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(ruby_dir + "/#{fn}")
|
16
|
-
end
|
17
|
-
|
18
|
-
beauty_dir = File.dirname(__FILE__) + '/fixtures/functional/beauty'
|
19
|
-
Dir.open(beauty_dir).each do |fn|
|
20
|
-
next unless fn =~ /[.]txt$/
|
21
|
-
@beauty[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(beauty_dir + "/#{fn}")
|
22
|
-
end
|
23
|
-
|
24
|
-
simply_dir = File.dirname(__FILE__) + '/fixtures/functional/simply'
|
25
|
-
Dir.open(simply_dir).each do |fn|
|
26
|
-
next unless fn =~ /[.]txt$/
|
27
|
-
@simply[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(simply_dir + "/#{fn}")
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
@r = Lazibi::Runner.new
|
32
|
-
@r.load_config
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_config_load
|
36
|
-
assert @r.config[:exclude]
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_exclude_option
|
40
|
-
assert @r.skip_path?('meta/vendor')
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_optional_do_for_spec
|
44
|
-
filters = @r.get_filters('meta/spec')
|
45
|
-
assert filters.include?(:optional_do)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_spec_sample
|
49
|
-
assert_equal @r.to_py('it do', [:optional_do]), 'it'
|
50
|
-
assert_equal @r.to_rb("it\n abc", [:optional_do]), "it do\n abc\nend"
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_no_spec_sample
|
54
|
-
assert_equal @r.to_py('it do' ), 'it do'
|
55
|
-
assert_equal @r.to_rb("it\n abc" ), "it\n abc"
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_optional_do_filter
|
59
|
-
list = [:classical, :lambda, :brackets_block, :describe, :square_brackets, :do_block]
|
60
|
-
for token in list
|
61
|
-
assert_filter :optional_do, token
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
def assert_filter( filters, name )
|
67
|
-
if filters.class == 'Array'
|
68
|
-
f = filters
|
69
|
-
else
|
70
|
-
f = [filters]
|
71
|
-
end
|
72
|
-
assert_equal @r.to_py(@ruby[name], f), @simply[name]
|
73
|
-
assert_equal @r.to_rb(@simply[name], f), @ruby[name]
|
74
|
-
end
|
75
|
-
end
|
data/test/test_helper.rb
DELETED
data/test/test_unit.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'pp'
|
3
|
-
|
4
|
-
class TestLazibiUnit < Test::Unit::TestCase
|
5
|
-
attr :fixtures, :expected
|
6
|
-
|
7
|
-
def setup
|
8
|
-
|
9
|
-
# load fixtures
|
10
|
-
@meta = {}
|
11
|
-
@real = {}
|
12
|
-
@clean = {}
|
13
|
-
|
14
|
-
fixture_dir = File.dirname(__FILE__) + '/fixtures/meta'
|
15
|
-
Dir.open(fixture_dir).each do |fn|
|
16
|
-
next unless fn =~ /[.]txt$/
|
17
|
-
@meta[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(fixture_dir + "/#{fn}")
|
18
|
-
end
|
19
|
-
|
20
|
-
expected_dir = File.dirname(__FILE__) + '/fixtures/real'
|
21
|
-
Dir.open(expected_dir).each do |fn|
|
22
|
-
next unless fn =~ /[.]txt$/
|
23
|
-
@real[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(expected_dir + "/#{fn}")
|
24
|
-
end
|
25
|
-
|
26
|
-
clean_dir = File.dirname(__FILE__) + '/fixtures/clean'
|
27
|
-
Dir.open(clean_dir).each do |fn|
|
28
|
-
next unless fn =~ /[.]txt$/
|
29
|
-
@clean[fn.scan(/(.*)[.]/).to_s.to_sym] = File.read(clean_dir + "/#{fn}")
|
30
|
-
end
|
31
|
-
|
32
|
-
@r = Lazibi::Runner.new
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def test_start_anchor?
|
37
|
-
assert @r.start_anchor?( 'class' )
|
38
|
-
assert @r.start_anchor?( 'do |abc| ')
|
39
|
-
assert @r.start_anchor?( 'do |abc,def| ')
|
40
|
-
assert !@r.start_anchor?( '"abc do "')
|
41
|
-
assert !@r.start_anchor?( '"abc do |"')
|
42
|
-
assert !@r.start_anchor?( 'lambda')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_middle_anchor?
|
46
|
-
assert !@r.middle_anchor?( '' )
|
47
|
-
assert @r.middle_anchor?( 'rescue' )
|
48
|
-
assert !@r.middle_anchor?( 'lambda')
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_end_anchor?
|
52
|
-
assert !@r.end_anchor?( 'lambda' )
|
53
|
-
end
|
54
|
-
def test_find_end
|
55
|
-
assert_find :basic_class, 0, 0
|
56
|
-
assert_find :class_with_def, 0, 1
|
57
|
-
assert_find :class_with_def, 0, 1
|
58
|
-
assert @r.find_end(@meta[:class_with_def].split("\n")[1..-1], 2 ) == 0
|
59
|
-
assert_find :two_methods, 0, 3
|
60
|
-
assert @r.find_end(@meta[:two_methods].split("\n")[1..-1], 2) == 0
|
61
|
-
assert_find :partial_method, 2, 0
|
62
|
-
assert_find :middle, 0, 1
|
63
|
-
assert_find :multi_blocks, 0, 7
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_convert_path
|
67
|
-
assert @r.convert_path( 'meta/abc.py.rb' ) == 'real/abc.rb', @r.convert_path('meta/abc.rb')
|
68
|
-
assert @r.convert_path( 'real/abc.rb' ) == 'meta/abc.py.rb'
|
69
|
-
assert @r.convert_path( 'meta/lib/abc.py.rb' ) == 'real/lib/abc.rb'
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_convert_content
|
73
|
-
@meta.keys.reject{|k| ['partial_method', 'inline_end', 'optional_do',
|
74
|
-
'eval_code', 'here_doc', 'single_method', 'comment_after_end'].include? k.to_s }.each do |k|
|
75
|
-
assert_convert k
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_to_rb
|
80
|
-
assert_to_rb :partial_method
|
81
|
-
# assert_to_rb :optional_do
|
82
|
-
assert_to_rb :eval_code
|
83
|
-
assert_to_rb :comment_after_end, :comment_after_end_expected
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_to_py
|
87
|
-
assert_to_py :inline_end
|
88
|
-
assert_to_py :comment_after_end
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_skip
|
92
|
-
assert_skip :eval_code
|
93
|
-
assert_skip :here_doc
|
94
|
-
assert_skip :single_method
|
95
|
-
assert_skip :general_eval
|
96
|
-
assert_skip :javascript
|
97
|
-
assert_skip :strange_syntax_1
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_beauty
|
101
|
-
@clean.keys.each do |k|
|
102
|
-
assert_beauty k
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
def test_clean
|
108
|
-
assert_clean 'str.gsub(/([^ \/a-zA-Z0-9_.-])/n)', 'str.gsub(//n)'
|
109
|
-
assert_clean '%r{\A#{Regexp.escape(expanded_root)}(/|\\)}', "''"
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
def test_check_comment
|
114
|
-
assert @r.comment_at_end(' dab #abcd')
|
115
|
-
end
|
116
|
-
private
|
117
|
-
def assert_find( name, indent, end_i )
|
118
|
-
assert_equal @r.find_end(@meta[name].split("\n"), indent), end_i
|
119
|
-
end
|
120
|
-
|
121
|
-
def assert_to_rb( name, name_2 = nil )
|
122
|
-
name_2 = name unless name_2
|
123
|
-
assert_equal @r.to_rb( @meta[name]), @real[name_2], name
|
124
|
-
end
|
125
|
-
|
126
|
-
def assert_to_py( name, name_2 = nil )
|
127
|
-
name_2 = name unless name_2
|
128
|
-
assert_equal @r.to_py( @real[name]), @meta[name_2], name
|
129
|
-
end
|
130
|
-
|
131
|
-
def assert_convert( name )
|
132
|
-
assert_to_rb(name)
|
133
|
-
assert_to_py(name)
|
134
|
-
end
|
135
|
-
|
136
|
-
def assert_identity( s )
|
137
|
-
assert_equal @r.to_rb( @r.to_py( s ) ), s
|
138
|
-
end
|
139
|
-
|
140
|
-
def assert_beauty( name )
|
141
|
-
assert_equal Beautifier::ruby(@real[name]), @clean[name], name
|
142
|
-
end
|
143
|
-
|
144
|
-
def assert_skip( name )
|
145
|
-
assert_equal Beautifier::ruby(@real[name]), false, name
|
146
|
-
end
|
147
|
-
|
148
|
-
def assert_clean( line, exp )
|
149
|
-
assert_equal Beautifier::clean_line( line ).to_s, exp, line
|
150
|
-
end
|
151
|
-
end
|
data/website/index.html
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>
|
8
|
-
Welcome to Lazibi
|
9
|
-
</title>
|
10
|
-
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
-
<style>
|
12
|
-
|
13
|
-
</style>
|
14
|
-
<script type="text/javascript">
|
15
|
-
window.onload = function() {
|
16
|
-
settings = {
|
17
|
-
tl: { radius: 10 },
|
18
|
-
tr: { radius: 10 },
|
19
|
-
bl: { radius: 10 },
|
20
|
-
br: { radius: 10 },
|
21
|
-
antiAlias: true,
|
22
|
-
autoPad: true,
|
23
|
-
validTags: ["div"]
|
24
|
-
}
|
25
|
-
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
-
versionBox.applyCornersToAll();
|
27
|
-
}
|
28
|
-
</script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="main">
|
32
|
-
|
33
|
-
<h1>Welcome to Lazibi</h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/lazibi"; return false'>
|
35
|
-
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/lazibi" class="numbers">0.1.13</a>
|
37
|
-
</div>
|
38
|
-
<p>
|
39
|
-
Lazibi is a preprocessor that allows you to use Python style indentation in
|
40
|
-
Ruby.
|
41
|
-
</p>
|
42
|
-
<p>
|
43
|
-
The idea is to edit .py.rb files in a meta directory and let the engine
|
44
|
-
generates .rb files in the real directory for you in real time.
|
45
|
-
</p>
|
46
|
-
<h2>Examples</h2>
|
47
|
-
<p>
|
48
|
-
Sweeter RSpec [ Thanks Jay ]
|
49
|
-
</p>
|
50
|
-
<pre>
|
51
|
-
describe Bowling
|
52
|
-
before(:each)
|
53
|
-
@bowling = Bowling.new
|
54
|
-
|
55
|
-
it "should score 0 for gutter game"
|
56
|
-
20.times { @bowling.hit(0) }
|
57
|
-
@bowling.score.should == 0
|
58
|
-
</pre>
|
59
|
-
<p>
|
60
|
-
More DIY Rails controller
|
61
|
-
</p>
|
62
|
-
<pre>
|
63
|
-
class AuctionsController < ApplicationController
|
64
|
-
|
65
|
-
def index
|
66
|
-
@auctions = Auction.paginate :page => params[:page]
|
67
|
-
|
68
|
-
respond_to do |format|
|
69
|
-
format.html # index.rhtml
|
70
|
-
format.xml { render :xml => @auctions.to_xml }
|
71
|
-
</pre>
|
72
|
-
<p>
|
73
|
-
Even sexier migrations ( with sexy_migration Rails plugin )
|
74
|
-
</p>
|
75
|
-
<pre>
|
76
|
-
class CreateOrders < ActiveRecord::Migration
|
77
|
-
def self.up
|
78
|
-
create_table :orders do
|
79
|
-
fkey :user
|
80
|
-
fkey :auction
|
81
|
-
integer :bid_type
|
82
|
-
timestamps!
|
83
|
-
|
84
|
-
def self.down
|
85
|
-
drop_table :orders
|
86
|
-
</pre>
|
87
|
-
<h2>Download</h2>
|
88
|
-
<pre>
|
89
|
-
gem install lazibi
|
90
|
-
svn checkout svn://rubyforge.org/var/svn/lazibi/trunk lazibi
|
91
|
-
</pre>
|
92
|
-
<h2>Usage</h2>
|
93
|
-
<p>
|
94
|
-
Bootstrap
|
95
|
-
</p>
|
96
|
-
<pre>
|
97
|
-
mkdir shiny_project
|
98
|
-
cd shiny_project
|
99
|
-
# put trunk in real
|
100
|
-
svn co $svn_path/shiny_project/trunk real
|
101
|
-
lazibi
|
102
|
-
</pre>
|
103
|
-
<p>
|
104
|
-
Make sure everything still works
|
105
|
-
</p>
|
106
|
-
<pre>
|
107
|
-
_start_a_new_terminal_
|
108
|
-
cd shiny_project/real
|
109
|
-
rake test / autotest
|
110
|
-
</pre>
|
111
|
-
<p>
|
112
|
-
Start hacking in meta :/
|
113
|
-
</p>
|
114
|
-
<pre>
|
115
|
-
cd shiny_project
|
116
|
-
$your_editor meta
|
117
|
-
</pre>
|
118
|
-
<h2>Tips</h2>
|
119
|
-
<h3>Manually create meta files</h3>
|
120
|
-
<ul>
|
121
|
-
<li>Bootstrap your project as usual, just don’t run lazibi
|
122
|
-
|
123
|
-
</li>
|
124
|
-
<li>setup environment
|
125
|
-
|
126
|
-
<pre>
|
127
|
-
mkdir .backup
|
128
|
-
mkdir meta
|
129
|
-
</pre>
|
130
|
-
</li>
|
131
|
-
<li>run lazibi
|
132
|
-
|
133
|
-
</li>
|
134
|
-
<li>create .py.rb files in corresponding directories inside ‘meta’,
|
135
|
-
.rb files will be created and updated in ‘real’ as usual
|
136
|
-
|
137
|
-
</li>
|
138
|
-
</ul>
|
139
|
-
<h3>Prevent certain directories from being parsed during bootstrap ( default is ^vendor )</h3>
|
140
|
-
<ul>
|
141
|
-
<li>Create .lazibi in project/real path
|
142
|
-
|
143
|
-
<pre>
|
144
|
-
exclude:
|
145
|
-
- ^vendor
|
146
|
-
- ^tmp
|
147
|
-
- etc
|
148
|
-
</pre>
|
149
|
-
</li>
|
150
|
-
</ul>
|
151
|
-
<h3>RSpec taste</h3>
|
152
|
-
<ul>
|
153
|
-
<li>Optional do is only enabled for spec directory. You can customize this
|
154
|
-
behavior by editing .lazibi config file.
|
155
|
-
|
156
|
-
<pre>
|
157
|
-
filters:
|
158
|
-
optional_do:
|
159
|
-
- ^spec
|
160
|
-
- ^test
|
161
|
-
- etc
|
162
|
-
</pre>
|
163
|
-
</li>
|
164
|
-
<li>Personally I would not recommend using this filter outside the context of
|
165
|
-
RSpec
|
166
|
-
|
167
|
-
<ul>
|
168
|
-
<li>It’s not well tested
|
169
|
-
|
170
|
-
</li>
|
171
|
-
<li>Anything more complex then simple description will get unreadable
|
172
|
-
|
173
|
-
</li>
|
174
|
-
</ul>
|
175
|
-
</li>
|
176
|
-
</ul>
|
177
|
-
<h2>In Practice</h2>
|
178
|
-
<p>
|
179
|
-
Lazibi is written using Lazibi itself ( incrementally ). Personally I think
|
180
|
-
autotest from http://www.zenspider.com/ZSS/Products/ZenTest/ is a must
|
181
|
-
have, and Lazibi works pretty well using TDD.
|
182
|
-
</p>
|
183
|
-
<p>
|
184
|
-
A few projects are used as test code:
|
185
|
-
</p>
|
186
|
-
<pre>
|
187
|
-
ActiveRecord, ActionMailer, ActionPack, ActiveSupport, Mongrel, RSpec, redMine.
|
188
|
-
</pre>
|
189
|
-
<p>
|
190
|
-
Lazibi was used to generate .py.rb files from these projects, and then to
|
191
|
-
.rb files back ( this is the default process ). Tests were then run to
|
192
|
-
ensure compatibility.
|
193
|
-
</p>
|
194
|
-
<h2>Known issues</h2>
|
195
|
-
<p>
|
196
|
-
Here docs, eval, javascript related libs, and complex string evaluation are
|
197
|
-
currently not supported. Ruby code with above syntax will be preserved as
|
198
|
-
is. So your code should still works, just no parse. In other words, if you
|
199
|
-
don’t want your code to be parsed, simply add a dummy here doc
|
200
|
-
string…
|
201
|
-
</p>
|
202
|
-
<h2>Talk</h2>
|
203
|
-
<p>
|
204
|
-
http://groups.google.com/group/lazibi-talk
|
205
|
-
</p>
|
206
|
-
<h2>To Do</h2>
|
207
|
-
<ul>
|
208
|
-
<li>Maybe a custom filter for RSpec runner? Still learning though…
|
209
|
-
|
210
|
-
</li>
|
211
|
-
<li>Two way sync between real and meta
|
212
|
-
|
213
|
-
</li>
|
214
|
-
</ul>
|
215
|
-
<h2>Author</h2>
|
216
|
-
<ul>
|
217
|
-
<li>Jinjing (mailto:nfjinjing@gmail.com)
|
218
|
-
|
219
|
-
</li>
|
220
|
-
</ul>
|
221
|
-
<p>
|
222
|
-
Released under the MIT license (included)
|
223
|
-
</p>
|
224
|
-
|
225
|
-
<p class="coda">
|
226
|
-
<a href="mailto:nfjinjing@gmail.com">Jinjing</a>, 21st June 2007<br>
|
227
|
-
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
228
|
-
</p>
|
229
|
-
</div>
|
230
|
-
|
231
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
232
|
-
|
233
|
-
</body>
|
234
|
-
</html>
|