Class: Database

Inherits:
Object
  • Object
show all
Defined in:
lib/xcodeci/database.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path = "data.yml") ⇒ Database



4
5
6
# File 'lib/xcodeci/database.rb', line 4

def initialize (file_path = "data.yml")
  @store = YAML::Store.new(file_path)
end

Instance Method Details

#should_build_commit(appname, commit_hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xcodeci/database.rb', line 8

def should_build_commit appname, commit_hash
  report = @store.transaction {
    commits = @store[appname]
    if commits.nil?
      nil
    else
      @store[appname][commit_hash]
    end
  }
  report.nil?
end

#store_result(appname, commit_hash, result) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/xcodeci/database.rb', line 20

def store_result appname, commit_hash, result
  @store.transaction do
    @store[appname] ||= Hash.new
    @store[appname][commit_hash] = result
    @store.commit
  end
end