motion-sparkle-sandbox 2.0.0 → 2.0.1

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +7 -0
  5. data/.rubocop_todo.yml +183 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +37 -0
  8. data/Gemfile +13 -3
  9. data/README.md +73 -71
  10. data/Rakefile +2 -7
  11. data/bin/bundle +103 -0
  12. data/bin/byebug +29 -0
  13. data/bin/coderay +29 -0
  14. data/bin/fuzzy_match +29 -0
  15. data/bin/htmldiff +29 -0
  16. data/bin/httpclient +29 -0
  17. data/bin/ldiff +29 -0
  18. data/bin/pod +29 -0
  19. data/bin/pry +29 -0
  20. data/bin/rake +29 -0
  21. data/bin/rspec +29 -0
  22. data/bin/rubocop +29 -0
  23. data/bin/ruby-parse +29 -0
  24. data/bin/ruby-rewrite +29 -0
  25. data/bin/sandbox-pod +29 -0
  26. data/bin/xcodeproj +29 -0
  27. data/lib/motion/project/appcast.rb +177 -104
  28. data/lib/motion/project/indent_string.rb +18 -0
  29. data/lib/motion/project/install.rb +22 -66
  30. data/lib/motion/project/package.rb +52 -36
  31. data/lib/motion/project/project.rb +41 -51
  32. data/lib/motion/project/rake_tasks.rb +28 -32
  33. data/lib/motion/project/setup.rb +67 -73
  34. data/lib/motion/project/sparkle.rb +244 -148
  35. data/lib/motion/project/templates.rb +24 -22
  36. data/lib/motion-sparkle-sandbox/version.rb +5 -0
  37. data/lib/motion-sparkle-sandbox.rb +19 -3
  38. data/motion-sparkle-sandbox.gemspec +26 -16
  39. data/sample-app/.gitignore +9 -0
  40. data/sample-app/Gemfile +8 -0
  41. data/sample-app/README.md +87 -0
  42. data/sample-app/Rakefile +44 -0
  43. data/sample-app/app/app_delegate.rb +15 -0
  44. data/sample-app/app/menu.rb +155 -0
  45. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/1024x1024.png +0 -0
  46. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  47. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_128x128.png +0 -0
  48. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_128x128@2x.png +0 -0
  49. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_16x16.png +0 -0
  50. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_16x16@2x.png +0 -0
  51. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_256x256.png +0 -0
  52. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_256x256@2x.png +0 -0
  53. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_32x32.png +0 -0
  54. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_32x32@2x.png +0 -0
  55. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_512x512.png +0 -0
  56. data/sample-app/resources/Assets.xcassets/AppIcon.appiconset/Icon_512x512@2x.png +0 -0
  57. data/sample-app/resources/Assets.xcassets/Contents.json +6 -0
  58. data/sample-app/resources/Credits.rtf +29 -0
  59. data/sample-app/spec/main_spec.rb +11 -0
  60. data/spec/setup_spec.rb +67 -0
  61. data/spec/sparkle_spec.rb +113 -65
  62. data/spec/spec_helper.rb +94 -29
  63. data/spec/spec_utils.rb +32 -0
  64. data/vendor/.git_keep +0 -0
  65. metadata +78 -14
  66. data/vendor/README.md +0 -34
  67. data/vendor/Sparkle.zip +0 -0
  68. data/vendor/codesign_embedded_executable +0 -46
  69. data/vendor/generate_appcast +0 -0
@@ -1,18 +1,27 @@
1
- # Rake tasks
1
+ # frozen_string_literal: true
2
+
3
+ # Sparkle specific rake tasks
2
4
  namespace :sparkle do
5
+ desc 'Sparkle Help'
6
+ task :help do
7
+ puts <<~HELP
8
+ During initial Sparkle setup, run these rake tasks:
3
9
 
4
- task :install do
5
- sparkle = App.config.sparkle
6
- sparkle.install
10
+ 1. `rake sparkle:setup_certificates`
11
+ 2. `rake sparkle:setup`
12
+
13
+ Then after running `rake build:release`, you can run
14
+ `rake sparkle:package`
15
+ HELP
7
16
  end
8
17
 
9
- desc "Setup Sparkle configuration"
18
+ desc 'Setup Sparkle configuration'
10
19
  task :setup do
11
20
  sparkle = App.config.sparkle
12
21
  sparkle.setup
13
22
  end
14
23
 
15
- desc "Create a ZIP file with you application .app release build"
24
+ desc 'Create a ZIP file with your application .app release build'
16
25
  task :package do
17
26
  App.config_without_setup.build_mode = :release
18
27
  sparkle = App.config.sparkle
@@ -24,50 +33,37 @@ namespace :sparkle do
24
33
  sparkle.generate_keys
25
34
  end
26
35
 
27
- desc "Sign the ZIP file with appropriate certificates"
36
+ desc 'Generate the EdDSA signature for a package'
28
37
  task :sign do
29
38
  App.config_without_setup.build_mode = :release
30
39
  sparkle = App.config.sparkle
31
40
  sparkle.sign_package
32
41
  end
33
42
 
34
- task :recreate_public_key do
35
- sparkle = App.config.sparkle
36
- sparkle.generate_public_key
37
- end
38
-
39
- task :copy_release_notes_templates do
40
- App.config_without_setup.build_mode = :release
41
- sparkle = App.config.sparkle
42
- sparkle.copy_templates(force = true)
43
- end
44
-
45
- desc "Generate the appcast xml feed"
46
- task :feed do
43
+ desc "Generate the appcast xml feed using Sparkle's `generate_appcast`"
44
+ task :generate_appcast do
47
45
  App.config_without_setup.build_mode = :release
48
46
  sparkle = App.config.sparkle
49
- sparkle.create_appcast
47
+ sparkle.generate_appcast
50
48
  end
51
49
 
52
- desc "Generate the appcast using Sparkle's `generate_appcast`"
53
- task :generate_appcast do
54
- App.config_without_setup.build_mode = :release
55
- sparkle = App.config.sparkle
56
- results = `#{sparkle.sparkle_vendor_path}/generate_appcast "#{sparkle.private_key_path}" "#{sparkle.archive_folder}"`
50
+ namespace :generate_appcast do
51
+ desc "Show help for Sparkle's `generate_appcast`"
52
+ task :help do
53
+ App.config_without_setup.build_mode = :release
54
+ sparkle = App.config.sparkle
55
+ sparkle.generate_appcast_help
56
+ end
57
57
  end
58
58
 
59
- desc "Update the release notes of this build"
59
+ desc 'Update the release notes of this build'
60
60
  task :release_notes do
61
61
  App.config_without_setup.build_mode = :release
62
62
  sparkle = App.config.sparkle
63
63
  sparkle.create_release_notes
64
64
  end
65
65
 
66
- desc "Upload to configured location"
67
- task :upload do
68
- end
69
-
70
- desc "Clean the Sparkle release folder"
66
+ desc 'Clean the Sparkle release folder'
71
67
  task :clean do
72
68
  dir = Motion::Project::Sparkle::RELEASE_PATH
73
69
  if File.exist?("./#{dir}")
@@ -1,96 +1,90 @@
1
- module Motion::Project
2
- class Sparkle
1
+ # frozen_string_literal: true
3
2
 
4
- def setup_ok?
5
- config_ok?
6
- certificates_ok?
7
- end
3
+ module Motion
4
+ module Project
5
+ class Sparkle
6
+ def setup_ok?
7
+ config_ok?
8
+ certificates_ok?
9
+ end
8
10
 
9
- def config_ok?
10
- check_base_url
11
- check_feed_url
12
- check_public_key
13
- end
11
+ def config_ok?
12
+ check_base_url
13
+ check_feed_url
14
+ check_public_key
15
+ end
16
+
17
+ def check_base_url
18
+ return true if appcast.base_url.present?
14
19
 
15
- def check_base_url
16
- base_url_check = appcast.base_url.to_s
17
- if base_url_check.nil? or base_url_check.empty?
18
20
  App.fail "Sparkle :base_url missing. Use `release :base_url, 'http://example.com/your_app_folder'` in your Rakefile's `app.sparkle` block"
19
21
  end
20
- true
21
- end
22
22
 
23
- def check_feed_url
24
- feed_url_check = @config.info_plist['SUFeedURL']
25
- feed_filename_check = appcast.feed_filename
26
- if feed_url_check.nil? or feed_url_check.empty? or feed_filename_check.nil? or feed_filename_check.empty?
27
- App.fail "Sparkle :feed_filename is nil or blank. Please check your Rakefile."
23
+ def check_feed_url
24
+ return true if feed_url.present? && appcast.feed_filename.present?
25
+
26
+ App.fail 'Sparkle :feed_filename is nil or blank. Please check your Rakefile.'
28
27
  end
29
- true
30
- end
31
28
 
32
- def check_public_key
33
- public_key_check = @config.info_plist['SUPublicDSAKeyFile'].to_s
34
- if public_key_check.nil? or public_key_check.empty?
35
- App.fail "Sparkle :public_key is nil or blank. Please check your Rakefile."
29
+ def check_public_key
30
+ return true if public_EdDSA_key.present?
31
+
32
+ App.fail 'Sparkle :public_key is nil or blank. Please check your Rakefile.'
36
33
  end
37
- true
38
- end
39
34
 
40
- def certificates_ok?(silence=false)
41
- unless File.exist?("./#{Sparkle::CONFIG_PATH}")
42
- if silence
43
- return false
44
- else
45
- App.fail "Missing `#{Sparkle::CONFIG_PATH}`. Run `rake sparkle:setup` to get started"
35
+ def certificates_ok?(silence = false)
36
+ unless File.exist?("./#{Sparkle::CONFIG_PATH}")
37
+ return false if silence
38
+
39
+ App.fail "Missing `#{Sparkle::CONFIG_PATH}`. Run `rake sparkle:setup` to get started"
46
40
  end
47
- end
48
- unless File.exist?(private_key_path)
49
- if silence
50
- return false
51
- else
41
+
42
+ if appcast.use_exported_private_key && !File.exist?(private_key_path)
43
+ return false if silence
44
+
52
45
  App.fail "Missing `#{private_key_path}`. Please run `rake sparkle:setup_certificates` or check the docs to know where to put them."
53
46
  end
54
- end
55
- unless File.exist?(public_key_path)
56
- if silence
57
- return false
58
- else
47
+
48
+ unless public_EdDSA_key.present?
49
+ return false if silence
50
+
59
51
  App.fail "Missing `#{public_key_path}`. Did you configure `release :public_key` correctly in the Rakefile? Advanced: recreate your public key with `rake sparkle:recreate_public_key`"
60
52
  end
53
+
54
+ true
61
55
  end
62
- true
63
- end
64
56
 
65
- def setup
66
- verify_installation
67
- create_sparkle_folder
68
- add_to_gitignore
69
- copy_templates
57
+ def setup
58
+ verify_installation
59
+ create_sparkle_folder
60
+ add_to_gitignore
61
+ copy_templates
70
62
 
71
- if config_ok?
72
- App.info "Sparkle", "Config found"
73
- else
74
- return false
75
- end
63
+ return false unless config_ok?
64
+
65
+ App.info 'Sparkle', 'Config found'
76
66
 
77
- silence = true
78
- if certificates_ok?(silence)
79
- App.info "Sparkle", "Certificates found"
80
- else
81
- App.info "Sparkle", "Certificates not found
82
- Please generate your private and public keys with
83
- `rake sparkle:setup_certificates`
84
- If you already have your certificates and only need to include them in the project, follow these steps:
85
- 1. Rename your private key to `./#{private_key_path}`
86
- 2. Place your public key in `./#{public_key_path}`
87
- 3. If you wish to use a different name or location for your public key within the resources dir,
88
- make sure you add `publish :public_key, 'folder/new_name.pem'` to the sparkle config in your Rakefile
89
- "
90
- return false
67
+ silence = true
68
+ unless certificates_ok?(silence)
69
+ App.info 'Sparkle', <<~CERTIFICATES
70
+ Certificates not found
71
+
72
+ Please generate your private and public keys with
73
+ `rake sparkle:setup_certificates`
74
+
75
+ If you already have your certificates and only need to include them in the project, follow these steps:
76
+ 1. Rename your private key to `./#{private_key_path}`
77
+ and make sure you've added it to your `.gitignore` file - it should NEVER be
78
+ stored in your repository
79
+ 2. Add `publish :public_key, 'PUBLIC_KEY'` to the Sparkle config in your Rakefile
80
+ CERTIFICATES
81
+
82
+ return false
83
+ end
84
+
85
+ App.info 'Sparkle', 'Certificates found'
86
+ App.info 'Sparkle', 'Setup OK. After `rake build:release`, you can now run `rake sparkle:package`.'
91
87
  end
92
- App.info "Sparkle", "Setup OK. After `rake build:release`, you can now run `rake sparkle:package`."
93
88
  end
94
-
95
89
  end
96
90
  end