class Appraisal::Appraisal

Represents one appraisal and its dependencies

Attributes

gemfile[R]
name[R]

Public Class Methods

new(name, source_gemfile) click to toggle source
# File lib/appraisal/appraisal.rb, line 10
def initialize(name, source_gemfile)
  @name = name
  @gemfile = source_gemfile.dup
end

Public Instance Methods

bundle_command() click to toggle source
# File lib/appraisal/appraisal.rb, line 39
def bundle_command
  gemfile = "--gemfile='#{gemfile_path}'"
  "bundle check #{gemfile} || bundle install #{gemfile}"
end
gem(name, *requirements) click to toggle source
# File lib/appraisal/appraisal.rb, line 15
def gem(name, *requirements)
  gemfile.gem(name, *requirements)
end
gemfile_path() click to toggle source
# File lib/appraisal/appraisal.rb, line 31
def gemfile_path
  unless ::File.exist?(gemfile_root)
    FileUtils.mkdir(gemfile_root)
  end

  ::File.join(gemfile_root, "#{clean_name}.gemfile")
end
install() click to toggle source
# File lib/appraisal/appraisal.rb, line 27
def install
  Command.new(bundle_command).run
end
write_gemfile() click to toggle source
# File lib/appraisal/appraisal.rb, line 19
def write_gemfile
  ::File.open(gemfile_path, "w") do |file|
    file.puts("# This file was generated by Appraisal")
    file.puts
    file.write(gemfile.to_s)
  end
end