Skip to content

Commit e54825c

Browse files
committed
Upgrade to Sparkle 2.2
- rename `-s` option to `--ed-key-file` - remove unnecessary headers from framework - renamed XPC services - fix `copy_to_release` output
1 parent b40e315 commit e54825c

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

lib/motion-sparkle-sandbox.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
lib_dir_path = File.dirname(File.expand_path(__FILE__))
1818

19-
POD_VERSION = '~> 2.1.0'
19+
POD_VERSION = '~> 2.2.0'
2020

2121
unless @running_specs
2222
Motion::Project::App.setup do |app|

lib/motion-sparkle-sandbox/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module MotionSparkleSandbox
4-
VERSION = '2.1.1'
4+
VERSION = '2.2'
55
end

lib/motion/project/appcast.rb

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Appcast
1919

2020
CLI_OPTIONS = {
2121
account: '--account',
22-
private_eddsa_key: '-s',
22+
private_ed_key_file: '--ed-key-file',
2323
download_url_prefix: '--download-url-prefix',
2424
release_notes_url_prefix: '--release-notes-url-prefix',
2525
full_release_notes_url: '--full-release-notes-url',
@@ -93,7 +93,7 @@ def prepare_args
9393
args = []
9494

9595
account(args)
96-
private_eddsa_key(args)
96+
private_ed_key_file(args)
9797
download_url_prefix(args)
9898
release_notes_url_prefix(args)
9999
full_release_notes_url(args)
@@ -127,12 +127,11 @@ def account(args)
127127
# -s <private-EdDSA-key> The private EdDSA string (128 characters). If not
128128
# specified, the private EdDSA key will be read from
129129
# the Keychain instead.
130-
def private_eddsa_key(args)
131-
if cli_options[:private_eddsa_key].present?
132-
args << "-s=#{cli_options[:private_eddsa_key]}"
133-
elsif use_exported_private_key && File.exist?(private_key_path)
134-
private_key = File.read(private_key_path)
135-
args << "-s=#{private_key}"
130+
def private_ed_key_file(args)
131+
if cli_options[:private_ed_key_file].present?
132+
args << "--ed-key-file=#{cli_options[:private_ed_key_file]}"
133+
elsif use_exported_private_key && File.exist?(@sparkle.private_key_path)
134+
args << "--ed-key-file=#{@sparkle.private_key_path}"
136135
end
137136
end
138137

lib/motion/project/project.rb

+10-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,18 @@ def codesign_with_sparkle(config, platform)
4040
bundle_path = App.config.app_bundle('MacOSX')
4141
sparkle_path = File.join(bundle_path, 'Frameworks', 'Sparkle.framework')
4242

43+
# strip out any header files, as they are not needed for a built product, and Xcode
44+
# typically does this. Their permissions are set such that it conflicts
45+
# with building the deltas. See https://github.com/sparkle-project/Sparkle/issues/1972
46+
`rm -fr "#{sparkle_path}/Versions/B/PrivateHeaders"`
47+
`rm "#{sparkle_path}/PrivateHeaders"`
48+
`rm -fr "#{sparkle_path}/Versions/B/Headers"`
49+
`rm "#{sparkle_path}/Headers"`
50+
4351
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/Autoupdate"`
4452
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/Updater.app"`
45-
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/XPCServices/org.sparkle-project.InstallerLauncher.xpc"`
46-
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime --entitlements "./vendor/Pods/Sparkle/Entitlements/org.sparkle-project.Downloader.entitlements" "#{sparkle_path}/Versions/B/XPCServices/org.sparkle-project.Downloader.xpc"` # rubocop:disable Layout/LineLength
53+
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/XPCServices/Installer.xpc"`
54+
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime --entitlements "./vendor/Pods/Sparkle/Entitlements/Downloader.entitlements" "#{sparkle_path}/Versions/B/XPCServices/Downloader.xpc"` # rubocop:disable Layout/LineLength
4755

4856
`/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}"`
4957
end

lib/motion/project/sparkle.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ def export_private_key
210210
# copy the release notes and zip archive into the releases_folder,
211211
# where the appcast will get built
212212
def copy_to_release
213-
path = (project_path + releases_folder).realpath
214-
zip_file_path = (sparkle_release_path + zip_file).realpath
213+
destination_path = (project_path + releases_folder).realpath
214+
zip_file_path = (sparkle_release_path + zip_file)
215215

216216
[release_notes_path, zip_file_path].each do |file|
217-
FileUtils.cp(file, "#{path}/")
218-
App.info 'Copied', "./#{path}/#{file}"
217+
FileUtils.cp(file, "#{destination_path}/")
218+
App.info 'Copied', "#{destination_path}/#{file}"
219219
end
220220
end
221221

spec/appcast_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
it 'defaults to empty' do
1212
args = @appcast.prepare_args
1313

14-
expect(args).to eq []
14+
expect(args).to eq ['--account=ed25519']
1515
end
1616

1717
it 'sets all command line options' do
1818
expected_results = [
1919
'--account=test1',
20-
'-s=test2',
20+
'--ed-key-file=test2',
2121
'--download-url-prefix=test3',
2222
'--release-notes-url-prefix=test4',
2323
'--full-release-notes-url=test5',
@@ -36,7 +36,7 @@
3636
]
3737

3838
@appcast.process_option(:account, 'test1')
39-
@appcast.process_option(:private_eddsa_key, 'test2')
39+
@appcast.process_option(:private_ed_key_file, 'test2')
4040
@appcast.process_option(:download_url_prefix, 'test3')
4141
@appcast.process_option(:release_notes_url_prefix, 'test4')
4242
@appcast.process_option(:full_release_notes_url, 'test5')

0 commit comments

Comments
 (0)