Sha256: e11e22f5dc16eb9b76ddd9d26ed1240643758844cb1c4919727a8ab8e532cbc4

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

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

module Appraisal
  # Loads and parses Appraisal files
  class File
    attr_reader :appraisals, :gemfile

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

    def initialize
      @appraisals = []
      @gemfile = Gemfile.new
      @gemfile.load(ENV['BUNDLE_GEMFILE'] || 'Gemfile')
      run(IO.read(path)) if ::File.exists?(path)
    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

4 entries across 4 versions & 2 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/appraisal-0.5.1/lib/appraisal/file.rb
appraisal-0.5.2 lib/appraisal/file.rb
appraisal-0.5.1 lib/appraisal/file.rb
appraisal-0.5.0 lib/appraisal/file.rb