2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/jobs/volley/update.rb', line 2
def work
init
projects = publisher.projects
projects.each do |p|
project = MystroVolley::Project.find_or_create_by(name: p)
publisher.branches(p).each do |b|
branch = MystroVolley::Branch.find_or_create_by(name: b, project_id: project.id)
publisher.versions(p, b).each do |v|
o = publisher.version_data(p, b, v)
d = {
files: o[:contents],
timestamp: o[:timestamp].to_time,
latest: o[:latest]
}
version = MystroVolley::Version.find_or_create_by(name: v, branch_id: branch.id)
version.update_attributes(d)
end
end
end
true
end
|