motion-sparkle-sandbox 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ require 'erb'
2
+ require 'rexml/document'
3
+
4
+ module Motion::Project
5
+ class Sparkle
6
+
7
+ TEMPLATE_PATHS = [
8
+ File.expand_path(File.join(__FILE__, '../appcast'))
9
+ ]
10
+
11
+ def all_templates
12
+ @all_templates ||= begin
13
+ templates = {}
14
+ TEMPLATE_PATHS.map { |path| Dir.glob(path + '/*') }.flatten.each do |template_path|
15
+ templates[File.basename(template_path)] = template_path
16
+ end
17
+ templates
18
+ end
19
+ end
20
+
21
+ def copy_templates(force=false)
22
+ all_templates.each_pair do |tmpl, path|
23
+ result = "#{sparkle_config_path}/#{tmpl}"
24
+ if File.exist?(result) and !force
25
+ App.info 'Exists', result
26
+ else
27
+ FileUtils.cp(path, "#{sparkle_config_path}/")
28
+ App.info 'Create', "./#{sparkle_config_path}/#{tmpl.to_s}"
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ # This is just so that the source file can be loaded.
2
+ module ::Motion; module Project; class Config
3
+ def self.variable(*); end
4
+ end; end; end
5
+
6
+ require 'date'
7
+ $:.unshift File.expand_path('../lib', __FILE__)
8
+
9
+ Gem::Specification.new do |spec|
10
+ spec.name = 'motion-sparkle-sandbox'
11
+ spec.version = '0.7.0'
12
+ spec.date = Date.today
13
+ spec.summary = 'Sparkle (sandboxed) integration for Rubymotion projects'
14
+ spec.description = "motion-sparkle-sandbox makes it easy to use the sandboxed version of Sparkle in your RubyMotion OS X apps"
15
+ spec.author = 'Brett Walker'
16
+ spec.email = 'github@digitalmoksha.com'
17
+ spec.homepage = 'https://github.com/digitalmoksha/motion-sparkle-sandbox'
18
+ spec.license = 'MIT'
19
+ spec.files = `git ls-files`.split("\n")
20
+ spec.require_paths = ['lib']
21
+ end
@@ -0,0 +1,90 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Motion; module Project;
4
+ class Config
5
+ attr_writer :project_dir
6
+ end
7
+ end; end
8
+
9
+ describe "motion-sparkle-sandbox" do
10
+ extend SpecHelper::TemporaryDirectory
11
+
12
+ before do
13
+ unless @completed_setup
14
+ teardown_temporary_directory
15
+ setup_temporary_directory
16
+
17
+ FileUtils.mkdir_p(temporary_directory + 'resources')
18
+ FileUtils.mkdir_p(temporary_directory + 'vendor')
19
+ FileUtils.touch(temporary_directory + '.gitignore')
20
+
21
+ @config = App.config
22
+ @config.project_dir = temporary_directory.to_s
23
+ @config.instance_eval do
24
+ sparkle do
25
+ release :base_url, 'http://example.com'
26
+ release :public_key, 'public_key.pem'
27
+ release :version, '1.0'
28
+ # Optional config options
29
+ release :feed_base_url, 'http://rss.example.com'
30
+ release :feed_filename, 'example.xml'
31
+ release :notes_base_url, 'http://www.example.com'
32
+ release :notes_filename, 'example.html'
33
+ release :package_base_url, 'http://download.example.com'
34
+ release :package_filename, 'example.zip'
35
+ end
36
+ end
37
+ Rake::Task['sparkle:setup'].invoke
38
+ Rake::Task['sparkle:setup_certificates'].invoke
39
+ @completed_setup = true
40
+ end
41
+ end
42
+
43
+ it "Sparkle's release base url should be set correctly" do
44
+ @config.sparkle.appcast.base_url.should.equal 'http://example.com'
45
+ end
46
+
47
+ it "Sparkle's feed url should be set correctly" do
48
+ @config.info_plist['SUFeedURL'].should.equal 'http://rss.example.com/example.xml'
49
+ end
50
+
51
+ it "Sparkle's release notes url should be set correctly" do
52
+ @config.sparkle.appcast.notes_url.should.equal 'http://www.example.com/example.html'
53
+ end
54
+
55
+ it "Sparkle's appcast package url should be set correctly" do
56
+ @config.sparkle.appcast.package_url.should.equal 'http://download.example.com/example.zip'
57
+ end
58
+
59
+ it "Sparkle's public key should have custom name" do
60
+ @config.info_plist['SUPublicDSAKeyFile'].should.equal 'public_key.pem'
61
+ end
62
+
63
+ it "Version and short version should be set correctly" do
64
+ @config.version.should.equal '1.0'
65
+ @config.short_version.should.equal '1.0'
66
+ end
67
+
68
+ it "Version should be same for short_version and version" do
69
+ @config.version.should.equal @config.short_version
70
+ end
71
+
72
+ it "Sparkle framework should be embedded" do
73
+ sparkle_framework_path = ROOT + "tmp/vendor/Sparkle/Sparkle.framework"
74
+ @config.embedded_frameworks.include?(sparkle_framework_path).should.equal true
75
+ end
76
+
77
+ it "should create private certificate" do
78
+ File.exist?(@config.sparkle.private_key_path.to_s).should.equal true
79
+ end
80
+
81
+ it "should create public certificate" do
82
+ File.exist?(@config.sparkle.public_key_path.to_s).should.equal true
83
+ end
84
+
85
+ it "should add files to gitignore" do
86
+ a = `cat .gitignore`
87
+ a.strip.should.not.equal ''
88
+ end
89
+
90
+ end
@@ -0,0 +1,35 @@
1
+ require 'pathname'
2
+ require 'fileutils'
3
+ require 'rake'
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+ require 'bacon'
7
+
8
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
9
+ $:.unshift(ENV['RUBYMOTION_CHECKOUT'] || "/Library/RubyMotion/lib")
10
+ $:.unshift((ROOT + 'lib').to_s)
11
+ require 'motion/project/template/osx'
12
+ require 'motion-sparkle-sandbox'
13
+
14
+ Bacon.summary_at_exit
15
+
16
+ module SpecHelper
17
+ def self.temporary_directory
18
+ TemporaryDirectory.temporary_directory
19
+ end
20
+
21
+ module TemporaryDirectory
22
+ def temporary_directory
23
+ ROOT + 'tmp'
24
+ end
25
+ module_function :temporary_directory
26
+
27
+ def setup_temporary_directory
28
+ temporary_directory.mkpath
29
+ end
30
+
31
+ def teardown_temporary_directory
32
+ temporary_directory.rmtree if temporary_directory.exist?
33
+ end
34
+ end
35
+ end
data/vendor/README.md ADDED
@@ -0,0 +1,24 @@
1
+ ## Building the Sparkle.zip
2
+
3
+ The structure of `Sparkle.zip` is:
4
+
5
+ ```
6
+ Sparkle
7
+ codesign_xpc
8
+ Sparkle.framework
9
+ XPCServices
10
+ org.sparkle-project.InstallerConnection.xpc
11
+ org.sparkle-project.InstallerLauncher.xpc
12
+ org.sparkle-project.InstallerStatus.xpc
13
+ ```
14
+
15
+ In order to get xpc services to be signed and work properly, they need to be copied into an `XPCServices` folder in `MyApp.app/Contents`
16
+
17
+ The `codesign_xpc` can properly sign these files once they have been copied into place.
18
+
19
+ 1. Fetch the `ui-separation-and-xpc` branch
20
+ 2. Copy the `bin/codesign_xpc` into the `Sparkle` folder
21
+ 3. Run `make release` and change to the output folder
22
+ 4. Copy the `Sparkle.framework` into the `Sparkle` folder
23
+ 5. Copy each of the above xpc files into the `XPCServices` folder
24
+ 6. compress the `Sparkle` folder
Binary file
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env python
2
+
3
+ import os, sys, subprocess
4
+
5
+ def log_message(message):
6
+ sys.stderr.write(message + "\n")
7
+
8
+ #Surround a token with double quotes if it has a space in it
9
+ def sanitize(argument):
10
+ return ('"' + argument + '"' if ' ' in argument else argument)
11
+
12
+ def _codesign_service(identity, path, entitlements_path=None):
13
+ command = ["codesign", "-fs", identity, path] + ([] if entitlements_path is None else ["--entitlements", entitlements_path])
14
+ log_message(" ".join(map(sanitize, command)))
15
+
16
+ process = subprocess.Popen(command, stdout=subprocess.PIPE)
17
+ process.communicate()
18
+ if process.returncode != 0:
19
+ log_message("Error: Failed to codesign %s" % (path))
20
+ sys.exit(1)
21
+
22
+ def codesign_service(service_name, identity, path, entitlements_path=None):
23
+ #Sign the auxiliary executables (if any)
24
+ executables_path = os.path.join(path, "Contents/MacOS/")
25
+ if os.path.exists(executables_path):
26
+ for executable in os.listdir(executables_path):
27
+ if executable != service_name:
28
+ _codesign_service(identity, os.path.join(executables_path, executable), entitlements_path)
29
+
30
+ #Sign the service bundle
31
+ _codesign_service(identity, path, entitlements_path)
32
+
33
+ if __name__ == "__main__":
34
+ if len(sys.argv) < 3:
35
+ log_message("Usage:\n\t%s code-signing-identity xpc-service xpc-service2 ..." % (sys.argv[0]))
36
+ log_message("Example:\n\t%s \"Developer ID Application\" ./XPCServices/*.xpc" % (sys.argv[0]))
37
+ sys.exit(1)
38
+
39
+ signing_identity = sys.argv[1]
40
+ xpc_services = sys.argv[2:]
41
+
42
+ for xpc_service in xpc_services:
43
+ parent, child = os.path.split(xpc_service)
44
+ service_name = os.path.splitext(child)[0]
45
+ entitlements_path = os.path.join(parent, service_name + ".entitlements")
46
+ codesign_service(service_name, signing_identity, xpc_service, None if not os.path.exists(entitlements_path) else entitlements_path)
Binary file
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-sparkle-sandbox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ platform: ruby
6
+ authors:
7
+ - Brett Walker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: motion-sparkle-sandbox makes it easy to use the sandboxed version of
14
+ Sparkle in your RubyMotion OS X apps
15
+ email: github@digitalmoksha.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - Rakefile
25
+ - lib/motion-sparkle-sandbox.rb
26
+ - lib/motion/project/appcast.rb
27
+ - lib/motion/project/appcast/release_notes.content.html
28
+ - lib/motion/project/appcast/release_notes.template.erb
29
+ - lib/motion/project/install.rb
30
+ - lib/motion/project/package.rb
31
+ - lib/motion/project/project.rb
32
+ - lib/motion/project/rake_tasks.rb
33
+ - lib/motion/project/setup.rb
34
+ - lib/motion/project/sparkle.rb
35
+ - lib/motion/project/templates.rb
36
+ - motion-sparkle-sandbox.gemspec
37
+ - spec/sparkle_spec.rb
38
+ - spec/spec_helper.rb
39
+ - vendor/README.md
40
+ - vendor/Sparkle.zip
41
+ - vendor/codesign_xpc
42
+ - vendor/generate_appcast
43
+ homepage: https://github.com/digitalmoksha/motion-sparkle-sandbox
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.7.6
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Sparkle (sandboxed) integration for Rubymotion projects
67
+ test_files: []