Sha256: 59ee0297483fce139b31a2c640010d0366628a3bebc0433e147d210066a4a404
Contents?: true
Size: 1.01 KB
Versions: 23
Compression:
Stored size: 1.01 KB
Contents
require "rspec" require "gitlab_exporter" require "open3" require "tmpdir" $LOAD_PATH.unshift File.expand_path(".") Dir["spec/support/**/*.rb"].each do |f| require f end class GitRepoBuilder def origin @origin ||= create_origin end def cloned_repo @cloned_repo ||= clone_origin end def cleanup FileUtils.rm_r(@origin) if @origin FileUtils.rm_r(@cloned_repo) if @cloned_repo end private def create_origin path = Dir.mktmpdir Open3.capture3("git init", chdir: path) Open3.capture3("git commit --allow-empty -m 'Beep'", chdir: path) Open3.capture3("git checkout -b other", chdir: path) path end def clone_origin path = Dir.mktmpdir Dir.rmdir(path) Open3.capture3("git clone #{origin} #{path}") Open3.capture3("git checkout master", chdir: path) path end end class CLIArgs def initialize(args) @arguments = args end def options yield self end def on(*args); end def banner=(banner); end def parse! @arguments end end
Version data entries
23 entries across 23 versions & 1 rubygems