Class: Appraisal::AppraisalFile

Inherits:
Object
  • Object
show all
Defined in:
lib/appraisal/appraisal_file.rb

Overview

Loads and parses Appraisals file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAppraisalFile


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/appraisal/appraisal_file.rb', line 14

def initialize
  @appraisals = []
  @gemfile = Gemfile.new
  @gemfile.load(ENV['BUNDLE_GEMFILE'] || 'Gemfile')

  if File.exist? path
    run IO.read(path)
  else
    raise AppraisalsNotFound
  end
end

Instance Attribute Details

#appraisalsObject (readonly)

Returns the value of attribute appraisals


8
9
10
# File 'lib/appraisal/appraisal_file.rb', line 8

def appraisals
  @appraisals
end

#gemfileObject (readonly)

Returns the value of attribute gemfile


8
9
10
# File 'lib/appraisal/appraisal_file.rb', line 8

def gemfile
  @gemfile
end

Class Method Details

.each(&block) ⇒ Object


10
11
12
# File 'lib/appraisal/appraisal_file.rb', line 10

def self.each(&block)
  new.each(&block)
end

Instance Method Details

#appraise(name, &block) ⇒ Object


30
31
32
33
34
# File 'lib/appraisal/appraisal_file.rb', line 30

def appraise(name, &block)
  appraisal = Appraisal.new(name, gemfile)
  appraisal.instance_eval(&block)
  @appraisals << appraisal
end

#each(&block) ⇒ Object


26
27
28
# File 'lib/appraisal/appraisal_file.rb', line 26

def each(&block)
  appraisals.each(&block)
end