forked from TaoK/ruby_omx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
51 lines (44 loc) · 1.34 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
#!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
end
task :default => :test
namespace :whitespace do
FIND_FILE_BLACKLIST = "find . -type f | grep -v -e '.git/'"
desc 'Runs all whitespace tasks'
task :all do
Rake::Task["whitespace:remove_trailing"].invoke
Rake::Task["whitespace:covert_to_soft_tabs"].invoke
Rake::Task["whitespace:remove_blank_lines"].invoke
end
desc 'Removes trailing whitespace'
task :remove_trailing do
system %{
echo Removing trailing whitespace
for f in `#{FIND_FILE_BLACKLIST}`;
do cat $f | sed 's/[ \t]*$//' > .whitespace; cp .whitespace $f; rm .whitespace; echo $f;
done
}
end
desc 'Converts hard-tabs into two-space soft-tabs'
task :covert_to_soft_tabs do
system %{
echo Converting hard-tabs into two-space soft-tabs
for f in `#{FIND_FILE_BLACKLIST}`;
do cat $f | sed 's/\t/ /g' > .soft_tabs; cp .soft_tabs $f; rm .soft_tabs; echo $f;
done
}
end
desc 'Remove consecutive blank lines'
task :remove_blank_lines do
system %{
echo Removing consecutive blank lines
for f in `#{FIND_FILE_BLACKLIST}`;
do cat $f | sed '/./,/^$/!d' > .blank_lines; cp .blank_lines $f; rm .blank_lines; echo $f;
done
}
end
end