sdoc 0.3.16 → 0.3.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ # SDoc
2
+
3
+ **Powering http://api.rubyonrails.org/ and http://railsapi.com/**
4
+
5
+ ### What is sdoc?
6
+
7
+ RDoc generator to build searchable HTML documentation for Ruby code.
8
+
9
+ * `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
11
+
12
+
13
+ ### Getting Started
14
+
15
+ ```bash
16
+ # Install the gem
17
+ gem install sdoc
18
+
19
+ # Generate documentation for 'projectdir'
20
+ sdoc projectdir
21
+ ```
22
+
23
+ ### sdoc
24
+
25
+ `sdoc` is simply a wrapper for the `rdoc` command line tool. See `sdoc --help`
26
+ for more details. `--fmt` is set to `shtml` by default. The default template `-T` is `shtml`, but you can also use the `direct` template.
27
+
28
+ Example:
29
+
30
+ ```bash
31
+ sdoc -o doc/rails -T direct rails
32
+ ```
33
+
34
+ ### sdoc-merge
35
+
36
+ <pre>
37
+ Usage: sdoc-merge [options] directories
38
+ -n, --names [NAMES] Names of merged repositories. Comma separated
39
+ -o, --op [DIRECTORY] Set the output directory
40
+ -t, --title [TITLE] Set the title of merged file
41
+ </pre>
42
+
43
+ Example:
44
+
45
+ ```bash
46
+ sdoc-merge --title "Ruby v1.9, Rails v2.3.2.1" --op merged --names "Ruby,Rails" ruby-v1.9 rails-v2.3.2.1
47
+ ```
48
+
49
+ ### Rake Task
50
+
51
+ ```ruby
52
+ # Rakefile
53
+ require 'sdoc' # and use your RDoc task the same way you used it before
54
+
55
+ Rake::RDocTask.new do |rdoc|
56
+ rdoc.rdoc_dir = 'doc/rdoc'
57
+ rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator
58
+ rdoc.template = 'direct' # lighter template used on railsapi.com
59
+ ...
60
+ end
61
+ ```
62
+
63
+ # Who?
64
+
65
+ * Vladimir Kolesnikov ([voloko](https://github.com/voloko))
66
+ * Nathan Broadbent ([ndbroadbent](https://github.com/ndbroadbent))
@@ -150,10 +150,11 @@
150
150
  <div class="method">
151
151
  <div class="title method-title" id="<%= method.aref %>">
152
152
  <% if method.call_seq %>
153
- <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
153
+ <b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
154
154
  <% else %>
155
- <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
155
+ <b><%= h method.name %></b><%= h method.params %>
156
156
  <% end %>
157
+ <a href="<%= "#{rel_prefix}/#{context.path}##{method.aref}"%>" name="<%= method.aref %>" class="permalink">Link</a>
157
158
  </div>
158
159
 
159
160
  <% if method.comment %>
@@ -206,4 +207,4 @@
206
207
  <% end #visibilities.each %>
207
208
  <% end #context.methods_by_type %>
208
209
  <% end #context.each_section %>
209
- </div>
210
+ </div>
@@ -280,6 +280,13 @@ tt {
280
280
  margin: 0 0 0.5em 0;
281
281
  font-size: 1.2em;
282
282
  line-height: 1.25em;
283
+ position: relative;
284
+ }
285
+
286
+ .method .method-title a.permalink {
287
+ position: absolute;
288
+ font-size: 0.75em;
289
+ right: 0;
283
290
  }
284
291
 
285
292
  .method .sourcecode p.source-link {
@@ -150,10 +150,11 @@
150
150
  <div class="method">
151
151
  <div class="title method-title" id="<%= method.aref %>">
152
152
  <% if method.call_seq %>
153
- <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
153
+ <b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
154
154
  <% else %>
155
- <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
155
+ <b><%= h method.name %></b><%= h method.params %>
156
156
  <% end %>
157
+ <a href="<%= "#{rel_prefix}/#{context.path}##{method.aref}"%>" name="<%= method.aref %>" class="permalink">Link</a>
157
158
  </div>
158
159
 
159
160
  <% if method.comment %>
@@ -206,4 +207,4 @@
206
207
  <% end #visibilities.each %>
207
208
  <% end #context.methods_by_type %>
208
209
  <% end #context.each_section %>
209
- </div>
210
+ </div>
@@ -267,6 +267,13 @@ tt {
267
267
  margin: 0 0 0.5em 0;
268
268
  font-size: 1.2em;
269
269
  line-height: 1.25em;
270
+ position: relative;
271
+ }
272
+
273
+ .method .method-title a.permalink {
274
+ position: absolute;
275
+ font-size: 0.75em;
276
+ right: 0;
270
277
  }
271
278
 
272
279
  .method .sourcecode p.source-link {
@@ -199,7 +199,7 @@ class RDoc::Generator::SDoc
199
199
  debug_msg " writing class tree to %s" % TREE_FILE
200
200
  File.open(TREE_FILE, "w", 0644) do |f|
201
201
  f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
202
- end unless $dryrun
202
+ end unless @options.dry_run
203
203
  end
204
204
 
205
205
  ### Recursivly build class tree structure
@@ -306,7 +306,7 @@ class RDoc::Generator::SDoc
306
306
  rel_prefix = @outputdir.relative_path_from( outfile.dirname )
307
307
 
308
308
  debug_msg " rendering #{outfile}"
309
- self.render_template( templatefile, binding(), outfile )
309
+ self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
310
310
  end
311
311
  end
312
312
 
@@ -321,7 +321,7 @@ class RDoc::Generator::SDoc
321
321
  rel_prefix = @outputdir.relative_path_from( outfile.dirname )
322
322
 
323
323
  debug_msg " rendering #{outfile}"
324
- self.render_template( templatefile, binding(), outfile )
324
+ self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
325
325
  end
326
326
  end
327
327
 
@@ -348,7 +348,7 @@ class RDoc::Generator::SDoc
348
348
  templatefile = @template_dir + 'index.rhtml'
349
349
  outfile = @outputdir + 'index.html'
350
350
 
351
- self.render_template( templatefile, binding(), outfile )
351
+ self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
352
352
  end
353
353
 
354
354
  ### Generate file with links for the search engine
@@ -357,14 +357,14 @@ class RDoc::Generator::SDoc
357
357
  templatefile = @template_dir + 'se_index.rhtml'
358
358
  outfile = @outputdir + 'panel/links.html'
359
359
 
360
- self.render_template( templatefile, binding(), outfile )
360
+ self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
361
361
  end
362
362
 
363
363
  ### Copy all the resource files to output dir
364
364
  def copy_resources
365
365
  resoureces_path = @template_dir + RESOURCES_DIR
366
366
  debug_msg "Copying #{resoureces_path}/** to #{@outputdir}/**"
367
- FileUtils.cp_r resoureces_path.to_s, @outputdir.to_s, :preserve => true unless $dryrun
367
+ FileUtils.cp_r resoureces_path.to_s, @outputdir.to_s, :preserve => true unless @options.dry_run
368
368
  end
369
369
 
370
370
  class FilesTree
@@ -27,7 +27,7 @@ module SDoc::GitHub
27
27
  def commit_sha1(path)
28
28
  return false unless have_git?
29
29
  name = File.basename(path)
30
- s = Dir.chdir(File.join(basedir, File.dirname(path))) do
30
+ s = Dir.chdir(File.join(base_dir, File.dirname(path))) do
31
31
  `git log -1 --pretty=format:"commit %H" #{name}`
32
32
  end
33
33
  m = s.match(/commit\s+(\S+)/)
@@ -36,7 +36,7 @@ module SDoc::GitHub
36
36
 
37
37
  def repository_url(path)
38
38
  return false unless have_git?
39
- s = Dir.chdir(File.join(basedir, File.dirname(path))) do
39
+ s = Dir.chdir(File.join(base_dir, File.dirname(path))) do
40
40
  `git config --get remote.origin.url`
41
41
  end
42
42
  m = s.match(%r{github.com[/:](.*)\.git$})
@@ -44,7 +44,7 @@ module SDoc::GitHub
44
44
  end
45
45
 
46
46
  def path_relative_to_repository(path)
47
- absolute_path = File.join(basedir, path)
47
+ absolute_path = File.join(base_dir, path)
48
48
  root = path_to_git_dir(File.dirname(absolute_path))
49
49
  absolute_path[root.size..absolute_path.size]
50
50
  end
@@ -2,7 +2,7 @@ require 'optparse'
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
4
 
5
- if Gem.available? "json"
5
+ if Gem::Specification.respond_to?(:find_by_name) ? Gem::Specification::find_by_name("json") : Gem.available?("json")
6
6
  gem "json", ">= 1.1.3"
7
7
  else
8
8
  gem "json_pure", ">= 1.1.3"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "sdoc"
5
- s.version = "0.3.16"
5
+ s.version = "0.3.17"
6
6
 
7
7
  s.authors = ["Vladimir Kolesnikov"]
8
8
  s.description = %q{rdoc generator html with javascript search index.}
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.respond_to? :required_rubygems_version=
15
15
 
16
16
  s.rdoc_options = ["--charset=UTF-8"]
17
- s.extra_rdoc_files = ["README.rdoc"]
17
+ s.extra_rdoc_files = ["README.md"]
18
18
 
19
19
  s.add_runtime_dependency('rdoc', "~> 3.10")
20
20
  if defined?(JRUBY_VERSION)
metadata CHANGED
@@ -1,68 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sdoc
3
- version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- - 16
10
- version: 0.3.16
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.17
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Vladimir Kolesnikov
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-08 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rdoc
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 19
30
- segments:
31
- - 3
32
- - 10
33
- version: "3.10"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: json
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
40
25
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 21
45
- segments:
46
- - 1
47
- - 1
48
- - 3
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.10'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
49
37
  version: 1.1.3
50
38
  type: :runtime
51
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.3
52
46
  description: rdoc generator html with javascript search index.
53
47
  email: voloko@gmail.com
54
- executables:
48
+ executables:
55
49
  - sdoc
56
50
  - sdoc-merge
57
51
  extensions: []
58
-
59
- extra_rdoc_files:
60
- - README.rdoc
61
- files:
52
+ extra_rdoc_files:
53
+ - README.md
54
+ files:
62
55
  - .gitignore
63
56
  - .rake_tasks~
64
57
  - LICENSE
65
- - README.rdoc
58
+ - README.md
66
59
  - Rakefile
67
60
  - bin/sdoc
68
61
  - bin/sdoc-merge
@@ -117,41 +110,30 @@ files:
117
110
  - lib/sdoc/merge.rb
118
111
  - lib/sdoc/templatable.rb
119
112
  - sdoc.gemspec
120
- has_rdoc: true
121
113
  homepage: http://github.com/voloko/sdoc
122
114
  licenses: []
123
-
124
115
  post_install_message:
125
- rdoc_options:
116
+ rdoc_options:
126
117
  - --charset=UTF-8
127
- require_paths:
118
+ require_paths:
128
119
  - lib
129
- required_ruby_version: !ruby/object:Gem::Requirement
120
+ required_ruby_version: !ruby/object:Gem::Requirement
130
121
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
136
- - 0
137
- version: "0"
138
- required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
127
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 23
144
- segments:
145
- - 1
146
- - 3
147
- - 6
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
148
131
  version: 1.3.6
149
132
  requirements: []
150
-
151
133
  rubyforge_project:
152
- rubygems_version: 1.3.7
134
+ rubygems_version: 1.8.24
153
135
  signing_key:
154
136
  specification_version: 3
155
137
  summary: rdoc html with javascript search index.
156
138
  test_files: []
157
-
139
+ has_rdoc:
@@ -1,37 +0,0 @@
1
- = SDoc
2
- == What's in?
3
- - shtml - RDoc's generator to build searchable documentation
4
- - <tt>sdoc-merge</tt> - comand line tool to build merge multiple sdoc documentations
5
- packages into a single one
6
- - <tt>sdoc</tt> - command line tool to run rdoc with generator=shtml
7
-
8
- == Getting Started
9
- sudo gem install sdoc
10
- sdoc -N projectdir
11
-
12
- == Command line sdoc
13
- sdoc is simply a wrapper to rdoc command line tool. see <tt>sdoc --help </tt>
14
- for more details. <tt>--fmt</tt> is set to shtml by default.
15
- Default template <tt>-T</tt> is shtml. You can also use 'direct' template.
16
- Example:
17
- <tt>sdoc -o doc/rails -T direct rails</tt>
18
-
19
- == Rake
20
- # Rakefile
21
- require 'sdoc' # and use your RDoc task the same way you used it before
22
-
23
- Rake::RDocTask.new do |rdoc|
24
- rdoc.rdoc_dir = 'doc/rdoc'
25
- rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator
26
- rdoc.template = 'direct' # lighter template used on railsapi.com
27
- ...
28
- end
29
-
30
- == sdoc-merge
31
- Usage: sdoc-merge [options] directories
32
- -n, --names [NAMES] Names of merged repositories. Comma separated
33
- -o, --op [DIRECTORY] Set the output directory
34
- -t, --title [TITLE] Set the title of merged file
35
-
36
- Example:
37
- <tt>sdoc-merge --title "Ruby v1.9, Rails v2.3.2.1" --op merged --names "Ruby,Rails" ruby-v1.9 rails-v2.3.2.1</tt>