forked from dbr/tvnamer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
60 lines (49 loc) · 1.41 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
# PyLint/PEP8 messages to disable
pylint_disable = ["R0903", "C0103", "R0903", "F0401", "C0301"].join(",")
pep8_disable = ["E501"].join(",")
task :default => [:pep8, :pyflakes, :test]
# Displays a the width of standard terminal, with text at end
def title(text)
padding = "#" * (79 - (text.length + 1))
puts "#{padding} #{text}"
end
desc "Removes .pyc files"
task :clean do
`rm *.pyc`
`rm */*.pyc`
end
desc "Checks code for PEP8 compliance"
task :pep8 do
title("pep8.py")
puts `python tools/pep8.py --ignore=#{pep8_disable} --repeat *.py tests/*.py`
end
desc "Lints the code with PyFlakes"
task :pyflakes do
title("PyFlake")
puts `pyflakes .`
end
desc "Lints code with PyLint"
task :pylint do
title("PyLint")
puts `pylint --reports=n --disable-msg=#{pylint_disable} tvnamer/*.py tests/*.py`
end
desc "Runs unit tests using nosetests"
task :test do
title("Unit tests")
puts `nosetests`
end
desc "Upload current version to PyPi"
task :topypi => :test do
cur_file = File.open("tvnamer/__init__.py").read()
tvnamer_version = cur_file.scan(/__version__ = \((\d+), (\d+)\)/)
tvnamer_version = tvnamer_version[0].join(".").to_f
puts "Build sdist and send tvnamer v#{tvnamer_version} to PyPi?"
if $stdin.gets.chomp == "y"
puts "Sending source-dist (sdist) to PyPi"
if system("python setup.py sdist register upload")
print "tvnamer uploaded!"
end
else
puts "Cancelled"
end
end