about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-24 09:54:45 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-24 09:54:45 +0000
commit3e09ac0c10c95bb24a08af62393b4f761e2743d0 (patch)
tree778dffa2ba8798503fc047db0feef6d65426ea22 /Rakefile
downloaddtas-3e09ac0c10c95bb24a08af62393b4f761e2743d0.tar.gz
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile61
1 files changed, 61 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..a4118bf
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,61 @@
+load "./GIT-VERSION-GEN"
+manifest = "Manifest.txt"
+gitidx = File.stat(".git/index") rescue nil
+if ! File.exist?(manifest) || File.stat(manifest).mtime < gitidx.mtime
+  system("git ls-files > #{manifest}")
+  File.open(manifest, "a") do |fp|
+    fp.puts "NEWS"
+    fp.puts "lib/dtas/version.rb"
+  end
+  File.open("NEWS", "w") do |fp|
+    `git tag -l`.split(/\n/).each do |tag|
+      %r{\Av([\d\.]+)} =~ tag or next
+      version = $1
+      header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
+      header = header.split(/\n/)
+      tagger = header.grep(/\Atagger /)[0]
+      time = Time.at(tagger.split(/ /)[-2].to_i).utc
+      date = time.strftime("%Y-%m-%d")
+
+      fp.write("=== #{version} / #{date}\n\n#{subject}\n\n#{body}")
+    end
+    fp.flush
+    if fp.size <= 5
+      fp.puts "Unreleased"
+    end
+  end
+end
+
+require 'hoe'
+Hoe.plugin :git
+include Rake::DSL
+
+Hoe.spec('dtas') do |p|
+  developer 'Eric Wong', 'normalperson@yhbt.net'
+
+  self.readme_file = 'README'
+  self.history_file = 'NEWS'
+  self.urls = %w(http://dtas.80x24.org/)
+  self.summary = x = File.readlines("README")[0].split(/\s+/)[1].chomp
+  self.description = self.paragraphs_of("README", 1)
+  license "GPLv2+"
+
+  dependency 'io_splice', '~> 4.2.0'
+end
+
+task :publish_docs do
+  dest = "80x24.org:/srv/dtas/"
+  system("rsync", "--files-from=.document", "-av", "#{Dir.pwd}/", dest)
+end
+
+task :coverage do
+  env = {
+    "COVERAGE" => "1",
+    "RUBYOPT" => "-r./test/helper",
+  }
+  File.open("coverage.dump", "w").close # clear
+  pid = Process.spawn(env, "rake")
+  _, status = Process.waitpid2(pid)
+  require './test/covshow'
+  exit status.exitstatus
+end