sdoc 0.3.20 → 0.4.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd2d4eb7ab04479c587beb38e4914c9dffccb38b
4
+ data.tar.gz: 19f04f53d7d8b389d1c89d626ec5e6eb5feb932f
5
+ SHA512:
6
+ metadata.gz: 86e9f89fca9d9742202cc177ae9476129f0d1954a7490f79031ebfc284bbed35f42474c95e269a8e6c279901b8d8f56e15367552061c06e965f89de99a5ed343
7
+ data.tar.gz: ae5dd03a65d7fd05b1eff34c0ced235a9d24b00fb096bec1e8d9fecef843e7754a49ace874d879a4d97c10894d391b795140b708d8f41e17e7d8c8104bf39b4f
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ *.gem
2
+ .bundle
1
3
  pkg
2
4
  doc
3
- /test.rb
5
+ /test.rb
6
+ Gemfile.lock
@@ -0,0 +1,12 @@
1
+ ---
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ - ruby-head
8
+ - jruby-19mode
9
+ - jruby-head
10
+ notifications:
11
+ recipients:
12
+ - zachary@zacharyscott.net
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SDoc
2
2
 
3
+ [![Build Status](https://travis-ci.org/zzak/sdoc.png?branch=master)](https://travis-ci.org/zzak/sdoc)
4
+
3
5
  **Powering http://api.rubyonrails.org/ and http://railsapi.com/**
4
6
 
5
7
  ### What is sdoc?
@@ -7,7 +9,7 @@
7
9
  RDoc generator to build searchable HTML documentation for Ruby code.
8
10
 
9
11
  * `sdoc` - command line tool to run rdoc with `generator=shtml` (searchable HTML)
10
- * `sdoc-merge` - comand line tool to merge multiple sdoc folders into a single documentation site
12
+ * `sdoc-merge` - command line tool to merge multiple sdoc folders into a single documentation site
11
13
 
12
14
 
13
15
  ### Getting Started
@@ -63,4 +65,5 @@ end
63
65
  # Who?
64
66
 
65
67
  * Vladimir Kolesnikov ([voloko](https://github.com/voloko))
66
- * Nathan Broadbent ([ndbroadbent](https://github.com/ndbroadbent))
68
+ * Nathan Broadbent ([ndbroadbent](https://github.com/ndbroadbent))
69
+ * Zachary Scott ([zzak](https://github.com/zzak))
data/Rakefile CHANGED
@@ -3,10 +3,11 @@ require 'rubygems'
3
3
  require 'bundler'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
- gem 'rspec', '>= 2.5.0'
7
- require 'rspec/core/rake_task'
6
+ require 'rake/testtask'
8
7
 
9
- desc "Run all specs"
10
- RSpec::Core::RakeTask.new(:spec)
11
- task :default => :spec
12
- task :test => :spec
8
+ Rake::TestTask.new do |t|
9
+ t.pattern = "spec/*_spec.rb"
10
+ end
11
+
12
+ task :default => :test
13
+ task :spec => :test
@@ -1,5 +1,5 @@
1
1
  begin
2
- gem 'rdoc', '~> 3'
2
+ gem 'rdoc', '~> 4.0.0'
3
3
  require File.join(File.dirname(__FILE__), '/../sdoc')
4
4
  rescue Gem::LoadError
5
5
  end
@@ -174,6 +174,12 @@
174
174
  end.join ", " %>
175
175
  </div>
176
176
  <% end %>
177
+
178
+ <% if method.is_alias_for then %>
179
+ <div class="aka">
180
+ Alias for: <a href="<%= context.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
181
+ </div>
182
+ <% end %>
177
183
 
178
184
  <% if method.token_stream %>
179
185
  <% markup = method.sdoc_markup_code %>
@@ -174,6 +174,12 @@
174
174
  end.join ", " %>
175
175
  </div>
176
176
  <% end %>
177
+
178
+ <% if method.is_alias_for then %>
179
+ <div class="aka">
180
+ Alias for: <a href="<%= context.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
181
+ </div>
182
+ <% end %>
177
183
 
178
184
  <% if method.token_stream %>
179
185
  <% markup = method.sdoc_markup_code %>
@@ -18,7 +18,7 @@
18
18
  </h1>
19
19
  <ul class="files">
20
20
  <li><%= h file.relative_name %></li>
21
- <li>Last modified: <%= file.file_stat.mtime %></li>
21
+ <li>Last modified: <%= file.last_modified %></li>
22
22
  </ul>
23
23
  </div>
24
24
 
@@ -26,4 +26,4 @@
26
26
  <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
27
27
  </div>
28
28
  </body>
29
- </html>
29
+ </html>
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
  require "rubygems"
3
- gem 'rdoc', '~> 3'
3
+ gem 'rdoc'
4
4
 
5
5
  module SDoc end
6
-
6
+
7
7
  require 'sdoc/generator'
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  class RDoc::Options
24
24
  attr_accessor :github
25
- attr_accessor :se_index
25
+ attr_accessor :search_index
26
26
  end
27
27
 
28
28
  class RDoc::AnyMethod
@@ -120,9 +120,14 @@ class RDoc::Generator::SDoc
120
120
 
121
121
  attr_reader :options
122
122
 
123
+ ##
124
+ # The RDoc::Store that is the source of the generated content
125
+
126
+ attr_reader :store
127
+
123
128
  def self.setup_options(options)
124
129
  @github = false
125
- options.se_index = true
130
+ options.search_index = true
126
131
 
127
132
  opt = options.option_parser
128
133
  opt.separator nil
@@ -134,25 +139,27 @@ class RDoc::Generator::SDoc
134
139
  end
135
140
  opt.separator nil
136
141
 
137
- opt.on("--no-se-index", "-ns",
142
+ opt.on("--without-search", "-s",
138
143
  "Do not generated index file for search engines.",
139
144
  "SDoc uses javascript to refrence individual documentation pages.",
140
145
  "Search engine crawlers are not smart enough to find all the",
141
146
  "referenced pages.",
142
147
  "To help them SDoc generates a static file with links to every",
143
148
  "documentation page. This file is not shown to the user."
144
- ) do |value|
145
- options.se_index = false
149
+ ) do
150
+ options.search_index = false
146
151
  end
147
152
  opt.separator nil
148
153
 
149
154
  end
150
155
 
151
- def initialize(options)
156
+ def initialize(store, options)
157
+ @store = store
152
158
  @options = options
153
159
  if @options.respond_to?('diagram=')
154
160
  @options.diagram = false
155
161
  end
162
+ @options.pipe = true
156
163
  @github_url_cache = {}
157
164
 
158
165
  @template_dir = Pathname.new(options.template_dir)
@@ -161,19 +168,19 @@ class RDoc::Generator::SDoc
161
168
  @json_index = RDoc::Generator::JsonIndex.new self, options
162
169
  end
163
170
 
164
- def generate(top_levels)
171
+ def generate
165
172
  @outputdir = Pathname.new(@options.op_dir).expand_path(@base_dir)
166
- @files = top_levels.sort
167
- @classes = RDoc::TopLevel.all_classes_and_modules.sort
173
+ @files = @store.all_files.sort
174
+ @classes = @store.all_classes_and_modules.sort
168
175
 
169
176
  # Now actually write the output
170
177
  copy_resources
171
178
  generate_class_tree
172
- @json_index.generate top_levels
179
+ @json_index.generate
173
180
  generate_file_files
174
181
  generate_class_files
175
182
  generate_index_file
176
- generate_se_index if @options.se_index
183
+ generate_search_index if @options.search_index
177
184
  end
178
185
 
179
186
  def class_dir
@@ -352,9 +359,9 @@ class RDoc::Generator::SDoc
352
359
  end
353
360
 
354
361
  ### Generate file with links for the search engine
355
- def generate_se_index
362
+ def generate_search_index
356
363
  debug_msg "Generating search engine index in #@outputdir"
357
- templatefile = @template_dir + 'se_index.rhtml'
364
+ templatefile = @template_dir + 'search_index.rhtml'
358
365
  outfile = @outputdir + 'panel/links.html'
359
366
 
360
367
  self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
@@ -2,7 +2,7 @@ module SDoc::GitHub
2
2
  def github_url(path)
3
3
  unless @github_url_cache.has_key? path
4
4
  @github_url_cache[path] = false
5
- file = RDoc::TopLevel.find_file_named(path)
5
+ file = @store.find_file_named(path)
6
6
  if file
7
7
  base_url = repository_url(path)
8
8
  if base_url
@@ -16,7 +16,7 @@ module SDoc::GitHub
16
16
  end
17
17
  @github_url_cache[path]
18
18
  end
19
-
19
+
20
20
  protected
21
21
 
22
22
  def have_git?
@@ -33,7 +33,7 @@ module SDoc::GitHub
33
33
  m = s.match(/commit\s+(\S+)/)
34
34
  m ? m[1] : false
35
35
  end
36
-
36
+
37
37
  def repository_url(path)
38
38
  return false unless have_git?
39
39
  s = Dir.chdir(File.join(base_dir, File.dirname(path))) do
@@ -51,7 +51,7 @@ module SDoc::GitHub
51
51
 
52
52
  def path_to_git_dir(path)
53
53
  while !path.empty? && path != '.'
54
- if (File.exists? File.join(path, '.git'))
54
+ if (File.exists? File.join(path, '.git'))
55
55
  return path
56
56
  end
57
57
  path = File.dirname(path)
@@ -20,7 +20,7 @@ module SDoc::Templatable
20
20
  ], err.backtrace
21
21
  end
22
22
  end
23
-
23
+
24
24
  ### Load and render the erb template with the given +template_name+ within
25
25
  ### current context. Adds all +local_assigns+ to context
26
26
  def include_template(template_name, local_assigns = {})
@@ -28,13 +28,13 @@ module SDoc::Templatable
28
28
  templatefile = @template_dir + template_name
29
29
  eval("#{source};eval_template(templatefile, binding)")
30
30
  end
31
-
31
+
32
32
  ### Load and render the erb template in the given +templatefile+ within the
33
33
  ### specified +context+ (a Binding object) and write it out to +outfile+.
34
34
  ### Both +templatefile+ and +outfile+ should be Pathname-like objects.
35
35
  def render_template( templatefile, context, outfile )
36
36
  output = eval_template(templatefile, context)
37
-
37
+
38
38
  # TODO delete this dirty hack when documentation for example for GeneratorMethods will not be cutted off by <script> tag
39
39
  begin
40
40
  if output.respond_to? :force_encoding
@@ -44,9 +44,9 @@ module SDoc::Templatable
44
44
  output = output.gsub('<script>', '&lt;script&gt;')
45
45
  end
46
46
  rescue Exception => e
47
-
47
+
48
48
  end
49
-
49
+
50
50
  unless $dryrun
51
51
  outfile.dirname.mkpath
52
52
  outfile.open( 'w', 0644 ) do |file|
@@ -56,5 +56,5 @@ module SDoc::Templatable
56
56
  debug_msg " would have written %d bytes to %s" %
57
57
  [ output.length, outfile ]
58
58
  end
59
- end
60
- end
59
+ end
60
+ end
@@ -2,13 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "sdoc"
5
- s.version = "0.3.20"
5
+ s.version = "0.4.0.rc.1"
6
6
 
7
- s.authors = ["Vladimir Kolesnikov", "Nathan Broadbent"]
7
+ s.authors = ["Vladimir Kolesnikov", "Nathan Broadbent", "Jean Mertz", "Zachary Scott"]
8
8
  s.description = %q{rdoc generator html with javascript search index.}
9
9
  s.summary = %q{rdoc html with javascript search index.}
10
10
  s.homepage = %q{http://github.com/voloko/sdoc}
11
11
  s.email = %q{voloko@gmail.com}
12
+ s.license = 'MIT'
12
13
 
13
14
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if
14
15
  s.respond_to? :required_rubygems_version=
@@ -16,7 +17,8 @@ Gem::Specification.new do |s|
16
17
  s.rdoc_options = ["--charset=UTF-8"]
17
18
  s.extra_rdoc_files = ["README.md"]
18
19
 
19
- s.add_runtime_dependency('rdoc', "~> 3.10")
20
+ s.add_runtime_dependency('rdoc', "~> 4.0", "< 5.0")
21
+
20
22
  if defined?(JRUBY_VERSION)
21
23
  s.platform = Gem::Platform.new(['universal', 'java', nil])
22
24
  s.add_runtime_dependency("json_pure", ">= 1.1.3")
@@ -24,8 +26,11 @@ Gem::Specification.new do |s|
24
26
  s.add_runtime_dependency("json", ">= 1.1.3")
25
27
  end
26
28
 
29
+ s.add_development_dependency "bundler", "~> 1.3"
30
+ s.add_development_dependency "rake"
31
+ s.add_development_dependency "minitest", "~> 4.0"
32
+
27
33
  s.files = `git ls-files`.split("\n")
28
34
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
35
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
36
  end
31
-
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__), '/spec_helper')
2
+
3
+ describe RDoc::Generator::SDoc do
4
+ before :each do
5
+ @options = RDoc::Options.new
6
+ @options.setup_generator 'sdoc'
7
+ @parser = @options.option_parser
8
+ end
9
+
10
+ it "should find sdoc generator" do
11
+ RDoc::RDoc::GENERATORS.must_include 'sdoc'
12
+ end
13
+
14
+ it "should use sdoc generator" do
15
+ @options.generator.must_equal RDoc::Generator::SDoc
16
+ @options.generator_name.must_equal 'sdoc'
17
+ end
18
+
19
+ it "should parse github option" do
20
+ assert !@options.github
21
+
22
+ out, err = capture_io do
23
+ @parser.parse %w[--github]
24
+ end
25
+
26
+ err.wont_match /^invalid options/
27
+ @options.github.must_equal true
28
+ end
29
+
30
+ it "should parse github short-hand option" do
31
+ assert !@options.github
32
+
33
+ out, err = capture_io do
34
+ @parser.parse %w[-g]
35
+ end
36
+
37
+ err.wont_match /^invalid options/
38
+ @options.github.must_equal true
39
+ end
40
+
41
+ it "should parse no search engine index option" do
42
+ @options.search_index.must_equal true
43
+
44
+ out, err = capture_io do
45
+ @parser.parse %w[--without-search]
46
+ end
47
+
48
+ err.wont_match /^invalid options/
49
+ @options.search_index.must_equal false
50
+ end
51
+
52
+ it "should parse search-index shorthand option" do
53
+ @options.search_index.must_equal true
54
+ out, err = capture_io do
55
+ @parser.parse %w[-s]
56
+ end
57
+
58
+ err.wont_match /^invalid options/
59
+ @options.search_index.must_equal false
60
+ end
61
+
62
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'sdoc'
5
+
6
+ require 'rdoc/test_case'
7
+
8
+ require 'minitest/autorun'
metadata CHANGED
@@ -1,49 +1,94 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
5
- prerelease:
4
+ version: 0.4.0.rc.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vladimir Kolesnikov
9
8
  - Nathan Broadbent
9
+ - Jean Mertz
10
+ - Zachary Scott
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2012-11-21 00:00:00.000000000 Z
14
+ date: 2013-12-26 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rdoc
17
18
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
19
  requirements:
20
- - - ~>
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '3.10'
22
+ version: '4.0'
23
+ - - "<"
24
+ - !ruby/object:Gem::Version
25
+ version: '5.0'
23
26
  type: :runtime
24
27
  prerelease: false
25
28
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
29
  requirements:
28
- - - ~>
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
33
+ - - "<"
29
34
  - !ruby/object:Gem::Version
30
- version: '3.10'
35
+ version: '5.0'
31
36
  - !ruby/object:Gem::Dependency
32
37
  name: json
33
38
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
39
  requirements:
36
- - - ! '>='
40
+ - - ">="
37
41
  - !ruby/object:Gem::Version
38
42
  version: 1.1.3
39
43
  type: :runtime
40
44
  prerelease: false
41
45
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
46
  requirements:
44
- - - ! '>='
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: 1.1.3
50
+ - !ruby/object:Gem::Dependency
51
+ name: bundler
52
+ requirement: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.3'
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '1.3'
64
+ - !ruby/object:Gem::Dependency
65
+ name: rake
66
+ requirement: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: minitest
80
+ requirement: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '4.0'
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '4.0'
47
92
  description: rdoc generator html with javascript search index.
48
93
  email: voloko@gmail.com
49
94
  executables:
@@ -53,8 +98,10 @@ extensions: []
53
98
  extra_rdoc_files:
54
99
  - README.md
55
100
  files:
56
- - .gitignore
57
- - .rake_tasks~
101
+ - ".gitignore"
102
+ - ".rake_tasks~"
103
+ - ".travis.yml"
104
+ - Gemfile
58
105
  - LICENSE
59
106
  - README.md
60
107
  - Rakefile
@@ -82,7 +129,7 @@ files:
82
129
  - lib/rdoc/generator/template/rails/resources/js/main.js
83
130
  - lib/rdoc/generator/template/rails/resources/js/searchdoc.js
84
131
  - lib/rdoc/generator/template/rails/resources/panel/index.html
85
- - lib/rdoc/generator/template/rails/se_index.rhtml
132
+ - lib/rdoc/generator/template/rails/search_index.rhtml
86
133
  - lib/rdoc/generator/template/sdoc/_context.rhtml
87
134
  - lib/rdoc/generator/template/sdoc/_head.rhtml
88
135
  - lib/rdoc/generator/template/sdoc/class.rhtml
@@ -103,7 +150,7 @@ files:
103
150
  - lib/rdoc/generator/template/sdoc/resources/js/main.js
104
151
  - lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js
105
152
  - lib/rdoc/generator/template/sdoc/resources/panel/index.html
106
- - lib/rdoc/generator/template/sdoc/se_index.rhtml
153
+ - lib/rdoc/generator/template/sdoc/search_index.rhtml
107
154
  - lib/sdoc.rb
108
155
  - lib/sdoc/generator.rb
109
156
  - lib/sdoc/github.rb
@@ -111,30 +158,33 @@ files:
111
158
  - lib/sdoc/merge.rb
112
159
  - lib/sdoc/templatable.rb
113
160
  - sdoc.gemspec
161
+ - spec/rdoc_generator_spec.rb
162
+ - spec/spec_helper.rb
114
163
  homepage: http://github.com/voloko/sdoc
115
- licenses: []
164
+ licenses:
165
+ - MIT
166
+ metadata: {}
116
167
  post_install_message:
117
168
  rdoc_options:
118
- - --charset=UTF-8
169
+ - "--charset=UTF-8"
119
170
  require_paths:
120
171
  - lib
121
172
  required_ruby_version: !ruby/object:Gem::Requirement
122
- none: false
123
173
  requirements:
124
- - - ! '>='
174
+ - - ">="
125
175
  - !ruby/object:Gem::Version
126
176
  version: '0'
127
177
  required_rubygems_version: !ruby/object:Gem::Requirement
128
- none: false
129
178
  requirements:
130
- - - ! '>='
179
+ - - ">="
131
180
  - !ruby/object:Gem::Version
132
181
  version: 1.3.6
133
182
  requirements: []
134
183
  rubyforge_project:
135
- rubygems_version: 1.8.24
184
+ rubygems_version: 2.2.0.rc.1
136
185
  signing_key:
137
- specification_version: 3
186
+ specification_version: 4
138
187
  summary: rdoc html with javascript search index.
139
- test_files: []
140
- has_rdoc:
188
+ test_files:
189
+ - spec/rdoc_generator_spec.rb
190
+ - spec/spec_helper.rb