forked from athityakumar/colorls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
50 lines (40 loc) · 1.17 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
# frozen_string_literal: true
require 'bundler/setup'
require 'rubygems/tasks'
Gem::Tasks.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '--warnings'
end
require 'rubocop/rake_task'
RuboCop::RakeTask.new
desc 'Build the manual'
file 'man/colorls.1' => ['man/colorls.1.ronn', 'lib/colorls/flags.rb'] do
require 'colorls'
require 'date'
require 'ronn'
flags = ColorLS::Flags.new
attributes = {
date: Date.iso8601(`git log -1 --pretty=format:%cI -- lib/colorls/flags.rb`),
manual: 'colorls Manual',
organization: "colorls #{ColorLS::VERSION}"
}
doc = Ronn::Document.new(nil, attributes) do
template = File.read('man/colorls.1.ronn')
section = ''
flags.options.each do |o|
section += <<OPTION
* `#{o.flags.join('`, `')}`:
#{o.desc.join("<br>\n")}
OPTION
end
template.sub('{{ OPTIONS }}', section)
end
File.write('man/colorls.1', doc.convert('roff'))
end
directory 'zsh'
desc 'Build the Zsh completion file'
file 'zsh/_colorls' => %w[zsh lib/colorls/flags.rb] do
ruby "exe/colorls '--*-completion-zsh=colorls' > zsh/_colorls"
end
task default: %w[spec rubocop man/colorls.1 zsh/_colorls]