Module: Buffet

Defined in:
lib/buffet.rb,
lib/buffet/cli.rb,
lib/buffet/slave.rb,
lib/buffet/master.rb,
lib/buffet/runner.rb,
lib/buffet/project.rb,
lib/buffet/version.rb,
lib/buffet/settings.rb,
lib/buffet/command_runner.rb

Defined Under Namespace

Classes: CLI, CommandRunner, Master, Project, Runner, Settings, Slave

Constant Summary collapse

VERSION =
'0.6'

Class Method Summary collapse

Class Method Details

.extract_specs_from(files) ⇒ Object

Given a set of files/directories, return all spec files contained



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

def self.extract_specs_from files
  specs = []
  files.each do |spec_file|
    Find.find(spec_file) do |f|
      specs << f if f.match /_spec\.rb$/
    end
  end
  specs.uniq
end

.logdirObject



14
15
16
# File 'lib/buffet.rb', line 14

def self.logdir
  @logdir ||= Pathname.new(ENV['HOME']) + '.buffet/log'
end

.logfileObject



18
19
20
# File 'lib/buffet.rb', line 18

def self.logfile
  'buffet.log'
end

.loggerObject



22
23
24
25
26
27
# File 'lib/buffet.rb', line 22

def self.logger
  @logger ||= begin
    FileUtils.mkdir_p logdir
    Logger.new logdir + logfile
  end
end

.run!(*command) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/buffet.rb', line 33

def self.run! *command
  result = runner.run *command
  unless result.success?
    logger.error 'exiting due to non-zero exit status'
    exit result.status
  end
  result
end

.runnerObject



29
30
31
# File 'lib/buffet.rb', line 29

def self.runner
  @runner ||= CommandRunner.new logger
end

.userObject



57
58
59
# File 'lib/buffet.rb', line 57

def self.user
  @user ||= `whoami`.chomp
end

.workspace_dirObject



53
54
55
# File 'lib/buffet.rb', line 53

def self.workspace_dir
  ".buffet/workspaces/#{user}" # Relative to home directory
end