Sha256: 10c580d5c30fd7d9247a0b51e266f42ab7dffdd6b2617f3fdf4219a7fa5580f2

Contents?: true

Size: 1.59 KB

Versions: 81

Compression:

Stored size: 1.59 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

81 entries across 81 versions & 1 rubygems

Version Path
eac_tools-0.85.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.85.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.84.2 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.84.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.84.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.83.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.82.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.81.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.80.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.79.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.78.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.77.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.77.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.76.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.76.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.75.2 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.75.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.75.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.74.1 sub/avm-tools/spec/spec_helper/eac_launcher.rb
eac_tools-0.74.0 sub/avm-tools/spec/spec_helper/eac_launcher.rb