forked from JumpstartLab/traffic_spy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
58 lines (50 loc) · 1.38 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
require "bundler/gem_tasks"
# require "rake/testtask"
# Bundler.require
require 'sequel'
# task :default => :test
# Rake::TestTask.new do |t|
# t.pattern = "test/*_test.rb"
# end
namespace :db do
desc "Run migrations"
task :migrate => [:setup] do
Sequel::Migrator.run(@database, "db/migrations")
end
desc "Reset database"
task :reset => [:setup] do
Sequel::Migrator.run(@database, "db/migrations", :target => 0)
Sequel::Migrator.run(@database, "db/migrations")
end
task :setup do
Sequel.extension :migration
if ENV["TRAFFIC_SPY_ENV"] == "test"
database_file = 'db/traffic_spy-test.sqlite3'
@database = Sequel.sqlite database_file
else
@database = Sequel.postgres 'traffic_spy'
end
end
end
# THIS SPACE RESERVED FOR EVALUATIONS
#
namespace :sanitation do
desc "Check line lengths & whitespace with Cane"
task :lines do
puts ""
puts "== using cane to check line length =="
system("cane --no-abc --style-glob 'lib/**/*.rb' --no-doc")
puts "== done checking line length =="
puts ""
end
desc "Check method length with Reek"
task :methods do
puts ""
puts "== using reek to check method length =="
system("reek -n lib/**/*.rb 2>&1 | grep -v ' 0 warnings'")
puts "== done checking method length =="
puts ""
end
desc "Check both line length and method length"
task :all => [:lines, :methods]
end