Module: Specjour

Defined in:
lib/specjour.rb,
lib/specjour/cli.rb,
lib/specjour/cpu.rb,
lib/specjour/rspec.rb,
lib/specjour/loader.rb,
lib/specjour/worker.rb,
lib/specjour/manager.rb,
lib/specjour/printer.rb,
lib/specjour/cucumber.rb,
lib/specjour/db_scrub.rb,
lib/specjour/protocol.rb,
lib/specjour/connection.rb,
lib/specjour/dispatcher.rb,
lib/specjour/rsync_daemon.rb,
lib/specjour/configuration.rb,
lib/specjour/socket_helper.rb,
lib/specjour/cucumber/runner.rb,
lib/specjour/cucumber/preloader.rb,
lib/specjour/cucumber/final_report.rb

Defined Under Namespace

Modules: CPU, Configuration, Cucumber, DbScrub, Fork, Protocol, RSpec, SocketHelper Classes: CLI, Connection, Dispatcher, Error, Loader, Manager, Printer, RsyncDaemon, Worker

Class Method Summary collapse

Class Method Details

.benchmark(msg, &block) ⇒ Object



84
85
86
87
88
# File 'lib/specjour.rb', line 84

def self.benchmark(msg, &block)
  print "#{msg}... "
  time = Benchmark.realtime &block
  puts "completed in #{time}s"
end

.interrupted=(bool) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/specjour.rb', line 44

def self.interrupted=(bool)
  @interrupted = bool
  if bool
    will_quit(:RSpec)
    will_quit(:Cucumber)
  end
end

.interrupted?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/specjour.rb', line 40

def self.interrupted?
  @interrupted
end

.load_custom_hooksObject



73
74
75
# File 'lib/specjour.rb', line 73

def self.load_custom_hooks
  load HOOKS_PATH if File.exists?(HOOKS_PATH)
end

.log?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/specjour.rb', line 69

def self.log?
  logger.level != Logger::UNKNOWN
end

.loggerObject



59
60
61
# File 'lib/specjour.rb', line 59

def self.logger
  @logger ||= new_logger
end

.new_logger(level = Logger::UNKNOWN) ⇒ Object



63
64
65
66
67
# File 'lib/specjour.rb', line 63

def self.new_logger(level = Logger::UNKNOWN)
  @logger = Logger.new $stderr
  @logger.level = level
  @logger
end

.trap_interruptObject



77
78
79
80
81
82
# File 'lib/specjour.rb', line 77

def self.trap_interrupt
  Signal.trap('INT') do
    self.interrupted = true
    abort("\n")
  end
end

.will_quit(framework) ⇒ Object



52
53
54
55
56
57
# File 'lib/specjour.rb', line 52

def self.will_quit(framework)
  if Object.const_defined?(framework)
    framework = Object.const_get(framework)
    framework.wants_to_quit = true if framework.respond_to?(:wants_to_quit=)
  end
end