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

Returns a new instance of AppraisalFile.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appraisal/appraisal_file.rb', line 17

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.



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

def appraisals
  @appraisals
end

#gemfileObject (readonly)

Returns the value of attribute gemfile.



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

def gemfile
  @gemfile
end

Class Method Details

.each(&block) ⇒ Object



13
14
15
# File 'lib/appraisal/appraisal_file.rb', line 13

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

Instance Method Details

#appraise(name, &block) ⇒ Object



33
34
35
36
37
# File 'lib/appraisal/appraisal_file.rb', line 33

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

#customize_gemfiles(&_block) ⇒ Object



39
40
41
# File 'lib/appraisal/appraisal_file.rb', line 39

def customize_gemfiles(&_block)
  Customize.new(**yield)
end

#each(&block) ⇒ Object



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

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