Class: Volley::Publisher::Amazons3

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

Instance Attribute Summary collapse

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 Attribute Details

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/volley/publisher/amazons3.rb', line 6

def key
  @key
end

#secretObject

Returns the value of attribute secret.



6
7
8
# File 'lib/volley/publisher/amazons3.rb', line 6

def secret
  @secret
end

Instance Method Details

#allObject



8
9
10
# File 'lib/volley/publisher/amazons3.rb', line 8

def all
  files[:all]
end

#branches(project) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/volley/publisher/amazons3.rb', line 21

def branches(project)
  pr = project.to_s
  r = files[:desc][pr].keys || [] rescue []
  Volley::Log.info "could not find #{pr}" unless r.count > 0
  r.reject {|e| ["latest_release"].include?(e)}
rescue => e
  Volley::Log.warn "error getting branch list from publisher: #{e.message}"
  []
end

#contents(project, branch, version) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/volley/publisher/amazons3.rb', line 56

def contents(project, branch, version)
  pr = project.to_s
  br = branch.to_s
  vr = version.to_s
  r = files[:desc][pr][br][vr].map { |e| e.key.gsub("#{pr}/#{br}/#{vr}/", "") } || [] rescue []
  Volley::Log.info "could not find #{pr}@#{br}:#{vr}" unless r.count > 0
  r
rescue => e
  Volley::Log.warn "error getting contents list from publisher: #{e.message}"
  []
end

#delete_branch(project, branch) ⇒ Object



83
84
85
86
# File 'lib/volley/publisher/amazons3.rb', line 83

def delete_branch(project, branch)
  Volley::Log.debug "delete_branch #{project} #{branch}"
  delete_files("#{project}/#{branch}/")
end

#delete_project(project) ⇒ Object



78
79
80
81
# File 'lib/volley/publisher/amazons3.rb', line 78

def delete_project(project)
  Volley::Log.debug "delete_project #{project}"
  delete_files("#{project}/")
end

#delete_version(project, branch, version) ⇒ Object



88
89
90
91
# File 'lib/volley/publisher/amazons3.rb', line 88

def delete_version(project, branch, version)
  Volley::Log.debug "delete_version #{project} #{branch} #{version}"
  delete_files("#{project}/#{branch}/#{version}/")
end

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

Returns:

  • (Boolean)


68
69
70
71
72
73
74
75
76
# File 'lib/volley/publisher/amazons3.rb', line 68

def exists?(project, branch, version)
  pr = project.to_s
  br = branch.to_s
  vr = version.to_s
  !files[:desc][pr][br][vr].nil?
rescue => e
  Volley::Log.debug "exists? error: #{e.message}"
  false
end

#projectsObject



12
13
14
15
16
17
18
19
# File 'lib/volley/publisher/amazons3.rb', line 12

def projects
  r = files[:desc].keys || [] rescue []
  Volley::Log.info "could not find projects" unless r.count > 0
  r
rescue => e
  Volley::Log.warn "error getting project list from publisher: #{e.message} at #{e.backtrace.first}"
  []
end

#version_data(project, branch, version) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/volley/publisher/amazons3.rb', line 42

def version_data(project, branch, version)
  pr    = project.to_s
  br    = branch.to_s
  vr    = version.to_s
  list  = files[:desc][pr][br][vr]
  files = contents(project, branch, version)
  time  = list.map { |e| e.last_modified }.sort.uniq.last
  {
      :contents  => files,
      :timestamp => time,
      :latest => (latest_version(project, branch) == vr)
  }
end

#versions(project, branch) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/volley/publisher/amazons3.rb', line 31

def versions(project, branch)
  pr = project.to_s
  br = branch.to_s
  r = files[:desc][pr][br].keys || [] rescue []
  Volley::Log.info "could not find #{pr}@#{br}" unless r.count > 0
  r.reject { |e| ["","latest","latest_release"].include?(e) }
rescue => e
  Volley::Log.warn "error getting version list from publisher: #{e.message}"
  []
end