]> git.wincent.com - mkdtemp.git/blob - Rakefile
Use RubyForge as homepage
[mkdtemp.git] / Rakefile
1 # Copyright 2007-2008 Wincent Colaiuta
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
15 require 'rake'
16 require 'rake/clean'
17 require 'rake/gempackagetask'
18 require 'rake/rdoctask'
19 require 'rubygems'
20 require 'spec/rake/spectask'
21 require 'spec/rake/verify_rcov'
22 require File.join(File.dirname(__FILE__), 'lib', 'mkdtemp', 'version.rb')
23
24 CLEAN.include   Rake::FileList['**/*.so', '**/*.bundle', '**/*.o', '**/mkmf.log', '**/Makefile']
25
26 task :default => :all
27
28 desc 'Build all and run all specs'
29 task :all => [:make, :spec]
30
31 desc 'Run specs with coverage'
32 Spec::Rake::SpecTask.new('coverage') do |t|
33   t.spec_files  = FileList['spec/**/*_spec.rb']
34   t.rcov        = true
35   t.rcov_opts = ['--exclude', "spec"]
36 end
37
38 desc 'Run specs'
39 Spec::Rake::SpecTask.new('spec') do |t|
40   t.spec_files  = FileList['spec/**/*_spec.rb']
41 end
42
43 desc 'Verify that test coverage is above minimum threshold'
44 RCov::VerifyTask.new(:verify => :spec) do |t|
45   t.threshold   = 99.2 # never adjust expected coverage down, only up
46   t.index_html  = 'coverage/index.html'
47 end
48
49 desc 'Generate specdocs for inclusions in RDoc'
50 Spec::Rake::SpecTask.new('specdoc') do |t|
51   t.spec_files  = FileList['spec/**/*_spec.rb']
52   t.spec_opts   = ['--format', 'rdoc']
53   t.out         = 'specdoc.rd'
54 end
55
56 desc 'Build extension'
57 task :make do |t|
58   system %{cd ext && ruby ./extconf.rb && make && cd -}
59 end
60
61 Rake::RDocTask.new do |t|
62   t.rdoc_files.include 'doc/README', 'ext/mkdtemp.c'
63   t.options           << '--charset' << 'UTF-8' << '--inline-source'
64   t.main              = 'doc/README'
65   t.title             = 'mkdtemp documentation'
66 end
67
68 desc 'Upload RDoc to RubyForge website'
69 task :upload_rdoc => :rdoc do
70   sh 'scp -r html/* rubyforge.org:/var/www/gforge-projects/mkdtemp/'
71 end
72
73
74 SPEC = Gem::Specification.new do |s|
75   s.name              = 'mkdtemp'
76   s.version           = Dir::Mkdtemp::VERSION
77   s.author            = 'Wincent Colaiuta'
78   s.email             = 'win@wincent.com'
79   s.homepage          = 'http://mkdtemp.rubyforge.org/'
80   s.rubyforge_project = 'mkdtemp'
81   s.platform          = Gem::Platform::RUBY
82   s.summary           = 'Secure creation of temporary directories'
83   s.description       = <<-ENDDESC
84     mkdtemp is a C extension that wraps the Standard C Library function
85     of the same name to make secure creation of temporary directories
86     easily available from within Ruby.
87   ENDDESC
88   s.require_paths     = ['ext', 'lib']
89   s.has_rdoc          = true
90
91   # TODO: add 'docs' subdirectory, 'README.txt' when they're done
92   s.files             = FileList['{lib,spec}/**/*', 'ext/*.{c,rb}', 'ext/**/*.c'].to_a
93   s.extensions        = ['ext/extconf.rb']
94 end
95
96 task :package => [:clobber, :all, :gem]
97 Rake::GemPackageTask.new(SPEC) do |t|
98   t.need_tar      = true
99 end