File: Rakefile

package info (click to toggle)
ruby-perfect-toml 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 224 kB
  • sloc: ruby: 1,929; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (2)
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
require "bundler/gem_tasks"
require "rake/testtask"
require "rdoc/task"

Rake::TestTask.new(:core_test) do |t|
  t.libs << "test"
  t.libs << "lib"
  t.test_files = FileList["test/**/*_test.rb"]
end

TOML_TEST = "./toml-test-v1.2.0-linux-amd64"

file TOML_TEST do
  require "open-uri"
  require "zlib"
  URI.open("https://github.com/BurntSushi/toml-test/releases/download/v1.2.0/toml-test-v1.2.0-linux-amd64.gz", "rb") do |f|
    File.binwrite(TOML_TEST, Zlib::GzipReader.new(f).read)
    File.chmod(0o755, TOML_TEST)
  end
end

task :toml_decoder_test => TOML_TEST do
  sh "./toml-test-v1.2.0-linux-amd64", "./tool/decoder.rb"
end

task :toml_encoder_test => TOML_TEST do
  ["0000", "1000", "0010", "0001", "0011"].each do |mode|
    ENV["TOML_ENCODER_USE_DOT"] = mode[0]
    ENV["TOML_ENCODER_SORT_KEYS"] = mode[1]
    ENV["TOML_ENCODER_USE_LITERAL_STRING"] = mode[2]
    ENV["TOML_ENCODER_USE_MULTILINE_STRING"] = mode[3]
    sh "./toml-test-v1.2.0-linux-amd64", "./tool/encoder.rb", "--encoder", "-skip", "valid/string/multiline-quotes"
  end
end

task :test => [:core_test, :toml_decoder_test, :toml_encoder_test]

task default: :test

Rake::RDocTask.new do |rdoc|
  files =["README.md", "LICENSE", "lib/perfect_toml.rb"]
  rdoc.rdoc_files.add(files)
  rdoc.main = "README.md"
  rdoc.title = "PerfectTOML Docs"
  rdoc.rdoc_dir = "doc/rdoc"
end