Sha256: 911f2601b536c42627250e4490253f1c296d3cb92973d4b325993eda0379eb05

Contents?: true

Size: 861 Bytes

Versions: 9

Compression:

Stored size: 861 Bytes

Contents

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

module Appraisal
  # Loads and parses Appraisals file
  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')

      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

9 entries across 7 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/appraisal-1.0.2/lib/appraisal/file.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/appraisal-1.0.2/lib/appraisal/file.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/appraisal-1.0.2/lib/appraisal/file.rb
appraisal-2.1.0 lib/appraisal/file.rb
appraisal-2.0.2 lib/appraisal/file.rb
appraisal-2.0.1 lib/appraisal/file.rb
appraisal-2.0.0 lib/appraisal/file.rb
appraisal-1.0.3 lib/appraisal/file.rb
appraisal-1.0.2 lib/appraisal/file.rb