-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
43 lines (39 loc) · 1.33 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
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'
require 'yard'
require 'rubocop/rake_task'
# Testing with rspec
RSpec::Core::RakeTask.new(:spec) do |task|
task.rspec_opts = %w(--color --format documentation)
end
task test: :spec
# Generate documentation with yard
YARD::Rake::YardocTask.new do |t|
t.files = %w(lib/*.rb lib/enscalator/*.rb lib/enscalator/plugins/*.rb)
t.stats_options = %w(--list-undoc --compact)
end
desc 'Generate gem documentation (same as running "rake yard")'
task doc: :yard
# Print all available plugins
namespace :enscalator do
namespace :plugins do
desc 'Show all available plugins'
task :show do
require 'enscalator'
root_dir = Pathname.new('lib/enscalator')
plugins = Enscalator::Plugins.constants
# print pairs of plugin module name / filename
root_dir.join('plugins').children.select { |p| p.to_s.end_with?('.rb') }.each do |plugin_file|
plugin_module = plugins.find { |p| p.to_s.underscore == File.basename(plugin_file, '.rb').to_s }
STDOUT.puts "Enscalator::Plugins::#{plugin_module} (#{plugin_file})"
end
end
end
end
# Use RuboCop to check for code/style offenses
desc 'Run RuboCop on the lib directory'
RuboCop::RakeTask.new(:rubocop) do |task|
# don't abort rake on failure
task.fail_on_error = false
end
task default: [:rubocop, :spec]