-
Notifications
You must be signed in to change notification settings - Fork 54
/
Rakefile
44 lines (35 loc) · 951 Bytes
/
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
require 'bundler/gem_tasks'
begin
require 'yard'
require 'yard/rake/yardoc_task'
YARD::Rake::YardocTask.new do |doc|
doc.files = Dir['lib/**/*.rb'] + ['README.md']
doc.options = ['-m', 'markdown']
end
rescue LoadError
end
desc 'Validate the gemspec file.'
task :validate_gemspec do
Gem::Specification.load('webmachine.gemspec').validate
end
task build: :validate_gemspec
desc 'Cleans up white space in source files'
task :clean_whitespace do
no_file_cleaned = true
Dir['**/*.rb'].each do |file|
contents = File.read(file)
cleaned_contents = contents.gsub(/([ \t]+)$/, '')
unless cleaned_contents == contents
no_file_cleaned = false
puts " - Cleaned #{file}"
File.write(file, cleaned_contents)
end
end
if no_file_cleaned
puts 'No files with trailing whitespace found'
end
end
require 'rspec/core/rake_task'
desc 'Run specs'
RSpec::Core::RakeTask.new(:spec)
task default: :spec