Class: Rocksteady::Corpus

Inherits:
Object
  • Object
show all
Defined in:
lib/rocksteady/corpus.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Corpus

Returns a new instance of Corpus.



9
10
11
# File 'lib/rocksteady/corpus.rb', line 9

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/rocksteady/corpus.rb', line 8

def app
  @app
end

Instance Method Details

#add_repos(*paths) ⇒ Object



31
32
33
34
35
36
# File 'lib/rocksteady/corpus.rb', line 31

def add_repos(*paths)
  paths.each do |path|
    repo = Grit::Repo.new(path)
    repos[name_of(repo)] = repo
  end
end

#add_scenario(*args, &block) ⇒ Object



19
20
21
22
23
# File 'lib/rocksteady/corpus.rb', line 19

def add_scenario(*args, &block)
  scenario = Scenario.new(self, *args, &block)
  scenarios << scenario
  scenario
end

#default_refs!Object



44
45
46
47
48
# File 'lib/rocksteady/corpus.rb', line 44

def default_refs!
  repos.each_key do |repo_name|
    refs[repo_name] ||= 'master'
  end
end

#refsObject

REFS



40
41
42
# File 'lib/rocksteady/corpus.rb', line 40

def refs
  @refs ||= {}
end

#reposObject

REPOS



27
28
29
# File 'lib/rocksteady/corpus.rb', line 27

def repos
  @repos ||= {}
end

#scenariosObject

SCENARIOS



15
16
17
# File 'lib/rocksteady/corpus.rb', line 15

def scenarios
  @scenarios ||= []
end

#scheduleObject



63
64
65
# File 'lib/rocksteady/corpus.rb', line 63

def schedule
  @schedule ||= []
end

#sessionObject



59
60
61
# File 'lib/rocksteady/corpus.rb', line 59

def session
  @session ||= Session.new(self)
end

#verify_refs!Object



50
51
52
53
54
55
56
57
# File 'lib/rocksteady/corpus.rb', line 50

def verify_refs!
  refs.each do |repo_name, ref|
    repo = repos[repo_name]
    unless repo.log(ref).any?
      raise ArgumentError, "Could not find #{repo_name} ref `#{ref}'"
    end
  end
end