Sha256: b331807bba78e0e13b14b253fb8a9a03631e04d0b9ecf5c297cc49bc84919b27

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

require 'appraisal/appraisal'
require 'appraisal/errors'
require 'appraisal/gemfile'

module Appraisal
  # Loads and parses Appraisals file
  class AppraisalFile
    attr_reader :appraisals, :gemfile

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

    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

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

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

    private

    def run(definitions)
      instance_eval(definitions, __FILE__, __LINE__)
    end

    def path
      'Appraisals'
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
appraisal-2.4.1 lib/appraisal/appraisal_file.rb
appraisal-2.4.0 lib/appraisal/appraisal_file.rb
appraisal-2.3.0 lib/appraisal/appraisal_file.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/appraisal-2.2.0/lib/appraisal/appraisal_file.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/appraisal-2.2.0/lib/appraisal/appraisal_file.rb
appraisal-2.2.0 lib/appraisal/appraisal_file.rb