forked from parndt/friendly_id
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
68 lines (58 loc) · 1.52 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
require "rake"
require "rake/testtask"
require "rake/gempackagetask"
require "rake/rdoctask"
require "rake/clean"
CLEAN << "pkg" << "doc" << "coverage" << ".yardoc"
Rake::GemPackageTask.new(eval(File.read("friendly_id.gemspec"))) { |pkg| }
Rake::RDocTask.new do |r|
r.rdoc_dir = "doc"
r.rdoc_files.include "lib/**/*.rb"
end
begin
require "yard"
YARD::Rake::YardocTask.new do |t|
t.options = ["--output-dir=doc"]
t.options << "--files" << ["Guide.md", "Contributors.md", "Changelog.md"].join(",")
end
rescue LoadError
end
begin
require "rcov/rcovtask"
Rcov::RcovTask.new do |r|
r.test_files = FileList["test/**/*_test.rb"]
r.verbose = true
r.rcov_opts << "--exclude gems/*"
end
rescue LoadError
end
task :test do
Rake::Task["test:friendly_id"].invoke
Rake::Task["test:ar"].invoke
end
namespace :test do
task :rails do
rm_rf "fid"
sh "rails --template extras/template-gem.rb fid"
sh "cd fid; rake test"
end
Rake::TestTask.new(:friendly_id) { |t| t.pattern = "test/*_test.rb" }
Rake::TestTask.new(:ar) { |t| t.pattern = "test/active_record2/*_test.rb" }
namespace :rails do
task :plugin do
rm_rf "fid"
sh "rails --template extras/template-plugin.rb fid"
sh "cd fid; rake test"
end
end
end
task :pushdocs do
branch = `git branch | grep "*"`.chomp.gsub("* ", "")
sh "git stash"
sh "git checkout gh-pages"
sh "cp -rp doc/* ."
sh 'git commit -a -m "Regenerated docs"'
sh "git push origin gh-pages"
sh "git checkout #{branch}"
sh "git stash apply"
end