rlzxdoc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -2,3 +2,8 @@
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+
6
+ ==0.0.2 2008-03-23
7
+
8
+ * 1 tiny enhancement:
9
+ * Sorted navigation by path / title
data/Manifest.txt CHANGED
@@ -9,6 +9,7 @@ config/requirements.rb
9
9
  lib/rlzxdoc.rb
10
10
  lib/rlzxdoc/lzxclass.rb
11
11
  lib/rlzxdoc/lzxfile.rb
12
+ lib/rlzxdoc/lzxfiles.rb
12
13
  lib/rlzxdoc/version.rb
13
14
  lib/templates/class.rhtml
14
15
  lib/templates/class_list.rhtml
@@ -0,0 +1,42 @@
1
+ #
2
+ # this class contains lzxfile classes.
3
+ #
4
+ #--
5
+ # author togawa manabu (togawamanabu@gmail.com)
6
+
7
+ module Rlzxdoc
8
+ class LzxFiles
9
+ include Enumerable
10
+
11
+ def initialize(locale)
12
+ @locale = locale
13
+ @lzx_classes = Array.new
14
+ end
15
+
16
+ def add(lzxfile_path)
17
+ p = LzxFile.new(lzxfile_path, @locale)
18
+ p.class_list.each{ |lzxclass|
19
+ lzxclass.hierarchy_depths = lzxfile_path.split("/").length
20
+ @lzx_classes << { :path => lzxfile_path, :class => lzxclass}
21
+ }
22
+ end
23
+
24
+ def [](index)
25
+ @lzx_classes[index]
26
+ end
27
+
28
+ def size
29
+ @lzx_classes.size
30
+ end
31
+
32
+ def each()
33
+ @lzx_classes.each{ |lzxclass|
34
+ yield(lzxclass)
35
+ }
36
+ end
37
+
38
+ def sort_by_path
39
+ @lzx_classes.sort!{ |a, b| a[:path] <=> b[:path]}
40
+ end
41
+ end
42
+ end
@@ -2,7 +2,7 @@ module Rlzxdoc #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/rlzxdoc.rb CHANGED
@@ -21,6 +21,7 @@ require "rdoc/usage"
21
21
 
22
22
  require "rlzxdoc/lzxclass"
23
23
  require "rlzxdoc/lzxfile"
24
+ require "rlzxdoc/lzxfiles"
24
25
 
25
26
  module Rlzxdoc
26
27
  # main
@@ -33,7 +34,7 @@ module Rlzxdoc
33
34
 
34
35
  @rlzxdoc_root = File.dirname(File.expand_path(__FILE__))
35
36
 
36
- @lzx_classes = Array.new
37
+ @lzx_classes = LzxFiles.new(@locale)
37
38
 
38
39
  expand_outputdir = File.expand_path(@outputdir)
39
40
 
@@ -46,12 +47,12 @@ module Rlzxdoc
46
47
 
47
48
  Dir::chdir(@basedir)
48
49
 
49
- Dir::glob("*.lzx").each{ |lzxfile| add_class_from_lzx(lzxfile) }
50
+ Dir::glob("*.lzx").each{ |lzxfile| @lzx_classes.add(lzxfile) }
50
51
 
51
52
  Dir::glob("**/").each { |dir|
52
53
  unless @exceptdirs.include?(File.dirname(dir).split("/").last)
53
54
  Dir::glob("#{dir}*.lzx").each {|lzxfile|
54
- Rlzxdoc.add_class_from_lzx(lzxfile)
55
+ @lzx_classes.add(lzxfile)
55
56
  }
56
57
  end
57
58
  }
@@ -82,17 +83,8 @@ module Rlzxdoc
82
83
  nav_erb = File.open(@rlzxdoc_root + '/templates/nav.rhtml') {|f| ERB.new(f.read)}
83
84
  File.open("#{expand_outputdir}/nav.html", "w"){ |file| file.puts nav_erb.result(binding)}
84
85
 
85
- #create class list html
86
+ #create class list
86
87
  class_list_erb = File.open(@rlzxdoc_root + '/templates/class_list.rhtml') { |f| ERB.new(f.read)}
87
88
  File.open("#{expand_outputdir}/classlist.html", "w"){ |file| file.puts class_list_erb.result(binding)}
88
89
  end
89
-
90
- private
91
- def Rlzxdoc.add_class_from_lzx(lzxfile_path)
92
- p = LzxFile.new(lzxfile_path, @locale)
93
- p.class_list.each{ |lzxclass|
94
- lzxclass.hierarchy_depths = lzxfile_path.split("/").length
95
- @lzx_classes << { :path => lzxfile_path, :class => lzxclass}
96
- }
97
- end
98
90
  end
@@ -17,9 +17,9 @@
17
17
  <li>
18
18
  <a target="content" href="classlist.html">Top</a>
19
19
  </li>
20
- <% @nav.each do |title, docs| %>
20
+ <% @nav.sort{ |a, b| a[0] <=> b[0] }.each do |title, docs| %>
21
21
  <li><%= title %><ul>
22
- <% docs.each do |doc| %>
22
+ <% docs.sort{ |a, b| a[:title] <=> b[:title] }.each do |doc| %>
23
23
  <li>
24
24
  <a target="content" href="<%= doc[:url] %>"><%= doc[:title] %></a>
25
25
  </li>
@@ -1,37 +1,6 @@
1
1
  <library>
2
2
  <!--- class comment -->
3
- <class name="class2" extends="view">
4
- <!--- a1 comment -->
5
- <attribute name="a1" value="t1" />
6
- <!--- @keywords private private -->
7
- <attribute name="a2" value="t2" />
8
- <!-- no doc comment -->
9
- <attribute name="a3" value="t3" />
10
-
11
- <!--- e1 event -->
12
- <event name="e1" />
13
-
14
- <!--- @keywords private private -->
15
- <event name="e2" />
16
-
17
- <!--- v1 comment -->
18
- <view name="v1" />
19
-
20
- <!--- @keywords private private -->
21
- <view name="v2" />
22
-
23
- <!--- m1 method -->
24
- <method name="m1" args="val1, val2">
25
- </method>
26
-
27
- <!--- @keywords private private -->
28
- <method name="m2">
29
- </method>
30
-
31
- <handler name="h1">
32
- </handler>
33
-
34
- <handler name="h2">
35
- </handler>
36
- </class>
3
+ <class name="class2" extends="view" />
4
+ <class name="class3" />
5
+ <class name="class4" />
37
6
  </library>
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require 'pp'
4
+
5
+ class TestMultiClass < Test::Unit::TestCase
6
+ def setup
7
+ @lzx_classes2 = Rlzxdoc::LzxFiles.new('ja')
8
+ @lzx_classes2.add("#{File.dirname(__FILE__)}/lzx/test2/class5.lzx")
9
+ @lzx_classes2.add("#{File.dirname(__FILE__)}/lzx/test2/aaa/class6.lzx")
10
+ @lzx_classes2.add("#{File.dirname(__FILE__)}/lzx/test1/class1.lzx")
11
+ end
12
+
13
+ def test_class
14
+ assert_equal(3, @lzx_classes2.size)
15
+ end
16
+
17
+ def test_sort_by_path
18
+ assert_equal("class5", @lzx_classes2[0][:class].classname)
19
+ assert_equal("class6", @lzx_classes2[1][:class].classname)
20
+ assert_equal("class1", @lzx_classes2[2][:class].classname)
21
+
22
+ @lzx_classes2.sort_by_path
23
+
24
+ assert_equal("class1", @lzx_classes2[0][:class].classname)
25
+ assert_equal("class6", @lzx_classes2[1][:class].classname)
26
+ assert_equal("class5", @lzx_classes2[2][:class].classname)
27
+ end
28
+ end
data/test/test_rlzxdoc.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestLzxFile < Test::Unit::TestCase
3
+ class TestRlzxdoc < Test::Unit::TestCase
4
4
  def setup
5
- @lzxclass = Rlzxdoc::LzxFile.new("#{File.dirname(__FILE__)}/lzx/test1/class1.lzx", 'ja').class_list
6
- @class1 = @lzxclass[0]
5
+ @lzx_classes = Rlzxdoc::LzxFiles.new('ja')
6
+ @lzx_classes.add("#{File.dirname(__FILE__)}/lzx/test1/class1.lzx")
7
+
8
+ @class1 = @lzx_classes[0][:class]
7
9
  end
8
10
 
9
11
  def test_class
10
- assert_not_nil(@lzxclass)
11
- assert(@lzxclass.size == 1)
12
+ assert_equal(1 , @lzx_classes.size)
12
13
 
13
- assert_equal(1, @lzxclass.size)
14
14
  assert_equal("class1", @class1.classname, "class name")
15
15
  assert_equal("class comment", @class1.classcomment, "class comment")
16
16
  assert_equal("view", @class1.extends)
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>rlzxdoc</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rlzxdoc"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/rlzxdoc" class="numbers">0.0.1</a>
36
+ <a href="http://rubyforge.org/projects/rlzxdoc" class="numbers">0.0.2</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;rlzxdoc&#8217;</h1>
39
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rlzxdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ""
6
6
  authors:
7
7
  - togawa manabu
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-14 00:00:00 +09:00
12
+ date: 2008-03-24 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -38,6 +38,7 @@ files:
38
38
  - lib/rlzxdoc.rb
39
39
  - lib/rlzxdoc/lzxclass.rb
40
40
  - lib/rlzxdoc/lzxfile.rb
41
+ - lib/rlzxdoc/lzxfiles.rb
41
42
  - lib/rlzxdoc/version.rb
42
43
  - lib/templates/class.rhtml
43
44
  - lib/templates/class_list.rhtml
@@ -92,4 +93,5 @@ specification_version: 2
92
93
  summary: lzxdoc tool by
93
94
  test_files:
94
95
  - test/test_helper.rb
96
+ - test/test_multiclass.rb
95
97
  - test/test_rlzxdoc.rb