# -*- coding: utf-8; mode: ruby -*- # # Copyright (C) 2010-2011 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License version 2.1 as published by the Free Software Foundation. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require 'English' require 'fileutils' require 'pathname' require 'erb' require 'rubygems' require 'jeweler' require "rake/clean" require "yard" base_dir = Pathname.new(__FILE__).dirname racknga_lib_dir = base_dir + 'lib' $LOAD_PATH.unshift(racknga_lib_dir.to_s) def guess_version require 'racknga/version' Racknga::VERSION end ENV["VERSION"] ||= guess_version version = ENV["VERSION"].dup project = nil spec = nil Jeweler::Tasks.new do |_spec| spec = _spec spec.name = 'racknga' spec.version = version spec.rubyforge_project = 'groonga' spec.homepage = "http://groonga.rubyforge.org/" authors_file = File.join(base_dir, "AUTHORS") authors = [] emails = [] File.readlines(authors_file).each do |line| if /\s*<([^<>]*)>$/ =~ line authors << $PREMATCH emails << $1 end end spec.authors = authors spec.email = emails spec.summary = "A Rack middleware collection for rroonga features." spec.description = <<-EOD.gsub(/\n/, ' ').strip Racknga is a Rack middlewares that uses rroonga features. EOD spec.license = "LGPLv2.1 or later" spec.files = FileList["lib/**/*.rb", "{license,munin,doc/text/}/**/*", "example/*.rb", "AUTHORS", "Rakefile", "Gemfile", "README*"] spec.test_files = FileList["test/**/*.rb"] end Rake::Task["release"].prerequisites.clear Jeweler::RubygemsDotOrgTasks.new do end reference_base_dir = Pathname.new("doc/reference") doc_en_dir = reference_base_dir + "en" html_base_dir = Pathname.new("doc/html") html_reference_dir = html_base_dir + spec.name YARD::Rake::YardocTask.new do |task| task.options += ["--title", spec.name] task.options += ["--readme", "README.textile"] task.options += ["--files", "doc/text/**/*"] task.options += ["--output-dir", doc_en_dir.to_s] task.options += ["--charset", "utf-8"] end task :yard do doc_en_dir.find do |path| next if path.extname != ".html" html = path.read html = html.gsub(/