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
|
# File 'lib/schema_dev/travis.rb', line 12
def build(config)
env = []
env << 'POSTGRESQL_DB_USER=postgres' if config.dbms.include? :postgresql
env << 'MYSQL_DB_USER=travis' if config.dbms.include? :mysql
env = env.join(' ')
gemfiles = config.matrix.map{|entry| GemfileSelector.gemfile(entry.slice(:rails, :db)).to_s}.uniq
exclude = config.matrix(excluded: :only).map { |entry| {}.tap {|ex|
ex["rvm"] = entry[:ruby]
ex["gemfile"] = GemfileSelector.gemfile(entry.slice(:rails, :db)).to_s
ex["env"] = env if config.dbms.any?
}}.reject{|ex| not gemfiles.include? ex["gemfile"]}
{}.tap { |travis|
travis["sudo"] = false
travis["rvm"] = config.ruby.sort
travis["gemfile"] = gemfiles.sort
if config.dbms.any?
travis["env"] = env
travis["before_script"] = 'bundle exec rake create_databases'
travis["after_script"] = 'bundle exec rake drop_databases'
end
travis["script"] = "bundle exec rake travis"
travis["notifications"] = { "email" => config.notify } if config.notify.any?
travis["matrix"] = { "exclude" => exclude.sort_by{|ex| [ex["rvm"], ex["gemfile"]]} } if exclude.any?
}
end
|