aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
blob: 0564da23ca0c43da1d21f21b643202110f54e628 (plain) (blame)
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
require "rubygems"

begin
  require 'jeweler'
rescue LoadError
  desc "Install gem using sudo"
  task(:install) do
    $stderr.puts "Jeweler not available. `gem install jeweler` to install this gem"
  end
else
  Jeweler::Tasks.new do |s|
    s.name      = "arel"
    s.authors   = ["Bryan Helmkamp", "Nick Kallen"]
    s.email     = "bryan" + "@" + "brynary.com"
    s.homepage  = "http://github.com/brynary/arel"
    s.summary   = "Arel is a relational algebra engine for Ruby"
    s.description  = <<-EOS.strip
Arel is a Relational Algebra for Ruby. It 1) simplifies the generation complex
of SQL queries and it 2) adapts to various RDBMS systems. It is intended to be
a framework framework; that is, you can build your own ORM with it, focusing on
innovative object and collection modeling as opposed to database compatibility
and query generation.
EOS
    s.rubyforge_project = "arel"
    s.extra_rdoc_files = %w(README.markdown)

    s.add_dependency "activerecord", ">= 3.0pre"
    s.add_dependency "activesupport", ">= 3.0pre"
  end

  Jeweler::RubyforgeTasks.new
end

begin
  require "spec/rake/spectask"
rescue LoadError
  desc "Run specs"
  task(:spec) { $stderr.puts '`gem install rspec` to run specs' }
else
  desc "Run specs using RCov (uses mysql database adapter)"
  Spec::Rake::SpecTask.new(:coverage) do |t|
    t.spec_files =
      ["spec/connections/mysql_connection.rb"] +
      FileList['spec/**/*_spec.rb']

    t.rcov = true
    t.rcov_opts << '--exclude' << "spec,gems"
    t.rcov_opts << '--text-summary'
    t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
    t.rcov_opts << '--only-uncovered'
  end

  namespace :spec do
    for adapter in %w[mysql sqlite3 postgresql]
      desc "Run specs with the #{adapter} database adapter"
      Spec::Rake::SpecTask.new(adapter) do |t|
        t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
        t.libs << "#{File.dirname(__FILE__)}/vendor/rails/activerecord/lib"
        t.libs << "#{File.dirname(__FILE__)}/spec"
        t.warning = true
        t.spec_files =
          ["spec/connections/#{adapter}_connection.rb"] +
          ["spec/schemas/#{adapter}_schema.rb"] +
          FileList['spec/**/*_spec.rb']
      end
    end
  end

  desc "Run specs with mysql and sqlite3 database adapters (default)"
  task :spec => ["check_dependencies", "spec:sqlite3", "spec:mysql", "spec:postgresql"]

  desc "Default task is to run specs"
  task :default => :spec
end

desc 'Removes trailing whitespace'
task :whitespace do
  sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end