-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
80 lines (67 loc) · 2.13 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 2007-2014 Greg Hurrell. All rights reserved.
# Licensed under the terms of the BSD 2-clause license.
require 'rake'
require 'rubygems'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
require File.expand_path('lib/walrus/version', File.dirname(__FILE__))
desc 'Run specs with coverage'
Spec::Rake::SpecTask.new('coverage') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = ['--exclude', "spec"]
end
desc 'Run specs'
task :spec do
sh 'bin/spec spec'
end
desc 'Verify that test coverage is above minimum threshold'
RCov::VerifyTask.new(:verify => :spec) do |t|
t.threshold = 99.2 # never adjust expected coverage down, only up
t.index_html = 'coverage/index.html'
end
desc 'Generate specdocs for inclusions in RDoc'
Spec::Rake::SpecTask.new('specdoc') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--format', 'rdoc']
t.out = 'specdoc.rd'
end
desc 'Build the YARD HTML files'
task :yard do
sh 'bin/yardoc -o html --title Walrus'
end
desc 'Upload YARD HTML'
task :upload_yard => :yard do
require 'yaml'
config = YAML.load_file('.config.yml')
raise ':yardoc_host not configured' unless config.has_key?(:yardoc_host)
raise ':yardoc_path not configured' unless config.has_key?(:yardoc_path)
sh "scp -r html/* #{config[:yardoc_host]}:#{config[:yardoc_path]}"
end
BUILT_GEM_DEPENDENCIES = Dir[
'walrus.gemspec',
'bin/walrus',
'lib/**/*.rb'
]
BUILT_GEM = "walrus-#{Walrus::VERSION}.gem"
file BUILT_GEM => BUILT_GEM_DEPENDENCIES do
sh 'gem build walrus.gemspec'
end
desc 'Build gem ("gem build")'
task :build => BUILT_GEM
desc 'Publish gem ("gem push")'
task :push => :build do
sh "gem push #{BUILT_GEM}"
end
desc 'Build the YARD HTML files'
task :yard do
sh "yardoc -o html --title Walrus - doc/*"
end
desc 'Upload YARD HTML'
task :upload_yard => :yard do
require 'yaml'
config = YAML.load_file('.config.yml')
raise ':yardoc_host not configured' unless config.has_key?(:yardoc_host)
raise ':yardoc_path not configured' unless config.has_key?(:yardoc_path)
sh "scp -r html/* #{config[:yardoc_host]}:#{config[:yardoc_path]}"
end