-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
33 lines (28 loc) · 1.01 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
require "bundler/gem_tasks"
require "rake/testtask"
require "fileutils"
require "tmpdir"
task default: :test
Rake::TestTask.new do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
def download_package(name, version)
puts "Downloading #{name} #{version}"
Dir.chdir(Dir.mktmpdir) do
system "npm", "pack", "#{name}@#{version}", "-q", exception: true
system "tar", "xzf", "#{name}-#{version}.tgz", exception: true
contents = File.read("package/build/#{name}.js")
# remove source map to prevent console warnings
contents.sub!("//# sourceMappingURL=#{name}.js.map\n", "")
File.write(File.expand_path("vendor/assets/javascripts/#{name}.js", __dir__), contents)
FileUtils.cp("package/LICENSE", File.expand_path("licenses/LICENSE-#{name}.txt", __dir__))
end
end
# update in lib/vega/spec.rb as well
task :update do
download_package("vega", "5.30.0")
download_package("vega-lite", "5.21.0")
download_package("vega-embed", "6.26.0")
download_package("vega-interpreter", "1.0.5")
end