class Build
Constants
- MAP
Attributes
component[R]
options[R]
Public Class Methods
new(component, options = {})
click to toggle source
# File ci/travis.rb, line 39 def initialize(component, options = {}) @component = component @options = options end
Public Instance Methods
activerecord?()
click to toggle source
# File ci/travis.rb, line 96 def activerecord? gem == "activerecord" end
activesupport?()
click to toggle source
# File ci/travis.rb, line 92 def activesupport? gem == "activesupport" end
adapter()
click to toggle source
# File ci/travis.rb, line 121 def adapter component.split(":").last end
announce(heading)
click to toggle source
# File ci/travis.rb, line 58 def announce(heading) puts "\n\e[1;33m[Travis CI] #{heading}\e[m\n" end
env()
click to toggle source
# File ci/travis.rb, line 134 def env if activesupport? && !isolated? # There is a known issue with the listen tests that causes files to be # incorrectly GC'ed even when they are still in-use. The current solution # is to only run them in isolation to avoid randomly failing our test suite. { "LISTEN" => "0" } else {} end end
gem()
click to toggle source
# File ci/travis.rb, line 116 def gem MAP[component.split(":").first] end
Also aliased as: dir
guides?()
click to toggle source
# File ci/travis.rb, line 100 def guides? gem == "guides" end
heading()
click to toggle source
# File ci/travis.rb, line 62 def heading heading = [gem] heading << "with #{adapter}" if activerecord? heading << "in isolation" if isolated? heading << "integration" if integration? heading.join(" ") end
integration?()
click to toggle source
# File ci/travis.rb, line 112 def integration? component.split(":").last == "integration" end
isolated?()
click to toggle source
# File ci/travis.rb, line 108 def isolated? options[:isolated] end
key()
click to toggle source
# File ci/travis.rb, line 85 def key key = [gem] key << adapter if activerecord? key << "isolated" if isolated? key.join(":") end
rake(*tasks)
click to toggle source
# File ci/travis.rb, line 125 def rake(*tasks) tasks.each do |task| cmd = "bundle exec rake #{task}" puts "Running command: #{cmd}" return false unless system(env, cmd) end true end
run!(options = {})
click to toggle source
# File ci/travis.rb, line 44 def run!(options = {}) self.options.update(options) Dir.chdir(dir) do announce(heading) if guides? run_bug_report_templates else rake(*tasks) end end end
run_bug_report_templates()
click to toggle source
# File ci/travis.rb, line 145 def run_bug_report_templates Dir.glob("bug_report_templates/*.rb").all? do |file| system(Gem.ruby, "-w", file) end end
tasks()
click to toggle source
# File ci/travis.rb, line 70 def tasks if activerecord? tasks = ["#{adapter}:#{'isolated_' if isolated?}test"] case adapter when "mysql2" tasks.unshift "db:mysql:rebuild" when "postgresql" tasks.unshift "db:postgresql:rebuild" end tasks else ["test", ("isolated" if isolated?), ("integration" if integration?), ("ujs" if ujs?)].compact.join(":") end end
ujs?()
click to toggle source
# File ci/travis.rb, line 104 def ujs? component.split(":").last == "ujs" end