glitter 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/glitter.rb +27 -13
- data/lib/glitter/templates/rss.xml.erb +4 -4
- data/lib/glitter/version.rb +1 -1
- data/spec/lib/glitter_spec.rb +8 -4
- metadata +3 -3
data/lib/glitter.rb
CHANGED
@@ -103,13 +103,13 @@ module Glitter
|
|
103
103
|
@appcast ||= Appcast.new(self)
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
107
|
-
|
106
|
+
def latest
|
107
|
+
assets[version]
|
108
108
|
end
|
109
109
|
|
110
|
-
def
|
111
|
-
@
|
112
|
-
hash[key] =
|
110
|
+
def assets
|
111
|
+
@assets ||= Hash.new do |hash,key|
|
112
|
+
hash[key] = Asset.new do |r|
|
113
113
|
r.version = key
|
114
114
|
r.app = self
|
115
115
|
end
|
@@ -117,9 +117,8 @@ module Glitter
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
class
|
121
|
-
attr_accessor :app, :version, :notes, :published_at
|
122
|
-
attr_reader :object
|
120
|
+
class Asset
|
121
|
+
attr_accessor :app, :version, :notes, :published_at, :object
|
123
122
|
|
124
123
|
def initialize
|
125
124
|
@published_at = Time.now
|
@@ -145,6 +144,17 @@ module Glitter
|
|
145
144
|
def push
|
146
145
|
object.content = file
|
147
146
|
object.save
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Sets this asset as the head on the S3 bucket
|
151
|
+
def head
|
152
|
+
@head ||= self.class.new do |a|
|
153
|
+
a.app = app
|
154
|
+
a.version = "head"
|
155
|
+
a.published_at = published_at
|
156
|
+
a.object = object.copy(:key => a.object_name)
|
157
|
+
end
|
148
158
|
end
|
149
159
|
|
150
160
|
def file
|
@@ -167,11 +177,15 @@ module Glitter
|
|
167
177
|
desc "push", "pushes a build to S3 with release notes."
|
168
178
|
method_option :release_notes, :type => :string, :aliases => "-m"
|
169
179
|
def push
|
170
|
-
puts "Pushing app #{app.
|
171
|
-
|
172
|
-
app.
|
173
|
-
app.
|
174
|
-
puts "
|
180
|
+
puts "Pushing app #{app.latest.object_name}"
|
181
|
+
|
182
|
+
app.latest.notes = options[:release_notes]
|
183
|
+
app.latest.push
|
184
|
+
puts "Asset pushed to #{app.latest.url}"
|
185
|
+
|
186
|
+
app.latest.head
|
187
|
+
puts "Updated head #{app.latest.head.url} to #{app.latest.url}"
|
188
|
+
|
175
189
|
puts "Updated #{app.appcast.url}"
|
176
190
|
end
|
177
191
|
|
@@ -4,17 +4,17 @@
|
|
4
4
|
<link><%= app.appcast.url %></link>
|
5
5
|
<description>Software updates for <%= app.name %></description>
|
6
6
|
<language>en</language>
|
7
|
-
<% app.
|
7
|
+
<% app.assets.each do |version, asset| %>
|
8
8
|
<item>
|
9
9
|
<title>Version <%= version %></title>
|
10
10
|
<description>
|
11
11
|
<![CDATA[
|
12
12
|
<h2>New Features</h2>
|
13
|
-
<p><%=
|
13
|
+
<p><%= asset.notes %></p>
|
14
14
|
]]>
|
15
15
|
</description>
|
16
|
-
<pubDate><%=
|
17
|
-
<enclosure url="<%=
|
16
|
+
<pubDate><%= asset.published_at.strftime("%a, %d %b %Y %H:%M:%S %z") %></pubDate>
|
17
|
+
<enclosure url="<%= asset.url %>" sparkle:version="2.0" length="<%= asset.file.stat.size %>" type="application/octet-stream" />
|
18
18
|
</item>
|
19
19
|
<% end %>
|
20
20
|
</channel>
|
data/lib/glitter/version.rb
CHANGED
data/spec/lib/glitter_spec.rb
CHANGED
@@ -16,13 +16,17 @@ describe Glitter::App do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Leave this in this order to test sorting.
|
19
|
-
@app.
|
20
|
-
@app.
|
21
|
-
@app.
|
19
|
+
@app.assets["3.0"].notes = "I'm the newest and greatest of them all. 3.0 I am!"
|
20
|
+
@app.assets["1.0"].notes = "Hi dude, 1.0"
|
21
|
+
@app.assets["2.0"].notes = "I'm way better than 2.0"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have latest" do
|
25
|
+
@app.latest.version.should eql("1.0.0")
|
22
26
|
end
|
23
27
|
|
24
28
|
it "should have head" do
|
25
|
-
@app.
|
29
|
+
@app.latest.should respond_to(:head)
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should generate rss" do
|
metadata
CHANGED