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.
@@ -103,13 +103,13 @@ module Glitter
103
103
  @appcast ||= Appcast.new(self)
104
104
  end
105
105
 
106
- def head
107
- releases[version]
106
+ def latest
107
+ assets[version]
108
108
  end
109
109
 
110
- def releases
111
- @releases ||= Hash.new do |hash,key|
112
- hash[key] = Release.new do |r|
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 Release
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.head.object_name}"
171
- app.head.notes = options[:release_notes]
172
- app.head.push
173
- app.appcast.push
174
- puts "App pushed to #{app.head.url}"
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.releases.each do |version, release| %>
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><%= release.notes %></p>
13
+ <p><%= asset.notes %></p>
14
14
  ]]>
15
15
  </description>
16
- <pubDate><%= release.published_at.strftime("%a, %d %b %Y %H:%M:%S %z") %></pubDate>
17
- <enclosure url="<%= release.url %>" sparkle:version="2.0" length="<%= release.file.stat.size %>" type="application/octet-stream" />
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>
@@ -1,3 +1,3 @@
1
1
  module Glitter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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.releases["3.0"].notes = "I'm the newest and greatest of them all. 3.0 I am!"
20
- @app.releases["1.0"].notes = "Hi dude, 1.0"
21
- @app.releases["2.0"].notes = "I'm way better than 2.0"
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.head.version.should eql("1.0.0")
29
+ @app.latest.should respond_to(:head)
26
30
  end
27
31
 
28
32
  it "should generate rss" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glitter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brad Gessler