-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
90 lines (78 loc) · 3.4 KB
/
Rakefile
File metadata and controls
90 lines (78 loc) · 3.4 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "fileutils"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--exclude-pattern \'spec/**/*suite_spec.rb\'"
end
task default: :spec
desc "Pull TBD Measure"
task :measure do
puts "Pulling TBD Measure"
pth = $:.select { |l_pth| l_pth.include?("tbd-") }
raise "Missing TBD gem - run 'bundle update'\n" unless pth.size == 1
pth = File.join(pth, "measures/tbd")
tbd = File.join(__dir__, "spec/files/measures/tbd")
FileUtils.copy_entry(pth, tbd) unless Dir.exist?(tbd)
raise "TBD Measure from TBD gem?\n" unless Dir.exist?(tbd)
end
desc "Pull 'OpenStudio Results' Measure"
task :results do
puts "Pulling 'OpenStudio Results' Measure"
gem = "openstudio-common-measures"
pth = $:.select { |l_pth| l_pth.include?(gem) }
raise "Missing '#{gem}' - run 'bundle update'\n" unless pth.size == 1
pth = File.join(pth, "measures/openstudio_results")
osm = File.join(__dir__, "spec/files/measures/openstudio_results")
FileUtils.copy_entry(pth, osm) unless Dir.exist?(osm)
raise "'OpenStudio Results' Measure (#{gem})?\n" unless Dir.exist?(osm)
end
desc "Pull 'Create DOE Prototype Building' Measure"
task :prototype do
puts "Pulling 'Create DOE Prototype Building' Measure"
gem = "openstudio-model-articulation"
pth = $:.select { |l_pth| l_pth.include?(gem) }
raise "Missing '#{gem}' - run 'bundle update'\n" unless pth.size == 1
pth = File.join(pth, "measures/create_DOE_prototype_building")
pro = File.join(__dir__, "spec/files/measures/create_DOE_prototype_building")
FileUtils.copy_entry(pth, pro) unless Dir.exist?(pro)
raise "'Create DOE Prototype Building' (#{gem})?\n" unless Dir.exist?(pro)
end
namespace "osm_suite" do
desc "Clean TBD OSM Test Suite"
task :clean do
puts "Cleaning TBD OSM Test Suite"
osm = File.join(__dir__, "spec/osm_suite_runs")
FileUtils.rmtree(osm) if Dir.exist?(osm)
osm = File.join(__dir__, "spec/files/measures/openstudio_results")
FileUtils.rmtree(osm) if Dir.exist?(osm)
tbd = File.join(__dir__, "spec/files/measures/tbd")
FileUtils.rmtree(tbd) if Dir.exist?(tbd)
end
desc "Run TBD OSM Test Suite"
RSpec::Core::RakeTask.new(:run) do |t|
t.rspec_opts = "--pattern \'spec/tbd_osm_suite_spec.rb\'"
end
task run: [:measure, :results]
end
namespace "prototype_suite" do
desc "Clean TBD Prototype Test Suite"
task :clean do
puts "Cleaning Prototype Test Suite"
pro = File.join(__dir__, "spec/prototype_suite_runs")
FileUtils.rmtree(pro) if Dir.exist?(pro)
pro = File.join(__dir__, "spec/files/measures/create_DOE_prototype_building")
FileUtils.rmtree(pro) if Dir.exist?(pro)
end
desc "Run TBD Prototype Test Suite"
RSpec::Core::RakeTask.new(:run) do |t|
t.rspec_opts = "--pattern \'spec/tbd_prototype_suite_spec.rb\'"
end
task run: [:measure, :results, :prototype]
end
desc "Clean All Test Suites"
task suites_clean: ["osm_suite:clean", "prototype_suite:clean"] do
end
desc "Run All Test Suites"
task suites_run: ["osm_suite:run", "prototype_suite:run"] do
end
task spec: [:measure] # default spec test depends on pulling TBD measure