-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRakefile
76 lines (63 loc) · 1.65 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
71
72
73
74
75
76
require 'rake/testtask'
require 'rubocop/rake_task'
require 'reek/rake/task'
require 'rspec/core/rake_task'
desc 'Generate and show sample city map'
task :output_city_map do
ruby 'City/city_map_output.rb'
end
desc 'Generate and show sample world map'
task :output_world_map do
ruby 'MapGenerator/map_output_test.rb MapGenerator'
end
desc 'Generate and show sample dungeon map'
task :output_dungeon_map do
ruby 'Maze/dungeon_map_output.rb'
end
desc 'Run sample battle'
task :sample_battle do
ruby 'Rules/battle_coordinator_test.rb'
end
desc 'Explore a sample map'
task :map_explorer do
ruby 'map_explorer.rb'
end
desc 'Run RuboCop'
Rubocop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = false
end
desc 'Run Reek'
Reek::Rake::Task.new(:reek) do |t|
t.fail_on_error = false
t.verbose = true
t.source_files = '*'
t.reek_opts = '-n'
end
def generate_spec_task(directory)
desc "#{directory} Specs"
RSpec::Core::RakeTask.new("#{directory.downcase}_specs") do |t|
t.pattern = "#{directory}/**/*_spec.rb"
t.rspec_opts = '-c'
end
end
SPEC_DIRS = %w|City MapGenerator RandomNameGeneration Rules|
SPEC_DIRS.each do |spec_dir|
generate_spec_task spec_dir
end
desc 'All Specs'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "*/**/*_spec.rb"
t.rspec_opts = '-c'
end
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['./MapGenerator/filter_out_of_bounds_specification_test.rb',
'./MapGenerator/particle_test.rb',
'./Events/test/test*.rb']
t.verbose = false
end
desc 'All'
task :all => [:spec, :test] do
puts 'Ran all tests and specs'
end
task :default => :all