Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit ce41e57

Browse files
committed
Setup GitHub Pages yardoc.
1 parent f321ee8 commit ce41e57

File tree

3 files changed

+91
-19
lines changed

3 files changed

+91
-19
lines changed

.gitignore

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1+
Gemfile.lock
2+
.rspec-local
13
*.gem
2-
*.rbc
3-
.rbx/*
4-
.bundle
5-
.config
6-
/.idea
4+
lib/1.8
5+
lib/1.9
6+
lib/2.0
7+
.rvmrc
8+
.ruby-version
9+
.ruby-gemset
10+
.bundle/*
711
.yardoc/*
812
yardoc/*
9-
Gemfile.lock
10-
InstalledFiles
11-
_yardoc
13+
tmp/*
14+
man/*
15+
*.tmproj
16+
rdoc/*
17+
*.orig
18+
*.BACKUP.*
19+
*.BASE.*
20+
*.LOCAL.*
21+
*.REMOTE.*
22+
git_pull.txt
1223
coverage
13-
doc/
14-
lib/bundler/man
15-
lib/thread_safe/jruby_cache_backend.jar
16-
pkg
17-
rdoc
18-
spec/reports
19-
test/tmp
20-
test/version_tmp
21-
tmp
24+
critic
2225
.DS_Store
23-
*.swp
24-
test/package.jar
26+
TAGS
27+
tmtags
28+
*.sw?
29+
.idea
30+
.rbx/*
31+
lib/**/*.bundle
32+
lib/**/*.so
33+
lib/**/*.jar
34+
ext/**/*.bundle
35+
ext/**/*.so
36+
ext/**/*.jar
37+
pkg
38+
*.gem

Rakefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
require "bundler/gem_tasks"
22
require "rake/testtask"
33

4+
## safely load all the rake tasks in the `tasks` directory
5+
def safe_load(file)
6+
begin
7+
load file
8+
rescue LoadError => ex
9+
puts "Error loading rake tasks from '#{file}' but will continue..."
10+
puts ex.message
11+
end
12+
end
13+
Dir.glob('tasks/**/*.rake').each do |rakefile|
14+
safe_load rakefile
15+
end
16+
417
task :default => :test
518

619
if defined?(JRUBY_VERSION)

tasks/update_doc.rake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
require 'yard'
2+
YARD::Rake::YardocTask.new
3+
4+
root = File.expand_path File.join(File.dirname(__FILE__), '..')
5+
6+
namespace :yard do
7+
8+
cmd = lambda do |command|
9+
puts ">> executing: #{command}"
10+
system command or raise "#{command} failed"
11+
end
12+
13+
desc 'Pushes generated documentation to github pages: http://ruby-concurrency.github.io/thread_safe/'
14+
task :push => [:setup, :yard] do
15+
16+
message = Dir.chdir(root) do
17+
`git log -n 1 --oneline`.strip
18+
end
19+
puts "Generating commit: #{message}"
20+
21+
Dir.chdir "#{root}/yardoc" do
22+
cmd.call "git add -A"
23+
cmd.call "git commit -m '#{message}'"
24+
cmd.call 'git push origin gh-pages'
25+
end
26+
27+
end
28+
29+
desc 'Setups second clone in ./yardoc dir for pushing doc to github'
30+
task :setup do
31+
32+
unless File.exist? "#{root}/yardoc/.git"
33+
cmd.call "rm -rf #{root}/yardoc" if File.exist?("#{root}/yardoc")
34+
Dir.chdir "#{root}" do
35+
cmd.call 'git clone --single-branch --branch gh-pages [email protected]:ruby-concurrency/thread_safe.git ./yardoc'
36+
end
37+
end
38+
Dir.chdir "#{root}/yardoc" do
39+
cmd.call 'git fetch origin'
40+
cmd.call 'git reset --hard origin/gh-pages'
41+
end
42+
43+
end
44+
45+
end

0 commit comments

Comments
 (0)