-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRakefile
53 lines (40 loc) · 1.3 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
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--exclude-pattern \'spec/**/*suite_spec.rb\'"
end
task default: :spec
desc "Update Library Files"
task :libraries do
# puts "Updating Library Files"
require "fileutils"
libs = ["topolys", "osut", "oslg", "tbd"]
files = {}
$:.each do |path|
libs.each do |l|
next unless path.include?(l)
files[l] = Dir.glob(File.join(path, "#{l}/*.rb"))
files[l].delete_if { |f| f.include?("version.rb") } unless l == "topolys"
# puts "#{l} lib files:"
# files[l].each { |lf| puts "... #{lf}" }
# puts
end
end
dirs = Dir.glob(File.join(__dir__, "lib/measures/*"))
dirs.each do |dir|
files.values.each do |items|
items.each { |file| FileUtils.cp(file, "#{dir}/resources/.") }
end
end
end
desc "Update Measure"
task measure: [:libraries] do
# puts "Updating Measure"
require "openstudio"
require "open3"
cli = OpenStudio.getOpenStudioCLI
command = "#{cli} measure -t './lib/measures'"
out, err, ps = Open3.capture3({ "BUNDLE_GEMFILE" => nil }, command)
raise "Failed to update measures\n\n#{out}\n\n#{err}" unless ps.success?
end
task spec: [:measure] # default spec test depends on updating measure, lib files