Sha256: 57b1e5bcd6839ea7280788670cb6119ebbda64d003fba3e04cdb707e3f4aec77

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require "rabbit/task/slide"

# Edit ./config.yaml to customize meta data

spec = nil
Rabbit::Task::Slide.new do |task|
  spec = task.spec
  spec.files += Dir.glob("data/**/*.*")
  spec.files += Dir.glob("images/**/*.*")
  # spec.files -= Dir.glob("private/**/*.*")
  spec.add_runtime_dependency("rabbit-theme-groonga")
end

desc "Tag #{spec.version}"
task :tag do
  sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
  sh("git", "push", "--tags")
end

key_graphs = []
plots = Pathname.glob("data/**/*.gnuplot")
plots.each do |plot|
  output_base_dir = plot.dirname.to_s.gsub(/\Adata/, "images")
  loaded_plots = []
  graphs = []
  data = []

  plot.open do |plot_file|
    plot_file.each_line do |line|
      case line.chomp
      when /\Aload "(.*?)"\z/
        loaded_plots << "#{plot.dirname}/#{$1}"
      when /"(.*?\.tsv)"/
        data << "#{plot.dirname}/#{$1}"
      when /\Aset output "(.*?)"\z/
        graphs << "#{output_base_dir}/#{$1}"
      end
    end
  end
  next if graphs.empty?

  key_graph = graphs.first
  key_graphs << key_graph
  file key_graph => [plot.to_s, *loaded_plots, *data] do
    cd(plot.dirname) do
      sh("gnuplot", plot.basename.to_s)
    end
    graphs.each do |graph|
      mkdir_p(File.dirname(graph))
      mv("#{plot.dirname}/#{File.basename(graph)}",
         graph)
    end
  end
end

desc "Generate graphs"
task :graph => key_graphs

task :run => :graph
task :pdf => :graph

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rabbit-slide-kou-pgconf-asia-2016-2016.12.3.2 Rakefile
rabbit-slide-kou-pgconf-asia-2016-2016.12.3.1 Rakefile
rabbit-slide-kou-pgconf-asia-2016-2016.12.3.0 Rakefile