Sha256: 3f650e96215185a8a676bd74b932d351eab0f98258cba8e604f2d157bf5f93e1
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# encoding: UTF-8 require 'fileutils' module RepoFixture class Fixture DEFAULT_STRATEGY = :zip attr_reader :repo def initialize(repo) @repo = repo repo.git('config --global user.email "fake@example.com"') repo.git('config --global user.name "Fake Person"') end # Copies files into the repo. # Optional block receives each file, return value is the desired path inside the archive. def copy_files(files) Array(files).each do |file| output_file = if block_given? yield file else file end output_file = File.join(repo.working_dir, output_file) FileUtils.mkdir_p(File.dirname(output_file)) FileUtils.cp(file, output_file) end end def respond_to?(method) repo.respond_to?(method) end def method_missing(method, *args, &block) repo.send(method, *args, &block) end def export(export_file, strategy = DEFAULT_STRATEGY) strategy_class_for(strategy).export(export_file, self) end def sh(command) repo.in_repo { `#{command}` } end private def strategy_class_for(strategy) RepoFixture.strategy_class_for(strategy) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
repo-fixture-1.0.1 | lib/repo-fixture/fixture.rb |