Sha256: 533f9b2c7ecc91010b67eb59fb055498f3e426e54e40dcaeb057496af50acd8c

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

DUMMY_DIR = File.expand_path('../dummy', __dir__)
ROOT_DIR = File.expand_path('../..', __dir__)

require 'avm/launcher/context'

RSpec.configure do |config|
  config.before do
    require 'avm/launcher/context'
    Avm::Launcher::Context.current = Avm::Launcher::Context.new(
      projects_root: DUMMY_DIR,
      settings_file: File.join(__dir__, 'eac_launcher', 'settings.yml'),
      cache_root: Dir.mktmpdir
    )
    @remotes_dir = Dir.mktmpdir
    allow(ProgressBar).to receive(:create).and_return(double.as_null_object)
  end

  def temp_context(settings_path)
    require 'avm/launcher/context'
    require 'tmpdir'
    Avm::Launcher::Context.current = Avm::Launcher::Context.new(
      projects_root: Dir.mktmpdir, settings_file: settings_path, cache_root: Dir.mktmpdir
    )
  end

  def init_remote(name)
    require 'avm/git/launcher/base'
    r = Avm::Git::Launcher::Base.new(File.join(@remotes_dir, name))
    r.init_bare
    r
  end

  def init_git(subdir)
    require 'avm/git/launcher/base'
    r = Avm::Git::Launcher::Base.new(File.join(Avm::Launcher::Context.current.root.real,
                                               subdir))
    r.git
    r.execute!('config', 'user.email', 'theuser@example.net')
    r.execute!('config', 'user.name', 'The User')
    r
  end

  def touch_commit(repos, subpath)
    require 'fileutils'
    FileUtils.mkdir_p(File.dirname(repos.subpath(subpath)))
    FileUtils.touch(repos.subpath(subpath))
    repos.execute!('add', repos.subpath(subpath))
    repos.execute!('commit', '-m', subpath)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
eac_tools-0.87.1 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.87.0 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.12 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.11 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.8 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.7 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.5 sub/avm/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.4 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.3 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.2 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.86.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb