Class: Gifts::RepoTable
Instance Method Summary
collapse
Methods inherited from TableBase
#initialize
Instance Method Details
#add(path) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/gifts/repo_table.rb', line 16
def add(path)
path = File.expand_path(path)
git_repo = Grit::Repo.new(path)
db_repo = table[path] || table.add(path, path: path)
db_commits = @db.commits.add(git_repo, db_repo)
db_repo.last_commit_key = db_commits.first.key if db_commits.count > 0
pp "add", db_commits.count, db_repo.last_commit_key
db_repo
end
|
#define_schema ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/gifts/repo_table.rb', line 7
def define_schema
Groonga::Schema.define do |schema|
schema.create_table(table_name, type: :hash) do |table|
table.string("path")
table.string("last_commit_key")
end
end
end
|
#table_name ⇒ Object
3
4
5
|
# File 'lib/gifts/repo_table.rb', line 3
def table_name
"repo"
end
|