forked from plaid/plaid-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
53 lines (41 loc) · 1.15 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'bundler/gem_tasks'
require 'sdoc'
require 'rdoc/task'
require 'rake/testtask'
require 'fileutils'
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.generator = 'sdoc'
rdoc.main = 'README.md'
rdoc.rdoc_files.include('README.md', 'LICENSE', 'UPGRADING.md', 'lib/**/*.rb')
rdoc.markup = 'tomdoc'
end
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/test*.rb']
t.verbose = true
t.ruby_opts << '-rminitest/pride'
end
desc 'Update the gh-pages branch with doc/rdoc contents'
task :update_gh_pages do
tmpdir = Dir::Tmpname.create('plaid_docs') {}
desc = `git describe`.chomp
sh "git clone --shared . #{tmpdir}"
Dir.chdir(tmpdir) do
sh 'git checkout gh-pages'
FileUtils.rm_rf Dir.glob("#{tmpdir}/*")
end
FileUtils.cp_r Dir.glob('doc/rdoc/*'), tmpdir
Dir.chdir(tmpdir) do
sh 'git add .'
sh 'git add --update .'
sh "git commit --allow-empty -m 'Regenerate docs for #{desc}'"
sh 'git push'
end
FileUtils.rm_rf tmpdir
end
desc 'Generate rdoc and update gh-pages on GitHub'
task update_github_docs: %i(rdoc update_gh_pages) do
sh 'git push origin gh-pages'
end
task default: :test