sdoc 0.2.18 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 18
2
+ :patch: 19
3
3
  :major: 0
4
4
  :build:
5
5
  :minor: 2
@@ -1,17 +1,10 @@
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'
14
6
 
7
+ gem 'rdoc', '>= 2.4.2'
15
8
  require 'rdoc/rdoc'
16
9
  require 'rdoc/generator'
17
10
  require 'rdoc/generator/markup'
@@ -123,7 +116,7 @@ class RDoc::Generator::SHtml
123
116
  tree = generate_file_tree + generate_class_tree_level(topclasses)
124
117
  debug_msg " writing class tree to %s" % TREE_FILE
125
118
  File.open(TREE_FILE, "w", 0644) do |f|
126
- f.write('var tree = '); f.write(tree.to_json)
119
+ f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
127
120
  end unless $dryrun
128
121
  end
129
122
 
@@ -162,7 +155,7 @@ class RDoc::Generator::SHtml
162
155
  :index => index
163
156
  }
164
157
  File.open(SEARCH_INDEX_FILE, "w", 0644) do |f|
165
- f.write('var search_data = '); f.write(data.to_json)
158
+ f.write('var search_data = '); f.write(data.to_json(:max_nesting => 0))
166
159
  end unless $dryrun
167
160
  end
168
161
 
@@ -295,11 +288,11 @@ class RDoc::Generator::SHtml
295
288
  content = content.sub(/^(.{100,}?)\s.*/m, "\\1").gsub(/\r?\n/m, ' ')
296
289
 
297
290
  begin
298
- content.to_json
291
+ content.to_json(:max_nesting => 0)
299
292
  rescue # might fail on non-unicode string
300
293
  begin
301
294
  content = Iconv.conv('latin1//ignore', "UTF8", content) # remove all non-unicode chars
302
- content.to_json
295
+ content.to_json(:max_nesting => 0)
303
296
  rescue
304
297
  content = '' # something hugely wrong happend
305
298
  end
@@ -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
@@ -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 'sdoc/json_backen'
8
6
  require 'sdoc/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(:max_nesting => 35))
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
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sdoc}
8
- s.version = "0.2.18"
8
+ s.version = "0.2.19"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Volodya Kolesnikov"]
12
- s.date = %q{2010-06-02}
12
+ s.date = %q{2010-06-15}
13
13
  s.email = %q{voloko@gmail.com}
14
14
  s.executables = ["sdoc", "sdoc-merge"]
15
15
  s.extra_rdoc_files = [
@@ -64,6 +64,7 @@ Gem::Specification.new do |s|
64
64
  "lib/sdoc/generator/template/shtml/resources/panel/index.html",
65
65
  "lib/sdoc/github.rb",
66
66
  "lib/sdoc/helpers.rb",
67
+ "lib/sdoc/json_backend.rb",
67
68
  "lib/sdoc/merge.rb",
68
69
  "lib/sdoc/templatable.rb",
69
70
  "sdoc.gemspec"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 18
9
- version: 0.2.18
8
+ - 19
9
+ version: 0.2.19
10
10
  platform: ruby
11
11
  authors:
12
12
  - Volodya Kolesnikov
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-02 00:00:00 +04:00
17
+ date: 2010-06-15 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -103,6 +103,7 @@ files:
103
103
  - lib/sdoc/generator/template/shtml/resources/panel/index.html
104
104
  - lib/sdoc/github.rb
105
105
  - lib/sdoc/helpers.rb
106
+ - lib/sdoc/json_backend.rb
106
107
  - lib/sdoc/merge.rb
107
108
  - lib/sdoc/templatable.rb
108
109
  - sdoc.gemspec