1. Stefan Saasen
  2. stash-log-parser


Stefan Saasen  committed 66b0976

Update the 'rake package' task to include the gnuplot scripts and a subdirectory called 'logparser'

  • Participants
  • Parent commits 7a7168c
  • Branches master
  • Tags v1.1

Comments (0)

Files changed (1)

File logparser/Rakefile

View file
  • Ignore whitespace
+require 'fileutils'
+  require 'sysinfo'
+rescue LoadError
+  puts "Please install the sysinfo gem first"
+  exit -1
 desc "Clean build artifacts"
 task :clean do
   cabal 'clean'
+  `rm -f logparser-*.tar.gz`
 desc "Create the logparser binary"
 desc "Build and package the logparser"
 task :package => :build do
-  `tar zfc logparser-#{RUBY_PLATFORM}-#{version}.tar.gz LICENSE NOTICE -C.. README.md -Clogparser/dist/build/logparser logparser`
+  include FileUtils
+  with_temp_dir "logparser" do |package_dir|
+    cp "../README.md", package_dir
+    %w(NOTICE LICENSE).each {|f| cp f, package_dir }
+    bin_dir = File.join(package_dir, "bin")
+    mkdir bin_dir
+    cp ARTIFACT, bin_dir
+    cp_r "../gnuplot", package_dir
+    cp Dir["../*.sh"], package_dir
+    sysinfo = SysInfo.new
+    `tar zfc logparser-#{sysinfo.impl}-#{sysinfo.arch}-#{version}.tar.gz logparser`
+  end
 desc "Rebuild and copy the logparser into the cabal bin directory"
 task :rebuild => :build do
   cabal 'copy'
 def cabal(cmd)
   print `cabal #{cmd}`
+def with_temp_dir(name)
+  raise "The directory #{name} already exists" if File.directory?(name)
+  mkdir name
+  yield name
+  rm_r name