forked from blambeau/dbagile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
88 lines (79 loc) · 2.7 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
81
82
83
84
85
86
87
88
require "rubygems"
require "rake/rdoctask"
require "rake/testtask"
require 'spec/rake/spectask'
require "rake/gempackagetask"
require "yard"
# Some utils
dir = File.dirname(__FILE__)
lib = File.join(dir, "lib", "dbagile.rb")
version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
# Default task is spec
task :default => [:test]
# Creates the fixtures
desc "Creates physical SQL test databases"
task :physical_databases do
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
$LOAD_PATH.unshift(File.expand_path('../test', __FILE__))
require 'fixtures'
require 'dbagile'
DbAgile::Fixtures::ensure_physical_databases!
end
desc "Creates test fixture databases"
task :fixtures do
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
$LOAD_PATH.unshift(File.expand_path('../test', __FILE__))
require 'dbagile'
require 'fixtures'
DbAgile::Fixtures::create_fixtures
end
tests = Dir[File.expand_path('../test/*.spec', __FILE__)].collect{|f| File.basename(f, '.spec')}
tests.each do |kind|
desc "Run #{kind} spec tests"
Spec::Rake::SpecTask.new("#{kind}_test".to_sym) do |t|
t.ruby_opts = ['-I.']
t.spec_files = FileList["test/#{kind}.spec"]
end
end
desc "Install physical fixtures the run all spec tests"
task :spec => :fixtures do
load(File.expand_path('../test/run_all_suite.rb', __FILE__))
end
desc "Run all spec tests directly"
task :suite do
load(File.expand_path('../test/run_all_suite.rb', __FILE__))
end
# About yard documentation
YARD::Rake::YardocTask.new do |t|
YARD::Tags::Library.define_tag "Precondition", :pre
YARD::Tags::Library.define_tag "Postcondition", :post
t.files = ['lib/**/*.rb']
t.options = ['--output-dir', 'doc/api', '-',
"README.textile", "LICENCE.textile",
"CHANGELOG.textile", "TODO.textile"]
end
# About gem specification
gemspec = Gem::Specification.new do |s|
s.name = 'dbagile'
s.version = version
s.summary = "DbAgile - Agile Interface on top of SQL Databases"
s.description = %{Agile Interface on top of SQL Databases}
s.files = Dir['lib/**/*'] + Dir['test/**/*']
s.require_path = 'lib'
s.has_rdoc = true
s.extra_rdoc_files = ["README.textile", "LICENCE.textile"]
s.rdoc_options << '--title' << 'DbAgile - Agile Interface on top of SQL Databases' <<
'--main' << 'README.textile' <<
'--line-numbers'
s.bindir = "bin"
s.executables = ['dba']
s.author = "Bernard Lambeau"
s.email = "[email protected]"
s.homepage = "http://github.com/blambeau/dbagile"
s.add_dependency('sbyc', '>= 0.1.4')
s.add_dependency('sequel', '>= 0.3.8')
s.add_dependency('highline', '>= 1.5.2')
end
Rake::GemPackageTask.new(gemspec) do |pkg|
pkg.need_tar = true
end