Class: Zwite::AppcastRelease
Instance Attribute Summary collapse
-
#app ⇒ Object
Properties.
-
#build ⇒ Object
Returns the value of attribute build.
-
#date ⇒ Object
Returns the value of attribute date.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#file_signature ⇒ Object
Returns the value of attribute file_signature.
-
#file_size ⇒ Object
Returns the value of attribute file_size.
-
#file_size_mb ⇒ Object
Returns the value of attribute file_size_mb.
-
#file_url ⇒ Object
Returns the value of attribute file_url.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#path ⇒ Object
Returns the value of attribute path.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Actions.
-
#initialize(app, path, signature_key) ⇒ AppcastRelease
constructor
Initialization.
- #to_liquid ⇒ Object
Constructor Details
#initialize(app, path, signature_key) ⇒ AppcastRelease
Initialization
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/zwite/plugins/appcast.rb', line 53 def initialize(app, path, signature_key) self.app = app self.path = path Zwite::Utils.parse_date_and_slug(self.path.basename.to_s) do |date, slug| self.date = date self.slug = slug end rel_path = (self.path.parent + self.slug).relative_path_from(self.app.path).to_s self.output_path = self.app.output_path + rel_path self.url = self.app.url + rel_path + "/" Zwite::Utils.((self.path + "release.md").read) do |, markdown| self. = self.notes = markdown end self.name = self.["name"] self.version = self.["version"] self.build = self.["build"] self.file_path = self.path + self.["file"] self.file_name = self.file_path.basename.to_s self.file_url = self.url + self.file_path.basename.to_s self.file_size = self.file_path.size self.file_size_mb = "%.2f" % (self.file_size / 1024.0 / 1024.0) signature = OpenSSL::Digest::SHA1.new self.file_path.open("r") do |h| while buffer = h.read(1024) signature << buffer end end self.file_signature = Base64.strict_encode64(signature_key.syssign(signature.digest)) end |
Instance Attribute Details
#build ⇒ Object
Returns the value of attribute build.
23 24 25 |
# File 'lib/zwite/plugins/appcast.rb', line 23 def build @build end |
#date ⇒ Object
Returns the value of attribute date.
12 13 14 |
# File 'lib/zwite/plugins/appcast.rb', line 12 def date @date end |
#file_name ⇒ Object
Returns the value of attribute file_name.
26 27 28 |
# File 'lib/zwite/plugins/appcast.rb', line 26 def file_name @file_name end |
#file_path ⇒ Object
Returns the value of attribute file_path.
25 26 27 |
# File 'lib/zwite/plugins/appcast.rb', line 25 def file_path @file_path end |
#file_signature ⇒ Object
Returns the value of attribute file_signature.
30 31 32 |
# File 'lib/zwite/plugins/appcast.rb', line 30 def file_signature @file_signature end |
#file_size ⇒ Object
Returns the value of attribute file_size.
28 29 30 |
# File 'lib/zwite/plugins/appcast.rb', line 28 def file_size @file_size end |
#file_size_mb ⇒ Object
Returns the value of attribute file_size_mb.
29 30 31 |
# File 'lib/zwite/plugins/appcast.rb', line 29 def file_size_mb @file_size_mb end |
#file_url ⇒ Object
Returns the value of attribute file_url.
27 28 29 |
# File 'lib/zwite/plugins/appcast.rb', line 27 def file_url @file_url end |
#metadata ⇒ Object
Returns the value of attribute metadata.
18 19 20 |
# File 'lib/zwite/plugins/appcast.rb', line 18 def @metadata end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/zwite/plugins/appcast.rb', line 21 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
19 20 21 |
# File 'lib/zwite/plugins/appcast.rb', line 19 def notes @notes end |
#output_path ⇒ Object
Returns the value of attribute output_path.
15 16 17 |
# File 'lib/zwite/plugins/appcast.rb', line 15 def output_path @output_path end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/zwite/plugins/appcast.rb', line 10 def path @path end |
#slug ⇒ Object
Returns the value of attribute slug.
13 14 15 |
# File 'lib/zwite/plugins/appcast.rb', line 13 def slug @slug end |
#url ⇒ Object
Returns the value of attribute url.
16 17 18 |
# File 'lib/zwite/plugins/appcast.rb', line 16 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
22 23 24 |
# File 'lib/zwite/plugins/appcast.rb', line 22 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
Actions
96 97 98 99 100 101 |
# File 'lib/zwite/plugins/appcast.rb', line 96 def <=>(other) if other.class == self.class return other.date <=> self.date end return nil end |
#to_liquid ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/zwite/plugins/appcast.rb', line 32 def to_liquid return { "date" => self.date, "slug" => self.slug, "url" => self.url, "metadata" => self., "notes" => self.notes, "name" => self.name, "version" => self.version, "file_name" => self.file_name, "file_url" => self.file_url, "file_size" => self.file_size, "file_size_mb" => self.file_size_mb, "file_signature" => self.file_signature } end |