1 # Copyright 2007-2010 Wincent Colaiuta. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are met:
5 # 1. Redistributions of source code must retain the above copyright notice,
6 # this list of conditions and the following disclaimer.
7 # 2. Redistributions in binary form must reproduce the above copyright notice,
8 # this list of conditions and the following disclaimer in the documentation
9 # and/or other materials provided with the distribution.
11 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
15 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
16 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
17 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
18 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
19 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 # POSSIBILITY OF SUCH DAMAGE.
25 require 'spec/rake/spectask'
26 require 'spec/rake/verify_rcov'
27 require File.expand_path('lib/walrus/version', File.dirname(__FILE__))
29 desc 'Run specs with coverage'
30 Spec::Rake::SpecTask.new('coverage') do |t|
31 t.spec_files = FileList['spec/**/*_spec.rb']
33 t.rcov_opts = ['--exclude', "spec"]
41 desc 'Verify that test coverage is above minimum threshold'
42 RCov::VerifyTask.new(:verify => :spec) do |t|
43 t.threshold = 99.2 # never adjust expected coverage down, only up
44 t.index_html = 'coverage/index.html'
47 desc 'Generate specdocs for inclusions in RDoc'
48 Spec::Rake::SpecTask.new('specdoc') do |t|
49 t.spec_files = FileList['spec/**/*_spec.rb']
50 t.spec_opts = ['--format', 'rdoc']
54 BUILT_GEM_DEPENDENCIES = Dir[
60 BUILT_GEM = "walrus-#{Walrus::VERSION}.gem"
61 file BUILT_GEM => BUILT_GEM_DEPENDENCIES do
62 sh 'gem build walrus.gemspec'
65 desc 'Build gem ("gem build")'
66 task :build => BUILT_GEM
68 desc 'Publish gem ("gem push")'
69 task :push => :build do
70 sh "gem push #{BUILT_GEM}"