forked from feedjira/feedjira
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
56 lines (47 loc) · 1.63 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
require "spec"
require "spec/rake/spectask"
require 'rake/rdoctask'
require 'lib/feedzirra.rb'
# Grab recently touched specs
def recent_specs(touched_since)
recent_specs = FileList['app/**/*'].map do |path|
if File.mtime(path) > touched_since
spec = File.join('spec', File.dirname(path).split("/")[1..-1].join('/'),
"#{File.basename(path, ".*")}_spec.rb")
spec if File.exists?(spec)
end
end.compact
recent_specs += FileList['spec/**/*_spec.rb'].select do |path|
File.mtime(path) > touched_since
end
recent_specs.uniq
end
desc "Run all the tests"
task :default => :spec
# Tasks
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
end
desc 'Run recent specs'
Spec::Rake::SpecTask.new("spec:recent") do |t|
t.spec_opts = ["--format","specdoc","--color"]
t.spec_files = recent_specs(Time.now - 600) # 10 min.
end
Spec::Rake::SpecTask.new('spec:rcov') do |t|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = ['--exclude', 'spec,/usr/lib/ruby,/usr/local,/var/lib,/Library', '--text-report']
end
Rake::RDocTask.new do |rd|
rd.title = 'Feedzirra'
rd.rdoc_dir = 'rdoc'
rd.rdoc_files.include('README.rdoc', 'lib/feedzirra.rb', 'lib/feedzirra/**/*.rb')
rd.options = ["--quiet", "--opname", "index.html", "--line-numbers", "--inline-source", '--main', 'README.rdoc']
end
task :install do
rm_rf "*.gem"
puts `gem build feedzirra.gemspec`
puts `sudo gem install feedzirra-#{Feedzirra::VERSION}.gem`
end