motion-hockeyapp 1.0.0

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.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012, Joe Noon <joenoon@gmail.com>
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.rdoc ADDED
@@ -0,0 +1,73 @@
1
+ = motion-hockeyapp
2
+
3
+ motion-hockeyapp allows RubyMotion projects to easily embed the HockeySDK
4
+ and be submitted to the HockeyApp platform.
5
+
6
+ == Installation
7
+
8
+ gem 'motion-hockeyapp'
9
+
10
+ unzip the HockeySDK into vendor so you end up with exactly the following directory structure:
11
+
12
+ vendor/HockeySDK/HockeySDK.framework
13
+ vendor/HockeySDK/Resources
14
+
15
+
16
+ == Setup
17
+
18
+ Motion::Project::App.setup do |app|
19
+ # ...
20
+ app.hockeyapp do
21
+ set :api_token, '2fc2d1b97ef24ec38a70a721c65956e2'
22
+ set :beta_id, '83be1abdfb3acd29c0e012a644e71b7d'
23
+ set :live_id, '90a35939241bd75d785e152d37aeb25b'
24
+ set :status, "2"
25
+ set :notify, "0"
26
+ set :notes_type, "1"
27
+ end
28
+ # ...
29
+ app.development do
30
+ if app.hockeyapp?
31
+ app.identifier = 'com.localini.Localini.adhoc'
32
+ # ...
33
+ else
34
+ app.identifier = 'com.localini.Localini.debug'
35
+ # ...
36
+ end
37
+ end
38
+ # ...
39
+ end
40
+
41
+ You can retrieve the values in your HockeyApp account page.
42
+ Refer to http://support.hockeyapp.net/kb/api/api-upload-new-apps for Upload API options.
43
+
44
+ == Usage
45
+
46
+ motion-hockeyapp introduces a +hockeyapp+ Rake task to your project, which can be used to submit a development build. The +notes+ parameter may be provided, and its content will be used as the submission release notes.
47
+
48
+ $ rake hockeyapp notes="zomg!"
49
+
50
+ == License
51
+
52
+ Copyright (c) 2012, Joe Noon <joenoon@gmail.com>
53
+ All rights reserved.
54
+
55
+ Redistribution and use in source and binary forms, with or without
56
+ modification, are permitted provided that the following conditions are met:
57
+
58
+ 1. Redistributions of source code must retain the above copyright notice, this
59
+ list of conditions and the following disclaimer.
60
+ 2. Redistributions in binary form must reproduce the above copyright notice,
61
+ this list of conditions and the following disclaimer in the documentation
62
+ and/or other materials provided with the distribution.
63
+
64
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
65
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
66
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
67
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
68
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
69
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
70
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
71
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
73
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,183 @@
1
+ # Copyright (c) 2012, Joe Noon <joenoon@gmail.com>
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23
+ # POSSIBILITY OF SUCH DAMAGE.
24
+
25
+ unless defined?(Motion::Project::Config)
26
+ raise "This file must be required within a RubyMotion project Rakefile."
27
+ end
28
+
29
+ class HockeyAppConfig
30
+
31
+ attr_accessor :api_token, :beta_id, :live_id, :status, :notify, :notes_type
32
+
33
+ def set(var, val)
34
+ @config.info_plist['HockeySDK'] ||= [{}]
35
+ @config.info_plist['HockeySDK'].first[var.to_s] = val
36
+ send("#{var}=", val)
37
+ end
38
+
39
+ def initialize(config)
40
+ @config = config
41
+ end
42
+
43
+ def inspect
44
+ {:api_token => api_token, :beta_id => beta_id, :live_id => live_id, :status => status, :notify => notify, :notes_type => notes_type, :always_show_update_reminder => always_show_update_reminder}.inspect
45
+ end
46
+
47
+ def configure!
48
+ customDeviceIdentifierForUpdateManager = <<EOF
49
+ def customDeviceIdentifierForUpdateManager(updateManager)
50
+ if UIDevice.currentDevice.respond_to?('uniqueIdentifier')
51
+ UIDevice.currentDevice.uniqueIdentifier
52
+ else
53
+ nil
54
+ end
55
+ end
56
+ EOF
57
+ launcher_code = <<EOF
58
+ # This file is automatically generated. Do not edit.
59
+
60
+ if Object.const_defined?('BITHockeyManager') and !UIDevice.currentDevice.model.include?('Simulator')
61
+ class BITHockeyManagerLauncher
62
+
63
+ def start
64
+ (@plist = NSBundle.mainBundle.objectForInfoDictionaryKey('HockeySDK')) && (@plist = @plist.first)
65
+ return unless @plist
66
+ NSNotificationCenter.defaultCenter.addObserverForName(UIApplicationDidBecomeActiveNotification, object:nil, queue:nil, usingBlock:lambda do |notification|
67
+ BITHockeyManager.sharedHockeyManager.configureWithBetaIdentifier(@plist['beta_id'], liveIdentifier:@plist['live_id'], delegate:self)
68
+ BITHockeyManager.sharedHockeyManager.crashManager.crashManagerStatus = BITCrashManagerStatusAutoSend
69
+ BITHockeyManager.sharedHockeyManager.startManager
70
+ end)
71
+ end
72
+
73
+ #{@config.release? ? "" : customDeviceIdentifierForUpdateManager}
74
+
75
+ end
76
+
77
+ BITHockeyManagerLauncher.new.start
78
+ end
79
+ EOF
80
+ launcher_file = './hockeyapp/launcher.rb'
81
+ FileUtils.mkdir_p('hockeyapp')
82
+ if !File.exist?(launcher_file) or File.read(launcher_file) != launcher_code
83
+ File.open(launcher_file, 'w') { |io| io.write(launcher_code) }
84
+ end
85
+ @configured ||= begin
86
+ @config.files << launcher_file
87
+ @config.vendor_project('vendor/HockeySDK/HockeySDK.framework', :static, products: ['HockeySDK'], headers_dir: 'Headers')
88
+ @config.resources_dirs += [ './vendor/HockeySDK/Resources' ]
89
+ @config.frameworks += [ 'HockeySDK' ]
90
+ true
91
+ end
92
+ end
93
+
94
+ end
95
+
96
+ module Motion; module Project; class Config
97
+
98
+ attr_accessor :hockeyapp_mode
99
+
100
+ variable :hockeyapp
101
+
102
+ def hockeyapp(&block)
103
+ @hockeyapp ||= HockeyAppConfig.new(self)
104
+ @hockeyapp.instance_eval(&block) unless block.nil?
105
+ @hockeyapp.configure!
106
+ @hockeyapp
107
+ end
108
+
109
+ def hockeyapp?
110
+ @hockeyapp_mode == true
111
+ end
112
+
113
+ end; end; end
114
+
115
+ namespace 'hockeyapp' do
116
+ desc "Submit an archive to HockeyApp"
117
+ task :submit do
118
+
119
+ App.config_without_setup.hockeyapp_mode = true
120
+
121
+ # Retrieve configuration settings.
122
+ prefs = App.config.hockeyapp
123
+
124
+ App.fail "A value for app.hockeyapp.api_token is mandatory" unless prefs.api_token
125
+ notes = ENV['notes'].to_s
126
+
127
+ Rake::Task["archive"].invoke
128
+
129
+ # An archived version of the .dSYM bundle is needed.
130
+ app_dsym = App.config.app_bundle('iPhoneOS').sub(/\.app$/, '.dSYM')
131
+ app_dsym_zip = app_dsym + '.zip'
132
+ if !File.exist?(app_dsym_zip) or File.mtime(app_dsym) > File.mtime(app_dsym_zip)
133
+ p app_dsym
134
+ Dir.chdir(File.dirname(app_dsym)) do
135
+ sh "/usr/bin/zip -q -r \"#{File.basename(app_dsym)}.zip\" \"#{File.basename(app_dsym)}\""
136
+ end
137
+ end
138
+
139
+ prefs.status ||= "2"
140
+ prefs.notify ||= "0"
141
+ prefs.notes_type ||= "1"
142
+
143
+ curl = %Q{/usr/bin/curl https://rink.hockeyapp.net/api/2/apps -F "status=#{prefs.status}" -F "notify=#{prefs.notify}" -F "notes=#{notes}" -F "notes_type=#{prefs.notes_type}" -F "ipa=@#{App.config.archive}" -F "dsym=@#{app_dsym_zip}" -H "X-HockeyAppToken: #{prefs.api_token}"}
144
+
145
+ App.info 'Run', curl
146
+ sh curl
147
+ end
148
+
149
+ desc "Records if the device build is created in hockeyapp mode, so some things can be cleaned up between mode switches"
150
+ task :record_mode do
151
+ hockeyapp_mode = App.config_without_setup.hockeyapp_mode ? "True" : "False"
152
+
153
+ platform = 'iPhoneOS'
154
+ bundle_path = App.config.app_bundle(platform)
155
+ build_dir = File.join(App.config.versionized_build_dir(platform))
156
+ FileUtils.mkdir_p(build_dir)
157
+ previous_hockeyapp_mode_file = File.join(build_dir, '.hockeyapp_mode')
158
+
159
+ previous_hockeyapp_mode = "False"
160
+ if File.exist?(previous_hockeyapp_mode_file)
161
+ previous_hockeyapp_mode = File.read(previous_hockeyapp_mode_file).strip
162
+ end
163
+ if previous_hockeyapp_mode != hockeyapp_mode
164
+ App.info "HockeyApp", "Cleaning executable, Info.plist, and PkgInfo for mode change (was: #{previous_hockeyapp_mode}, now: #{hockeyapp_mode})"
165
+ [
166
+ App.config.app_bundle_executable(platform), # main_exec
167
+ File.join(bundle_path, 'Info.plist'), # bundle_info_plist
168
+ File.join(bundle_path, 'PkgInfo') # bundle_pkginfo
169
+ ].each do |path|
170
+ rm_rf(path) if File.exist?(path)
171
+ end
172
+ end
173
+ File.open(previous_hockeyapp_mode_file, 'w') do |f|
174
+ f.write hockeyapp_mode
175
+ end
176
+ end
177
+ end
178
+
179
+ desc 'Same as hockeyapp:submit'
180
+ task 'hockeyapp' => 'hockeyapp:submit'
181
+
182
+ # record hockeyapp mode before every device build
183
+ task 'build:device' => 'hockeyapp:record_mode'
@@ -0,0 +1,25 @@
1
+ # Copyright (c) 2012, Joe Noon <joenoon@gmail.com>
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23
+ # POSSIBILITY OF SUCH DAMAGE.
24
+
25
+ require 'motion/project/hockeyapp'
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-hockeyapp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joe Noon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: motion-hockeyapp allows RubyMotion projects to easily embed the Hockey
15
+ SDK and be submitted to the HockeyApp platform.
16
+ email: joenoon@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.rdoc
22
+ - LICENSE
23
+ - lib/motion/project/hockeyapp.rb
24
+ - lib/motion-hockeyapp.rb
25
+ homepage: http://www.rubymotion.com
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.23
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: HockeyApp integration for RubyMotion projects
49
+ test_files: []