forked from datamapper/do
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
71 lines (57 loc) · 1.8 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 'pathname'
require 'rubygems'
require 'rake'
require 'rubygems/package_task'
ROOT = Pathname(__FILE__).dirname.expand_path
JRUBY = RUBY_PLATFORM =~ /java/
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
# RCov is run by default, except on the JRuby and IronRuby platforms, or if NO_RCOV env is true
RUN_RCOV = JRUBY || IRONRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
jruby_projects = %w[do_jdbc do_derby do_h2 do_hsqldb]
projects = %w[data_objects]
projects += %w[do_mysql do_postgres do_sqlite3 do_sqlserver do_oracle]
projects += jruby_projects if JRUBY
def rake(cmd)
ruby "-S rake #{cmd}", :verbose => false
end
desc 'Release all do gems'
task :release do
(jruby_projects + projects).uniq.each do |dir|
Dir.chdir(dir){ rake "release_all" }
end
end
tasks = {
:install => 'Install the do gems',
:build_all => 'Package the do gems',
:clean => 'clean temporary files',
:clobber => 'clobber temporary files',
}
task :default => [:spec]
desc 'Run all the specs for the subprojects'
task :spec do
commands = [
'mysql -u root -e "create database do_test;"',
'psql -c "create database do_test;" -U postgres',
]
commands.each do |command|
`#{command}`
end
spec_projects = %w[data_objects do_mysql do_postgres do_sqlite3]
if JRUBY
spec_projects += %w[do_derby do_h2 do_hsqldb]
Dir.chdir("do_jdbc") { rake :compile }
end
spec_projects.each do |gem_name|
Dir.chdir(gem_name) { rake :spec }
end
end
tasks.each do |name, description|
desc description
task name do
(jruby_projects + projects).each do |gem_name|
Dir.chdir(gem_name){ rake name }
end
end
end