-
Notifications
You must be signed in to change notification settings - Fork 30
/
Rakefile
71 lines (59 loc) · 2.23 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
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
ENV['RAILS_ENV'] = "test"
require File.expand_path("#{File.dirname(__FILE__)}/config/solr_environment")
Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load ext }
desc "Default Task"
task :default => [:test]
desc "Runs the unit tests"
task :test => "test:unit"
namespace :test do
task :setup do
DB ||= 'sqlite'
puts "Using " + DB
%x(mysql -u#{MYSQL_USER} < #{File.dirname(__FILE__) + "/test/fixtures/db_definitions/mysql.sql"}) if DB == 'mysql'
Rake::Task["test:migrate"].invoke
end
desc 'Measures test coverage using rcov'
task :rcov => :setup do
rm_f "coverage"
rm_f "coverage.data"
rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib"
system("#{rcov} --html #{Dir.glob('test/**/*_shoulda.rb').join(' ')}")
system("open coverage/index.html") if PLATFORM['darwin']
end
desc 'Runs the functional tests, testing integration with Solr'
Rake::TestTask.new(:functional => :setup) do |t|
t.pattern = "test/functional/*_test.rb"
t.verbose = true
end
desc "Unit tests"
Rake::TestTask.new(:unit => :setup) do |t|
t.libs << 'test/unit'
t.pattern = "test/unit/*_shoulda.rb"
t.verbose = true
end
end
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_dir = "rdoc"
rd.rdoc_files.exclude("lib/solr/**/*.rb", "lib/solr.rb")
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
end
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "acts_as_solr_reloaded"
s.summary = "This gem adds full text search capabilities and many other nifty features from Apache Solr to any Rails model."
s.email = "[email protected]"
s.homepage = "http://github.com/dcrec1/acts_as_solr_reloaded"
s.description = "This gem adds full text search capabilities and many other nifty features from Apache Solr to any Rails model."
s.authors = ["Diego Carrion"]
s.files = FileList["[A-Z]*", "{bin,generators,config,lib,solr}/**/*"] +
FileList["test/**/*"].reject {|f| f.include?("test/log")}.reject {|f| f.include?("test/tmp")}
end
rescue LoadError
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
end