-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
92 lines (69 loc) · 2.69 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# encoding: UTF-8
#--
# This file is part of Psychgus.
# Copyright (c) 2019-2020 Jonathan Bradley Whited (@esotericpig)
#
# Psychgus is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Psychgus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Psychgus. If not, see <https://www.gnu.org/licenses/>.
#++
require 'bundler/gem_tasks'
require 'yard'
require 'yard_ghurt'
require 'psychgus/version'
require 'rake/clean'
require 'rake/testtask'
task default: [:test]
CLEAN.exclude('.git/','stock/')
CLOBBER.include('doc/')
# Execute "rake clobber doc" for pristine docs
desc 'Generate documentation (YARDoc)'
task :doc => [:yard,:yard_gfm_fix] do |task|
end
Rake::TestTask.new() do |task|
task.libs = ['lib','test']
task.pattern = File.join('test','**','*_test.rb')
task.description += " ('#{task.pattern}')"
#task.options = '--verbose' # Execute "rake test TESTOPT=-v" instead
task.verbose = true
task.warning = true
end
desc 'Run all tests (including writing to temp files, etc.)'
task :test_all do |task|
ENV['PSYCHGUS_TEST'] = 'all'
test_task = Rake::Task[:test]
test_task.reenable()
test_task.invoke()
end
YARD::Rake::YardocTask.new() do |task|
task.files = [File.join('lib','**','*.rb')]
task.options += ['--files','CHANGELOG.md,LICENSE.txt']
task.options += ['--readme','README.md']
task.options << '--protected' # Show protected methods
task.options += ['--template-path',File.join('yard','templates')]
task.options += ['--title',"Psychgus v#{Psychgus::VERSION} Doc"]
end
YardGhurt::GFMFixTask.new() do |task|
task.description = 'Fix (find & replace) text in the YARD files for GitHub differences'
task.arg_names = [:dev]
task.dry_run = false
task.fix_code_langs = true
task.md_files = ['index.html']
task.before = Proc.new() do |task,args|
# Delete this file as it's never used (index.html is an exact copy)
YardGhurt.rm_exist(File.join(task.doc_dir,'file.README.html'))
# Root dir of my GitHub Page for CSS/JS
GHP_ROOT = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT}/css/prism.css" />)
task.js_scripts << %Q(<script src="#{GHP_ROOT}/js/prism.js"></script>)
end
end