Class: Zwite::Appcast
Instance Attribute Summary collapse
-
#releases ⇒ Object
Properties.
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from Plugin
#enabled?, inherited, #initialize, subclasses
Constructor Details
This class inherits a constructor from Zwite::Plugin
Instance Attribute Details
#releases ⇒ Object
Properties
111 112 113 |
# File 'lib/zwite/plugins/appcast.rb', line 111 def releases @releases end |
Instance Method Details
#generate ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/zwite/plugins/appcast.rb', line 144 def generate appcast_output_path = self.app.output_path + "appcast" appcast_output_path.mkpath feed_path = appcast_output_path + "index.xml" feed_path.parent.mkpath feed_path.open("w") do |h| h.write(self.app.render_template("appcast/appcast.xml", {"releases" => self.releases})) end index_path = appcast_output_path + "releases/index.html" index_path.parent.mkpath index_path.open("w") do |h| h.write(self.app.render_template("appcast/notes.html", {"releases" => self.releases})) end self.releases.each do |release| release_path = release.output_path + "index.html" release_path.parent.mkpath release_path.open("w") do |h| h.write(self.app.render_template("appcast/notes.html", {"releases" => [release]})) end FileUtils.copy(release.file_path, release_path.parent) end end |
#name ⇒ Object
113 114 115 |
# File 'lib/zwite/plugins/appcast.rb', line 113 def name return "appcast" end |
#preprocess ⇒ Object
Actions
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/zwite/plugins/appcast.rb', line 128 def preprocess super self.releases = [] appcast_path = self.app.path + "appcast" appcast_signature_key_path = appcast_path + "signature_key.pem" appcast_signature_key = OpenSSL::PKey::DSA.new(appcast_signature_key_path.read) releases_path = appcast_path + "releases" Dir[appcast_path + "releases/*"].each do |p| self.releases << AppcastRelease.new(self.app, Pathname.new(p), appcast_signature_key) end self.releases.sort! end |
#to_liquid ⇒ Object
117 118 119 120 121 122 |
# File 'lib/zwite/plugins/appcast.rb', line 117 def to_liquid return { "latest_release" => self.releases[0], "releases" => self.releases } end |