wpdoc 0.2.17 → 0.2.20

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ begin
28
28
  gem.email = "voloko@gmail.com"
29
29
  gem.homepage = "http://github.com/dxw/wpdoc"
30
30
  gem.authors = ["Volodya Kolesnikov"]
31
- gem.add_dependency("rdoc", ">= 2.4.2")
31
+ gem.add_dependency("rdoc", "= 2.4.3")
32
32
 
33
33
  if defined?(JRUBY_VERSION)
34
34
  gem.platform = Gem::Platform.new(['universal', 'java', nil])
@@ -47,5 +47,5 @@ begin
47
47
  symlink File.expand_path('.'), path
48
48
  end
49
49
  rescue LoadError
50
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
50
+ puts "Jeweler not available. Install it with: (sudo) gem install jeweler"
51
51
  end
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 17
2
+ :patch: 20
3
3
  :major: 0
4
4
  :build:
5
5
  :minor: 2
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+
3
+ ## undefined method `to_json' for Array :(
4
+ # if Gem.available? "yajl-ruby"
5
+ # gem "yajl-ruby", ">= 0.7.6"
6
+ # require "yajl"
7
+ # warn "yajl"
8
+ # else
9
+ if Gem.available? "json"
10
+ gem "json", ">= 1.1.3"
11
+ else
12
+ gem "json_pure", ">= 1.1.3"
13
+ end
14
+ require "json"
15
+ # end
@@ -1,6 +1,5 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
  require "rubygems"
3
- gem "rdoc", ">= 2.4.2"
4
3
 
5
4
  require "rdoc/rdoc"
6
5
 
@@ -1,13 +1,5 @@
1
- require 'rubygems'
2
- gem "rdoc", ">= 2.4.2"
3
- if Gem.available? "json"
4
- gem "json", ">= 1.1.3"
5
- else
6
- gem "json_pure", ">= 1.1.3"
7
- end
8
-
1
+ require 'sdoc/json_backend'
9
2
  require 'iconv'
10
- require 'json'
11
3
  require 'pathname'
12
4
  require 'fileutils'
13
5
  require 'erb'
@@ -123,7 +115,7 @@ class RDoc::Generator::SHtml
123
115
  tree = generate_file_tree + generate_class_tree_level(topclasses)
124
116
  debug_msg " writing class tree to %s" % TREE_FILE
125
117
  File.open(TREE_FILE, "w", 0644) do |f|
126
- f.write('var tree = '); f.write(tree.to_json)
118
+ f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
127
119
  end unless $dryrun
128
120
  end
129
121
 
@@ -162,7 +154,7 @@ class RDoc::Generator::SHtml
162
154
  :index => index
163
155
  }
164
156
  File.open(SEARCH_INDEX_FILE, "w", 0644) do |f|
165
- f.write('var search_data = '); f.write(data.to_json)
157
+ f.write('var search_data = '); f.write(data.to_json(:max_nesting => 0))
166
158
  end unless $dryrun
167
159
  end
168
160
 
@@ -295,11 +287,11 @@ class RDoc::Generator::SHtml
295
287
  content = content.sub(/^(.{100,}?)\s.*/m, "\\1").gsub(/\r?\n/m, ' ')
296
288
 
297
289
  begin
298
- content.to_json
290
+ content.to_json(:max_nesting => 0)
299
291
  rescue # might fail on non-unicode string
300
292
  begin
301
293
  content = Iconv.conv('latin1//ignore', "UTF8", content) # remove all non-unicode chars
302
- content.to_json
294
+ content.to_json(:max_nesting => 0)
303
295
  rescue
304
296
  content = '' # something hugely wrong happend
305
297
  end
@@ -31,7 +31,7 @@
31
31
  end
32
32
  %>
33
33
  <% unless list.empty? %>
34
- <div class="sectiontitle">Methods</div>
34
+ <div class="sectiontitle">Functions</div>
35
35
  <dl class="methods">
36
36
  <% each_letter_group(list) do |group| %>
37
37
  <dt><%= group[:name] %></dt>
@@ -72,10 +72,10 @@
72
72
  <% end %>
73
73
 
74
74
  <% unless context.classes_and_modules.empty? %>
75
- <div class="sectiontitle">Classes and Modules</div>
75
+ <div class="sectiontitle"><%= context.full_name == 'Global' ? 'Index' : 'Classes and Modules' %></div>
76
76
  <ul>
77
77
  <% (context.modules.sort + context.classes.sort).each do |mod| %>
78
- <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a></li>
78
+ <li><span class="type"><%= context.full_name == 'Global' ? '' : mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= context.full_name == 'Global' ? mod.name : mod.full_name %></a></li>
79
79
  <% end %>
80
80
  </ul>
81
81
  <% end %>
@@ -120,7 +120,7 @@
120
120
  next if methods.empty?
121
121
  next unless @options.show_all || visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
122
122
  %>
123
- <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
123
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> functions</div>
124
124
  <% methods.each do |method| %>
125
125
  <div class="method">
126
126
  <div class="title" id="<%= method.aref %>">
@@ -137,7 +137,7 @@
137
137
  <% end %>
138
138
  <% unless method.aliases.empty? %>
139
139
  <div class="aka">
140
- This method is also aliased as
140
+ This function is also aliased as
141
141
  <% method.aliases.each do |aka| %>
142
142
  <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
143
143
  <% end %>
@@ -14,26 +14,31 @@
14
14
 
15
15
  <body>
16
16
  <div class="banner">
17
- <h1>
18
- <% if klass.full_name != 'Global' %>
19
- <span class="type"><%= klass.module? ? 'Module' : 'Class' %></span>
20
- <% end %>
21
- <%= h klass.full_name %>
22
- <% if klass.type == 'class' && !klass.superclass.nil? %>
23
- <span class="parent">&lt;
24
- <% if String === klass.superclass %>
25
- <%= klass.superclass %>
26
- <% elsif !klass.superclass.nil? %>
27
- <a href="<%= klass.aref_to klass.superclass.path %>"><%= h klass.superclass.full_name %></a>
28
- <% end %>
29
- </span>
30
- <% end %>
31
- </h1>
32
- <ul class="files">
33
- <% klass.in_files.each do |file| %>
34
- <li><a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a></li>
35
- <% end %>
36
- </ul>
17
+ <div class="grr_container">
18
+ <h1>
19
+ <% if klass.parent && klass.parent.full_name != 'Global' && klass.full_name != 'Global' %>
20
+ <span class="type"><%= klass.module? ? 'Module' : 'Class' %></span>
21
+ <% end %>
22
+ <%= h klass.full_name %>
23
+ <% if klass.type == 'class' && !klass.superclass.nil? %>
24
+ <span class="parent">&lt;
25
+ <% if String === klass.superclass %>
26
+ <%= klass.superclass %>
27
+ <% elsif !klass.superclass.nil? %>
28
+ <a href="<%= klass.aref_to klass.superclass.path %>"><%= h klass.superclass.full_name %></a>
29
+ <% end %>
30
+ </span>
31
+ <% end %>
32
+ </h1>
33
+ <ul class="files">
34
+ <% klass.in_files.each do |file| %>
35
+ <li><a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a></li>
36
+ <% end %>
37
+ </ul>
38
+ </div>
39
+ <div class="logo">
40
+ <a target="_blank" href="http://thedextrousweb.com">The Dextrous Web</a>
41
+ </div>
37
42
  </div>
38
43
  <div id="bodyContent">
39
44
  <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
@@ -14,17 +14,22 @@
14
14
 
15
15
  <body>
16
16
  <div class="banner">
17
- <h1>
18
- <%= h file.name %>
19
- </h1>
20
- <ul class="files">
21
- <li><%= h file.relative_name %></li>
22
- <li>Last modified: <%= file.file_stat.mtime %></li>
23
- </ul>
17
+ <div class="grr_container">
18
+ <h1>
19
+ <%= h file.name %>
20
+ </h1>
21
+ <ul class="files">
22
+ <li><%= h file.relative_name %></li>
23
+ <li>Last modified: <%= file.file_stat.mtime %></li>
24
+ </ul>
25
+ </div>
26
+ <div class="logo">
27
+ <a target="_blank" href="http://thedextrousweb.com">The Dextrous Web</a>
28
+ </div>
24
29
  </div>
25
30
 
26
31
  <div id="bodyContent">
27
32
  <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
28
33
  </div>
29
34
  </body>
30
- </html>
35
+ </html>
@@ -105,7 +105,13 @@ ol li
105
105
  background: #EDF3FE;
106
106
  border-bottom: 1px solid #ccc;
107
107
  padding: 1em 2em 0.5em 2em;
108
+ overflow: auto;
108
109
  }
110
+ .banner .grr_container
111
+ {
112
+ float: left
113
+ }
114
+
109
115
  .banner h1
110
116
  {
111
117
  font-size: 1.2em;
@@ -138,6 +144,16 @@ ol li
138
144
  margin-bottom: 0;
139
145
  }
140
146
 
147
+ .banner div.logo a
148
+ {
149
+ background: url(../dextrous_web.png);
150
+ text-indent: -9999px;
151
+ width: 292px;
152
+ height: 62px;
153
+ float: right;
154
+ margin-bottom: 0.5em
155
+ }
156
+
141
157
  pre
142
158
  {
143
159
  margin-bottom: 1em;
@@ -18,10 +18,16 @@ module SDoc::GitHub
18
18
  end
19
19
 
20
20
  protected
21
-
21
+
22
+ def have_git?
23
+ @have_git = system('git --version > /dev/null 2>&1') if @have_git.nil?
24
+ @have_git
25
+ end
26
+
22
27
  def commit_sha1(path)
28
+ return false unless have_git?
23
29
  name = File.basename(path)
24
- s = in_dir(File.join(basedir, File.dirname(path))) do
30
+ s = Dir.chdir(File.join(basedir, File.dirname(path))) do
25
31
  `git log -1 --pretty=format:"commit %H" #{name}`
26
32
  end
27
33
  m = s.match(/commit\s+(\S+)/)
@@ -29,7 +35,8 @@ module SDoc::GitHub
29
35
  end
30
36
 
31
37
  def repository_url(path)
32
- s = in_dir(File.join(basedir, File.dirname(path))) do
38
+ return false unless have_git?
39
+ s = Dir.chdir(File.join(basedir, File.dirname(path))) do
33
40
  `git config --get remote.origin.url`
34
41
  end
35
42
  m = s.match(%r{github.com[/:](.*)\.git$})
@@ -50,15 +57,5 @@ module SDoc::GitHub
50
57
  path = File.dirname(path)
51
58
  end
52
59
  ''
53
- end
54
-
55
- def in_dir(dir)
56
- pwd = Dir.pwd
57
- Dir.chdir dir
58
- return yield
59
- rescue Exception => e
60
- return ''
61
- ensure
62
- Dir.chdir pwd
63
60
  end
64
61
  end
@@ -2,9 +2,7 @@ require 'optparse'
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
4
 
5
- gem 'json_pure', '>= 1.1.3' if defined?(::JRUBY_VERSION)
6
- require 'json'
7
-
5
+ require 'wpdoc/json_backend'
8
6
  require 'wpdoc/templatable'
9
7
 
10
8
  class SDoc::Merge
@@ -69,7 +67,7 @@ class SDoc::Merge
69
67
  url = @urls.empty? ? name : @urls[i]
70
68
  filename = File.join dir, RDoc::Generator::SHtml::TREE_FILE
71
69
  data = open(filename).read.sub(/var tree =\s*/, '')
72
- subtree = JSON.parse data, :max_nesting => 35
70
+ subtree = JSON.parse(data, :max_nesting => 0)
73
71
  item = [
74
72
  name,
75
73
  url + '/' + extract_index_path(dir),
@@ -82,7 +80,7 @@ class SDoc::Merge
82
80
  dst = File.join @op_dir, RDoc::Generator::SHtml::TREE_FILE
83
81
  FileUtils.mkdir_p File.dirname(dst)
84
82
  File.open(dst, "w", 0644) do |f|
85
- f.write('var tree = '); f.write(tree.to_json)
83
+ f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
86
84
  end
87
85
  end
88
86
 
@@ -102,7 +100,7 @@ class SDoc::Merge
102
100
  url = @urls.empty? ? name : @urls[i]
103
101
  filename = File.join dir, RDoc::Generator::SHtml::SEARCH_INDEX_FILE
104
102
  data = open(filename).read.sub(/var search_data =\s*/, '')
105
- subindex = JSON.parse data, :max_nesting => 35
103
+ subindex = JSON.parse(data, :max_nesting => 0)
106
104
  @indexes[name] = subindex
107
105
 
108
106
  searchIndex = subindex["index"]["searchIndex"]
@@ -135,7 +133,7 @@ class SDoc::Merge
135
133
  dst = File.join @op_dir, RDoc::Generator::SHtml::SEARCH_INDEX_FILE
136
134
  FileUtils.mkdir_p File.dirname(dst)
137
135
  File.open(dst, "w", 0644) do |f|
138
- f.write('var search_data = '); f.write(search_data.to_json)
136
+ f.write('var search_data = '); f.write(search_data.to_json(:max_nesting => 0))
139
137
  end
140
138
  end
141
139
 
@@ -216,4 +214,4 @@ class SDoc::Merge
216
214
  raise RDoc::Error, msg
217
215
  end
218
216
 
219
- end
217
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 17
9
- version: 0.2.17
8
+ - 20
9
+ version: 0.2.20
10
10
  platform: ruby
11
11
  authors:
12
12
  - Volodya Kolesnikov
@@ -14,27 +14,29 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-29 00:00:00 +01:00
17
+ date: 2011-03-25 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rdoc
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
- - - ">="
26
+ - - "="
26
27
  - !ruby/object:Gem::Version
27
28
  segments:
28
29
  - 2
29
30
  - 4
30
- - 2
31
- version: 2.4.2
31
+ - 3
32
+ version: 2.4.3
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
36
  name: json
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
@@ -56,7 +58,6 @@ extra_rdoc_files:
56
58
  - LICENSE
57
59
  - README.rdoc
58
60
  files:
59
- - .gitignore
60
61
  - LICENSE
61
62
  - README.rdoc
62
63
  - Rakefile
@@ -64,6 +65,7 @@ files:
64
65
  - bin/wpdoc
65
66
  - bin/wpdoc-merge
66
67
  - lib/rdoc/discover.rb
68
+ - lib/sdoc/json_backend.rb
67
69
  - lib/wpdoc.rb
68
70
  - lib/wpdoc/c_parser_fix.rb
69
71
  - lib/wpdoc/generator/shtml.rb
@@ -75,6 +77,7 @@ files:
75
77
  - lib/wpdoc/generator/template/direct/resources/css/main.css
76
78
  - lib/wpdoc/generator/template/direct/resources/css/panel.css
77
79
  - lib/wpdoc/generator/template/direct/resources/css/reset.css
80
+ - lib/wpdoc/generator/template/direct/resources/dextrous_web.png
78
81
  - lib/wpdoc/generator/template/direct/resources/favicon.ico
79
82
  - lib/wpdoc/generator/template/direct/resources/i/arrows.png
80
83
  - lib/wpdoc/generator/template/direct/resources/i/results_bg.png
@@ -94,11 +97,12 @@ homepage: http://github.com/dxw/wpdoc
94
97
  licenses: []
95
98
 
96
99
  post_install_message:
97
- rdoc_options:
98
- - --charset=UTF-8
100
+ rdoc_options: []
101
+
99
102
  require_paths:
100
103
  - lib
101
104
  required_ruby_version: !ruby/object:Gem::Requirement
105
+ none: false
102
106
  requirements:
103
107
  - - ">="
104
108
  - !ruby/object:Gem::Version
@@ -106,6 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
110
  - 0
107
111
  version: "0"
108
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
109
114
  requirements:
110
115
  - - ">="
111
116
  - !ruby/object:Gem::Version
@@ -115,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
120
  requirements: []
116
121
 
117
122
  rubyforge_project:
118
- rubygems_version: 1.3.6
123
+ rubygems_version: 1.3.7
119
124
  signing_key:
120
125
  specification_version: 3
121
126
  summary: rdoc html with javascript search index.
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- pkg
2
- doc
3
- /test.rb
4
- wpdoc.gemspec