motion-sparkle 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +67 -44
- data/lib/motion/project/appcast.rb +24 -7
- data/lib/motion/project/package.rb +2 -2
- data/lib/motion/project/sparkle.rb +12 -11
- data/lib/motion/project/version.rb +1 -1
- data/spec/sparkle_spec.rb +16 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTFkMzBjNTA5NzJlNDk4ZjU2YmNlZjAzMDE2YWIyZjliMTBmMWFlOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWRkZjEyOTFlNTAxYWZjMGQ4NDdlNzM2NmEwNWNkMjNjNTk1YmUxNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2Q4OWFiOTJkM2FkM2U5MjQxMzM0YmFhNmY2ZGI2ZjNjNjU0ZGFmZjgyY2Fl
|
10
|
+
YThmNTgxOTQ2YzZkODE1MTQxNGQ3NTM5ODM5YTAwYmRhMjRmMjAwOWMwMDZl
|
11
|
+
MzY2YjZmYTFhNDNjMjY2Mjg2NGZlYTJlYmNkNzhkZGM4M2IwNjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDk1OTZiNGQyNzdjMmQzNjIwOTg3ZTFjMzk5M2U0MGFhMmEyNmNiZTE2OWY5
|
14
|
+
MTAwMWYxMjIzMTNkMzExODFiYjg3NWI3MDhiZmI5YmY5YTc1YjZiNTBmMGNi
|
15
|
+
OGM0MmJhMjU1NWEzOTBkNGVjODg0ZjdjNjI5NjA5ZjMyZmE4ZGI=
|
data/README.md
CHANGED
@@ -30,44 +30,62 @@ Easily package and release updates of your RubyMotion app with Sparkle.
|
|
30
30
|
|
31
31
|
## Overview
|
32
32
|
|
33
|
-
[Sparkle](http://sparkle.andymatuschak.org/) powers
|
33
|
+
[Sparkle](http://sparkle.andymatuschak.org/) powers the "Check for updates" feature of countless Mac applications.
|
34
34
|
|
35
|
-
|
35
|
+
In a nutshell, when users click "Check for updates..." in an app, Sparkle checks for available updates against an XML file that you post somewhere on the web. That XML file contains information about your new release, such as the version number, the URL of the package and its digital signature. If there's a newer version available than the one that is currently running, it'll ask for permission to retrieve the package and replace the current app with the new release.
|
36
36
|
|
37
|
-
|
37
|
+
While it's easy to use Sparkle with RubyMotion without `motion-sparkle`, it's even easier if you use it. The gem takes care of the Sparkle framework integration, simplifies its configuration and then automates the preparation of a release, creating the ZIP, XML and release notes HTML file for you.
|
38
|
+
|
39
|
+
After building your app for release and running `rake sparkle:package`, all you need to do is upload 3 files to the URL you specify in the `Rakefile` and your users will be able to get the new release.
|
38
40
|
|
39
41
|
## Installation
|
40
42
|
|
41
43
|
In your project's Gemfile, add:
|
44
|
+
```ruby
|
45
|
+
# Gemfile
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
and then run
|
47
|
+
gem 'motion-sparkle'
|
48
|
+
```
|
49
|
+
and then run
|
46
50
|
|
47
51
|
$ bundle install
|
48
52
|
|
49
53
|
## Settings configuration
|
50
54
|
|
51
|
-
Configure Sparkle in your `Rakefile` using motion-sparkle's DSL:
|
55
|
+
Configure Sparkle in your `Rakefile` using `motion-sparkle`'s DSL:
|
56
|
+
```ruby
|
57
|
+
# Rakefile
|
58
|
+
|
59
|
+
app.sparkle do
|
60
|
+
# Required setting
|
61
|
+
release :base_url, 'http://example.com/releases/current' # `current` is a folder, don't use a trailing slash
|
62
|
+
|
63
|
+
# Recommended setting
|
64
|
+
# This will set both your `app.version` and `app.short_version` to the same value
|
65
|
+
# It's fine not to use it, just remember to set both as Sparkle needs them
|
66
|
+
release :version, '1.0'
|
67
|
+
|
68
|
+
## Optional settings and their default values and/or examples
|
69
|
+
|
70
|
+
## Please note that `base_url` must always be set (at the moment),
|
71
|
+
## even you override it completely with the options below
|
52
72
|
|
53
|
-
|
54
|
-
|
55
|
-
app.sparkle do
|
56
|
-
# Required setting
|
57
|
-
release :base_url, 'http://example.com/releases/current' # `current` is a folder, don't use a trailing slash
|
73
|
+
# Public Key
|
74
|
+
release :public_key, 'dsa_pub.pem' # default
|
58
75
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
76
|
+
# Appcast Feed
|
77
|
+
release :feed_base_url, 'http://downloads.example.com/releases' # defaults to base_url
|
78
|
+
release :feed_filename, 'releases.xml' # default
|
79
|
+
|
80
|
+
# Release Notes
|
81
|
+
release :notes_base_url, 'http://downloads.example.com/releases' # defaults to base_url
|
82
|
+
release :notes_filename, 'release_notes.html' # default
|
63
83
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
84
|
+
# App Package
|
85
|
+
release :package_base_url, 'http://downloads.example.com/releases' # defaults to base_url
|
86
|
+
release :package_filename, "#{app.name}.zip" # default
|
87
|
+
end
|
88
|
+
```
|
71
89
|
|
72
90
|
To complete the configuration, run
|
73
91
|
|
@@ -98,11 +116,11 @@ By default, your certificates need to be placed in the following directories:
|
|
98
116
|
./sparkle/config/dsa_priv.pem # private certificate
|
99
117
|
|
100
118
|
|
101
|
-
### Notes about the public certificate
|
119
|
+
### Notes about the public certificate
|
102
120
|
|
103
121
|
The public certificate is placed at the root of the default `resources/` folder by default, as it needs to bundled with your app. If you chose to rename it, remember to set its correct value in the `Rakefile`, using `release :public_key, 'new_name.pem'`.
|
104
122
|
|
105
|
-
### Notes about the private certificate
|
123
|
+
### Notes about the private certificate
|
106
124
|
|
107
125
|
The private certificate cannot be renamed nor placed elsewhere. If you have an existing certificate, please name it `dsa_priv.pem` and place inside the `sparkle/config/` folder
|
108
126
|
|
@@ -110,8 +128,8 @@ The private certificate cannot be renamed nor placed elsewhere. If you have an e
|
|
110
128
|
|
111
129
|
Be careful when handling the private certificate: you should never lose it nor share it. If you do, you'd lose the ability to sign your packages and users wouldn't be able to update your app. If someone takes it, they could sign the packages in your name and have your users install who knows what.
|
112
130
|
|
113
|
-
Tips:
|
114
|
-
* add it go your `.gitignore` or equivalent
|
131
|
+
Tips:
|
132
|
+
* add it go your `.gitignore` or equivalent
|
115
133
|
* make a backup of it
|
116
134
|
|
117
135
|
### Run `rake sparkle:setup` at any moment to make sure your config is OK
|
@@ -120,9 +138,9 @@ When all is good, move forward. If you need help, you can always open an issue o
|
|
120
138
|
|
121
139
|
## Adding "Check for updates..." to the menu
|
122
140
|
|
123
|
-
Sparkle makes it incredibly easy to add a "Check for updates" feature to your app.
|
141
|
+
Sparkle makes it incredibly easy to add a "Check for updates" feature to your app.
|
124
142
|
|
125
|
-
Sparkle's `SUUpdater` class has a shared updater instance that can serve as a `target` for Sparkle actions. To launch the typical Sparkle flow, call the `checkForUpdates:` action.
|
143
|
+
Sparkle's `SUUpdater` class has a shared updater instance that can serve as a `target` for Sparkle actions. To launch the typical Sparkle flow, call the `checkForUpdates:` action.
|
126
144
|
|
127
145
|
So, to launch the "Check for updates" flow, you can call `SUUpdater.new.checkForUpdates`.
|
128
146
|
|
@@ -131,16 +149,17 @@ Here's an example based on the RubyMotion default OS X app example, "Hello". You
|
|
131
149
|
This will add the classic "Check for updates..." entry on the menu; when the user clicks it, the nice default of experience of Sparkle will begin.
|
132
150
|
|
133
151
|
In `menu.rb`, right below the line that adds the "Preferences" item:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
152
|
+
```ruby
|
153
|
+
sparkle = addItemWithTitle("Check for updates...", action: nil, keyEquivalent: '')
|
154
|
+
sparkle.setTarget SUUpdater.new
|
155
|
+
sparkle.setAction 'checkForUpdates:'
|
156
|
+
```
|
138
157
|
|
139
158
|
Once you build your application, you should be able to see a "Check for updates..." item in the Application menu. Using it will work but will quickly produce an error. Keep going to make it work.
|
140
159
|
|
141
160
|
## First publication
|
142
161
|
|
143
|
-
Before you build, make sure you've set your `:base_url` to a destination where you can upload/download your files.
|
162
|
+
Before you build, make sure you've set your `:base_url` to a destination where you can upload/download your files.
|
144
163
|
|
145
164
|
Note that packaging with motion-sparkle only works with the `:release` target at the moment, so make sure your build with be compatible with `rake build:release`.
|
146
165
|
|
@@ -164,11 +183,13 @@ To do so, follow the same steps every time:
|
|
164
183
|
|
165
184
|
### 1. Bump the version
|
166
185
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
186
|
+
```ruby
|
187
|
+
# In your Rakefile
|
188
|
+
|
189
|
+
sparkle.app do
|
190
|
+
release :version, '1.1' # bump the versions
|
191
|
+
end
|
192
|
+
```
|
172
193
|
|
173
194
|
### 2. Build your app for release
|
174
195
|
|
@@ -188,13 +209,13 @@ Run the `sparkle:package` task and you'll be one step away from distribution.
|
|
188
209
|
|
189
210
|
### 5. Upload
|
190
211
|
|
191
|
-
Upload the 3 files and your new version is up. When users click "Check for updates...", the app should now display your release notes and ask the user to update. And when they do, the app will update and relaunch itself cleanly.
|
212
|
+
Upload the 3 files and your new version is up. When users click "Check for updates...", the app should now display your release notes and ask the user to update. And when they do, the app will update and relaunch itself cleanly.
|
192
213
|
|
193
214
|
Sparkle for the win.
|
194
215
|
|
195
216
|
## Help, Limitations, Troubleshooting and Testing
|
196
217
|
|
197
|
-
If you need further help, please open an Issue on Github.
|
218
|
+
If you need further help, please open an [Issue on Github](https://github.com/webcracy/motion-sparkle/issues/).
|
198
219
|
|
199
220
|
Limitations:
|
200
221
|
|
@@ -211,7 +232,7 @@ Test coverage currently only extends to configuration and certificate generation
|
|
211
232
|
|
212
233
|
## Contributing
|
213
234
|
|
214
|
-
Please do help with comments, issues and pull requests!
|
235
|
+
Please do help with comments, issues and pull requests! The gem's repository is at [github.com/webcracy/motion-sparkle](https://github.com/webcracy/motion-sparkle/).
|
215
236
|
|
216
237
|
I've made a list of features that I look forward to having. You can attack those or suprise me :)
|
217
238
|
|
@@ -229,13 +250,15 @@ Thanks!
|
|
229
250
|
|
230
251
|
## Credits
|
231
252
|
|
253
|
+
Contributors: [View all on Github](https://github.com/webcracy/motion-sparkle/graphs/contributors)
|
254
|
+
|
232
255
|
Author: Alexandre L. Solleiro
|
233
256
|
|
234
|
-
* Twitter - http://twitter.com/als
|
235
257
|
* Github - http://github.com/webcracy
|
258
|
+
* Twitter - http://twitter.com/als
|
236
259
|
* Website - http://webcracy.org
|
237
260
|
|
238
261
|
Thanks to the authors and contributors of [HipByte/motion-cocoapods](https://github.com/HipByte/motion-cocoapods) and [drnic/choctop](https://github.com/drnic/choctop) gems, as I have looked for inspiration in their code.
|
239
262
|
|
240
|
-
And a low bow to [andymatuschak/Sparkle](https://github.com/andymatuschak/Sparkle)!
|
263
|
+
And a low bow to [andymatuschak/Sparkle](https://github.com/andymatuschak/Sparkle)!
|
241
264
|
|
@@ -19,7 +19,7 @@ module Motion::Project
|
|
19
19
|
doc = REXML::Formatters::Pretty.new
|
20
20
|
doc.write(appcast_xml, xml_string)
|
21
21
|
f << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
22
|
-
f << xml_string
|
22
|
+
f << xml_string
|
23
23
|
f << "\n"
|
24
24
|
end
|
25
25
|
if appcast_file
|
@@ -30,7 +30,6 @@ module Motion::Project
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def appcast_xml
|
33
|
-
base_url = appcast.base_url
|
34
33
|
rss = REXML::Element.new 'rss'
|
35
34
|
rss.attributes['xmlns:atom'] = "http://www.w3.org/2005/Atom"
|
36
35
|
rss.attributes['xmlns:sparkle'] = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
@@ -52,9 +51,9 @@ module Motion::Project
|
|
52
51
|
guid = item.add_element('guid')
|
53
52
|
guid.text = "#{@config.name}-#{@config.version}"
|
54
53
|
guid.attributes['isPermaLink'] = false
|
55
|
-
item.add_element('sparkle:releaseNotesLink').text = "#{
|
54
|
+
item.add_element('sparkle:releaseNotesLink').text = "#{appcast.notes_url}/#{appcast.notes_filename}"
|
56
55
|
enclosure = item.add_element('enclosure')
|
57
|
-
enclosure.attributes['url'] = "#{
|
56
|
+
enclosure.attributes['url'] = "#{appcast.package_url}/#{@package_file}"
|
58
57
|
enclosure.attributes['length'] = "#{@package_size}"
|
59
58
|
enclosure.attributes['type'] = "application/octet-stream"
|
60
59
|
enclosure.attributes['sparkle:version'] = @config.version
|
@@ -88,18 +87,36 @@ module Motion::Project
|
|
88
87
|
|
89
88
|
|
90
89
|
class Appcast
|
91
|
-
attr_accessor :base_url,
|
90
|
+
attr_accessor :base_url,
|
91
|
+
:feed_base_url,
|
92
|
+
:feed_filename,
|
93
|
+
:notes_base_url,
|
94
|
+
:notes_filename,
|
95
|
+
:package_base_url,
|
96
|
+
:package_filename
|
92
97
|
|
93
98
|
def initialize
|
99
|
+
@feed_base_url = nil
|
94
100
|
@feed_filename = 'releases.xml'
|
101
|
+
@notes_base_url = nil
|
95
102
|
@notes_filename = 'release_notes.html'
|
103
|
+
@package_base_url = nil
|
96
104
|
@package_filename = nil
|
97
105
|
@base_url = nil
|
98
106
|
end
|
99
107
|
|
100
|
-
def
|
101
|
-
"#{base_url}/#{feed_filename}"
|
108
|
+
def feed_url
|
109
|
+
"#{feed_base_url || base_url}/#{feed_filename}"
|
102
110
|
end
|
111
|
+
|
112
|
+
def notes_url
|
113
|
+
"#{notes_base_url || base_url}/#{notes_filename}"
|
114
|
+
end
|
115
|
+
|
116
|
+
def package_url
|
117
|
+
"#{package_base_url || base_url}/#{package_filename}"
|
118
|
+
end
|
119
|
+
|
103
120
|
end
|
104
121
|
|
105
122
|
end
|
@@ -24,7 +24,7 @@ module Motion::Project
|
|
24
24
|
App.fail "Release already exists at ./#{sparkle_release_path}/#{zip_file} (remove it manually with `rake sparkle:clean`)"
|
25
25
|
end
|
26
26
|
FileUtils.cd(app_release_path) do
|
27
|
-
`zip -r "#{zip_file}" "#{app_file}"`
|
27
|
+
`zip -r --symlinks "#{zip_file}" "#{app_file}"`
|
28
28
|
end
|
29
29
|
FileUtils.mv "#{app_release_path}/#{zip_file}", "./#{sparkle_release_path}/"
|
30
30
|
App.info "Create", "./#{sparkle_release_path}/#{zip_file}"
|
@@ -41,4 +41,4 @@ module Motion::Project
|
|
41
41
|
|
42
42
|
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
@@ -18,20 +18,21 @@ module Motion::Project
|
|
18
18
|
|
19
19
|
def publish(key, value)
|
20
20
|
case key
|
21
|
-
when :feed_url
|
22
|
-
feed_url value
|
23
21
|
when :public_key
|
24
22
|
public_key value
|
25
|
-
when :
|
26
|
-
version value
|
27
|
-
when :base_url
|
23
|
+
when :base_url
|
28
24
|
appcast.base_url = value
|
29
|
-
feed_url appcast.
|
30
|
-
when :
|
25
|
+
feed_url appcast.feed_url
|
26
|
+
when :feed_base_url
|
31
27
|
appcast.send(key.to_s + '=', value)
|
28
|
+
feed_url appcast.feed_url
|
32
29
|
when :feed_filename
|
33
30
|
appcast.feed_filename = value
|
34
|
-
feed_url appcast.
|
31
|
+
feed_url appcast.feed_url
|
32
|
+
when :version
|
33
|
+
version value
|
34
|
+
when :notes_base_url, :package_base_url, :notes_filename, :package_filename
|
35
|
+
appcast.send(key.to_s + '=', value)
|
35
36
|
else
|
36
37
|
raise "Unknown Sparkle config option #{key}"
|
37
38
|
end
|
@@ -71,10 +72,10 @@ module Motion::Project
|
|
71
72
|
@ignorable.delete(line) if @ignorable.include?(line)
|
72
73
|
end
|
73
74
|
end
|
74
|
-
File.open(gitignore_path, 'a') do |f|
|
75
|
+
File.open(gitignore_path, 'a') do |f|
|
75
76
|
@ignorable.each do |i|
|
76
77
|
f << "#{i}\n"
|
77
|
-
end
|
78
|
+
end
|
78
79
|
end if @ignorable.any?
|
79
80
|
`cat #{gitignore_path}`
|
80
81
|
end
|
@@ -137,7 +138,7 @@ If you lose it, your users will be unable to upgrade.
|
|
137
138
|
end
|
138
139
|
|
139
140
|
def gitignore_path
|
140
|
-
project_path + ".gitignore"
|
141
|
+
project_path + ".gitignore"
|
141
142
|
end
|
142
143
|
|
143
144
|
def sparkle_release_path
|
data/spec/sparkle_spec.rb
CHANGED
@@ -24,6 +24,13 @@ describe "motion-sparkle" do
|
|
24
24
|
release :base_url, 'http://example.com'
|
25
25
|
release :public_key, 'public_key.pem'
|
26
26
|
release :version, '1.0'
|
27
|
+
# Optional config options
|
28
|
+
release :feed_base_url, 'http://rss.example.com'
|
29
|
+
release :feed_filename, 'example.xml'
|
30
|
+
release :notes_base_url, 'http://www.example.com'
|
31
|
+
release :notes_filename, 'example.html'
|
32
|
+
release :package_base_url, 'http://download.example.com'
|
33
|
+
release :package_filename, 'example.zip'
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
@@ -34,7 +41,15 @@ describe "motion-sparkle" do
|
|
34
41
|
end
|
35
42
|
|
36
43
|
it "Sparkle's feed url should be set correctly" do
|
37
|
-
@config.info_plist['SUFeedURL'].should.equal 'http://example.com/
|
44
|
+
@config.info_plist['SUFeedURL'].should.equal 'http://rss.example.com/example.xml'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "Sparkle's release notes url should be set correctly" do
|
48
|
+
@config.sparkle.appcast.notes_url.should.equal 'http://www.example.com/example.html'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "Sparkle's appcast package url should be set correctly" do
|
52
|
+
@config.sparkle.appcast.package_url.should.equal 'http://download.example.com/example.zip'
|
38
53
|
end
|
39
54
|
|
40
55
|
it "Sparkle's public key should have custom name" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-sparkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre L. Solleiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: motion-sparkle makes it easy to use Sparkle with your RubyMotion projects
|
14
14
|
email: alex@webcracy.org
|
@@ -1002,8 +1002,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1002
1002
|
version: '0'
|
1003
1003
|
requirements: []
|
1004
1004
|
rubyforge_project:
|
1005
|
-
rubygems_version: 2.
|
1005
|
+
rubygems_version: 2.2.2
|
1006
1006
|
signing_key:
|
1007
1007
|
specification_version: 4
|
1008
1008
|
summary: Sparkle integration for Rubymotion projects
|
1009
1009
|
test_files: []
|
1010
|
+
has_rdoc:
|