Module: RepoFixture

Defined in:
lib/repo-fixture.rb,
lib/repo-fixture/fixture.rb,
lib/repo-fixture/version.rb,
lib/repo-fixture/zip_strategy.rb

Defined Under Namespace

Classes: Fixture, ZipStrategy

Constant Summary collapse

VERSION =
'1.0.1'

Class Method Summary collapse

Class Method Details

.create {|fixture| ... } ⇒ Object

Yields:

  • (fixture)


9
10
11
12
13
# File 'lib/repo-fixture.rb', line 9

def self.create
  fixture = Fixture.new(TmpRepo.new)
  yield fixture
  fixture
end

.load(file, strategy = Fixture::DEFAULT_STRATEGY) ⇒ Object



15
16
17
# File 'lib/repo-fixture.rb', line 15

def self.load(file, strategy = Fixture::DEFAULT_STRATEGY)
  strategy_class_for(strategy).load(file)
end

.strategy_class_for(strategy) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/repo-fixture.rb', line 19

def self.strategy_class_for(strategy)
  const_str = "#{camelize(strategy.to_s)}Strategy"
  if RepoFixture.const_defined?(const_str)
    RepoFixture.const_get(const_str)
  else
    raise ArgumentError, "'#{strategy}' isn't a valid export strategy."
  end
end