forked from lace/blmath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
70 lines (60 loc) · 1.57 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
66
67
68
69
70
$style_config_version = '2.1.0'
desc "Install style config"
task :install_style_config do
FileUtils.rm_rf "bodylabs-python-style" if Dir.exists? "bodylabs-python-style"
raise unless system "git clone https://github.com/bodylabs/bodylabs-python-style.git"
Dir.chdir 'bodylabs-python-style' do
raise unless system "git checkout tags/#{$style_config_version}"
end
end
task :require_style_config do
Rake::Task[:install_style_config].invoke unless File.executable? 'bodylabs-python-style/bin/pylint_test'
end
$mac_os = `uname -s`.strip == 'Darwin'
desc "Install dependencies for distribution"
task :install_dist do
if $mac_os
raise unless system "brew update"
raise unless system "brew install pandoc"
raise unless system "pip install pypandoc"
else
puts
puts "You must install:"
puts
puts " - pandoc"
puts " - pypandoc"
puts
raise
end
end
def command_is_in_path?(command)
system("which #{ command} > /dev/null 2>&1")
end
task :unittest do
raise unless system "nose2"
end
task :lint => :require_style_config do
raise unless system "bodylabs-python-style/bin/pylint_test blmath --min_rating 10.0"
end
desc "Remove .pyc files"
task :clean do
system "find . -name '*.pyc' -delete"
end
task :sdist do
unless command_is_in_path? 'pandoc'
puts
puts "Please install pandoc."
puts
raise
end
raise unless system "python setup.py sdist"
end
task :upload do
unless command_is_in_path?('pandoc')
puts
puts "Please install pandoc."
puts
raise
end
raise unless system "python setup.py sdist upload"
end