-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
65 lines (56 loc) · 1.82 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rubocop/rake_task'
require 'github_changelog_generator/task'
require 'yard'
spec = Gem::Specification.load('awskeyring.gemspec')
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = 'tristanmorgan'
config.project = spec.name
config.future_release = spec.version
config.since_tag = 'v1.5.0'
end
RuboCop::RakeTask.new do |rubocop|
rubocop.options = %w[-D --enable-pending-cops]
rubocop.requires << 'rubocop-performance'
rubocop.requires << 'rubocop-rake'
rubocop.requires << 'rubocop-rspec'
rubocop.requires << 'rubocop-rubycw'
end
desc 'Run RSpec code examples'
task :spec do
puts 'Running RSpec...'
require 'rspec/core'
runner = RSpec::Core::Runner
xcode = runner.run(%w[--pattern spec/**{,/*/**}/*_spec.rb --order rand --format documentation --color])
abort 'RSpec failed' if xcode.positive?
end
desc 'Check filemode bits'
task :filemode do
puts 'Running FileMode...'
files = Set.new(spec.files)
dirs = Set.new(files.map { |file| File.dirname(file) })
failure = []
files.merge(dirs).each do |file|
mode = File.stat(file).mode
print '.'
failure << file if (mode & 0x7) != ((mode >> 3) & 0x7)
end
abort "\nError: Incorrect file mode found\n#{failure.join("\n")}" unless failure.empty?
print "\n"
end
desc 'generate manpage'
task :ronn do
puts 'Running Ronn...'
require 'ronn'
doc = Ronn::Document.new('man/awskeyring.5.ronn')
doc.date = Time.parse(`git show -s --format=%ad --date=short`)
File.write('man/awskeyring.5', doc.to_roff)
puts "done\n\n"
end
YARD::Rake::YardocTask.new do |t|
t.options = ['--fail-on-warning', '--no-progress', '--files', '*.md']
t.stats_options = ['--list-undoc']
end
desc 'Run Linting, Tests and Documetation tasks'
task default: %i[filemode rubocop spec ronn yard]