Class: Volley::Publisher::Local

Inherits:
Base
  • Object
show all
Defined in:
lib/volley/publisher/local.rb

Instance Attribute Summary

Attributes inherited from Base

#force

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latest, #latest_release, #latest_version, #list, #pull, #push, #release, #released_from, #volleyfile

Constructor Details

This class inherits a constructor from Volley::Publisher::Base

Instance Method Details

#allObject



5
6
7
# File 'lib/volley/publisher/local.rb', line 5

def all
  #TODO: make this work like the S3 version
end

#branches(pr) ⇒ Object



14
15
16
# File 'lib/volley/publisher/local.rb', line 14

def branches(pr)
  Dir["#@directory/#{pr}/*"].map {|e| e.gsub(/#@directory\/#{pr}\//,"")}.reject {|e| ["latest_release"].include?(e)}
end

#contents(project, branch, version) ⇒ Object



29
30
31
32
33
34
# File 'lib/volley/publisher/local.rb', line 29

def contents(project, branch, version)
  d = "#@directory/#{project}/#{branch}/#{version}"
  Dir["#{d}/*"].map do |e|
    e.gsub("#{d}/","")
  end
end

#delete_branch(project, branch) ⇒ Object



54
55
56
# File 'lib/volley/publisher/local.rb', line 54

def delete_branch(project, branch)
  delete_files("#{project}/#{branch}")
end

#delete_project(project) ⇒ Object



50
51
52
# File 'lib/volley/publisher/local.rb', line 50

def delete_project(project)
  delete_files("#{project}")
end

#delete_version(project, branch, version) ⇒ Object



58
59
60
# File 'lib/volley/publisher/local.rb', line 58

def delete_version(project, branch, version)
  delete_files("#{project}/#{branch}/#{version}")
end

#exists?(project, branch, version) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/volley/publisher/local.rb', line 24

def exists?(project, branch, version)
  d = "#@directory/#{project}/#{branch}/#{version}"
  File.directory?(d)
end

#projectsObject



9
10
11
12
# File 'lib/volley/publisher/local.rb', line 9

def projects
  l = Dir["#@directory/*"]
  l.map {|e| e.gsub(/#@directory\//,"")}
end

#version_data(project, branch, version) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/volley/publisher/local.rb', line 36

def version_data(project, branch, version)
  pr    = project.to_s
  br    = branch.to_s
  vr    = version.to_s
  list  = Dir["#@directory/#{project}/#{branch}/#{version}/*"]
  files = contents(project, branch, version)
  time  = list.map { |e| File.mtime(e) }.sort.uniq.last
  {
      :contents  => files,
      :timestamp => time,
      :latest => (latest_version(project, branch) == vr)
  }
end

#versions(pr, br) ⇒ Object



18
19
20
21
22
# File 'lib/volley/publisher/local.rb', line 18

def versions(pr, br)
  Dir["#@directory/#{pr}/#{br}/*"].map do |e|
    e.gsub(/#@directory\/#{pr}\/#{br}\//,"")
  end.reject { |e| ["","latest","latest_release"].include?(e) }
end