|
1 | | -require "bundler/gem_tasks" |
| 1 | +require 'bundler/gem_tasks' |
2 | 2 |
|
3 | 3 | begin |
4 | 4 | require 'yard' |
5 | 5 | require 'yard/rake/yardoc_task' |
6 | 6 | YARD::Rake::YardocTask.new do |doc| |
7 | | - doc.files = Dir["lib/**/*.rb"] + ['README.md'] |
8 | | - doc.options = ["-m", "markdown"] |
| 7 | + doc.files = Dir['lib/**/*.rb'] + ['README.md'] |
| 8 | + doc.options = ['-m', 'markdown'] |
9 | 9 | end |
10 | 10 | rescue LoadError |
11 | 11 | end |
12 | 12 |
|
13 | | -desc "Validate the gemspec file." |
| 13 | +desc 'Validate the gemspec file.' |
14 | 14 | task :validate_gemspec do |
15 | | - Gem::Specification.load("webmachine.gemspec").validate |
| 15 | + Gem::Specification.load('webmachine.gemspec').validate |
16 | 16 | end |
17 | 17 |
|
18 | | -task :build => :validate_gemspec |
| 18 | +task build: :validate_gemspec |
19 | 19 |
|
20 | | -desc "Cleans up white space in source files" |
| 20 | +desc 'Cleans up white space in source files' |
21 | 21 | task :clean_whitespace do |
22 | 22 | no_file_cleaned = true |
23 | 23 |
|
24 | | - Dir["**/*.rb"].each do |file| |
| 24 | + Dir['**/*.rb'].each do |file| |
25 | 25 | contents = File.read(file) |
26 | 26 | cleaned_contents = contents.gsub(/([ \t]+)$/, '') |
27 | 27 | unless cleaned_contents == contents |
28 | 28 | no_file_cleaned = false |
29 | 29 | puts " - Cleaned #{file}" |
30 | | - File.open(file, 'w') { |f| f.write(cleaned_contents) } |
| 30 | + File.write(file, cleaned_contents) |
31 | 31 | end |
32 | 32 | end |
33 | 33 |
|
34 | 34 | if no_file_cleaned |
35 | | - puts "No files with trailing whitespace found" |
| 35 | + puts 'No files with trailing whitespace found' |
36 | 36 | end |
37 | 37 | end |
38 | 38 |
|
39 | 39 | require 'rspec/core/rake_task' |
40 | 40 |
|
41 | | -desc "Run specs" |
| 41 | +desc 'Run specs' |
42 | 42 | RSpec::Core::RakeTask.new(:spec) |
43 | 43 |
|
44 | | -task :default => :spec |
| 44 | +task default: :spec |
0 commit comments