sdoc-helpers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -0
- data/Rakefile +19 -0
- data/lib/sdoc_helpers/markdown.rb +25 -0
- data/lib/sdoc_helpers/pages.rb +36 -0
- data/lib/sdoc_helpers/version.rb +3 -0
- data/lib/sdoc_helpers.rb +4 -0
- metadata +60 -0
data/README
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
|
5
|
+
require 'sdoc_helpers/version'
|
6
|
+
|
7
|
+
Jeweler::Tasks.new do |gemspec|
|
8
|
+
gemspec.name = "sdoc-helpers"
|
9
|
+
gemspec.summary = "Simple helpers to make using sdoc easier."
|
10
|
+
gemspec.description = "Simple helpers to make using sdoc easier."
|
11
|
+
gemspec.email = "chris@ozmm.org"
|
12
|
+
gemspec.homepage = "http://github.com/defunkt/sdoc-helpers"
|
13
|
+
gemspec.authors = ["Chris Wanstrath"]
|
14
|
+
gemspec.version = SDocHelpers::Version.to_s
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler not available."
|
18
|
+
puts "Install it with: gem install jeweler"
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SDocHelpers
|
2
|
+
module MarkdownFiles
|
3
|
+
def description
|
4
|
+
return super unless full_name =~ /\.(md|markdown)$/
|
5
|
+
# assuming your path is ROOT/html or ROOT/doc
|
6
|
+
path = Dir.pwd + '/../' + full_name
|
7
|
+
Markdown.new(File.read(path)).to_html + open_links_in_new_window
|
8
|
+
end
|
9
|
+
|
10
|
+
def open_links_in_new_window
|
11
|
+
<<-html
|
12
|
+
<script type="text/javascript">$(function() {
|
13
|
+
$('a').each(function() { $(this).attr('target', '_blank') })
|
14
|
+
})</script>
|
15
|
+
html
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'rdiscount'
|
22
|
+
RDoc::TopLevel.send :include, SDocHelpers::MarkdownFiles
|
23
|
+
rescue LoadError
|
24
|
+
puts "Markdown support not enabled. Please install RDiscount."
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rake/rdoctask'
|
2
|
+
|
3
|
+
readme = Dir['*'].grep(/README/)[0]
|
4
|
+
|
5
|
+
Rake::RDocTask.new do |rdoc|
|
6
|
+
rdoc.main = readme
|
7
|
+
rdoc.rdoc_files = [ readme, 'LICENSE', 'lib' ]
|
8
|
+
rdoc.rdoc_dir = 'docs'
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :pages do
|
12
|
+
task :publish => [ :check_dirty, :rerdoc ] do
|
13
|
+
`git checkout gh-pages`
|
14
|
+
`ls -1 | grep -v docs | xargs rm -rf; mv docs/* .; rm -rf docs`
|
15
|
+
`git commit -a -m "update docs"; git push origin gh-pages`
|
16
|
+
`git checkout master`
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Initialize GitHub Pages with documentation"
|
20
|
+
task :init => [ :check_dirty, :rerdoc ] do
|
21
|
+
`git symbolic-ref HEAD refs/heads/gh-pages`
|
22
|
+
`rm .git/index`
|
23
|
+
`ls -1 | grep -v docs | xargs rm -rf; mv docs/* .; rm -rf docs`
|
24
|
+
`git add .;git commit -m "create docs"; git push origin gh-pages`
|
25
|
+
`git checkout master`
|
26
|
+
end
|
27
|
+
|
28
|
+
task :check_dirty do
|
29
|
+
if !`git status`.include?('nothing to commit')
|
30
|
+
abort "dirty index - not publishing!"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Build and publish documentation using GitHub Pages."
|
36
|
+
task :pages => "pages:publish"
|
data/lib/sdoc_helpers.rb
ADDED
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sdoc-helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Wanstrath
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-06 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Simple helpers to make using sdoc easier.
|
17
|
+
email: chris@ozmm.org
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- README
|
26
|
+
- Rakefile
|
27
|
+
- lib/sdoc_helpers.rb
|
28
|
+
- lib/sdoc_helpers/markdown.rb
|
29
|
+
- lib/sdoc_helpers/pages.rb
|
30
|
+
- lib/sdoc_helpers/version.rb
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://github.com/defunkt/sdoc-helpers
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options:
|
37
|
+
- --charset=UTF-8
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.3.5
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Simple helpers to make using sdoc easier.
|
59
|
+
test_files: []
|
60
|
+
|