motion-instabug 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea4d29ff7636a8405df8b5048ab8033e8075fc2c
4
+ data.tar.gz: 39dfbd8d4fa862d42ea9a352d7b3c0842d3f2987
5
+ SHA512:
6
+ metadata.gz: 9951e07a7f2324b13b3480bbbfc5533e52f33c5351348fadb1be99bb5353b7803a3ae522514bc155763c00f705e980b2d288733fa6bb8fb58be3bafaddcd9e2f
7
+ data.tar.gz: a3db4d6ba04000702cd4b0ec2efe5dd339145a84444eabf667a7eb101ff084c0f9b00ccdad6f217b933c4507e7edff23e4ddb382e7dce7761a77f5c3f75d0f13
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014, Benjamin Michotte <bmichotte@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.
@@ -0,0 +1,71 @@
1
+ # motion-instabug
2
+
3
+ motion-instabug allows RubyMotion projects to easily embed the Instabug
4
+ SDK and be submitted to the Instabug platform.
5
+
6
+ ## Requirements
7
+
8
+ * RubyMotion 1.0 or greater (see http://www.rubymotion.com).
9
+ * An Instabug account, can be obtained for free at http://instabug.com.
10
+
11
+ ## Installation
12
+
13
+ 1. `gem install motion-instabug`
14
+
15
+ 2. `require 'motion-instabug'` or add to your `Gemfile` (`gem 'motion-instabug'`)
16
+
17
+ 3. `rake pod:install`
18
+
19
+ ## Setup
20
+
21
+ Edit the **Rakefile** of your RubyMotion project and add the following require lines.
22
+
23
+ ```ruby
24
+ Motion::Project::App.setup do |app|
25
+ # ...
26
+ app.instabug do
27
+ app.instabug.api_token = 'your_instabug_token'
28
+ end
29
+ end
30
+ ```
31
+
32
+ You can retrieve the values for **api_token** in your Instabug account page.
33
+
34
+ ## Usage
35
+
36
+ motion-instabug introduces a **instabug** Rake task to your project, which can be used to submit a build.
37
+
38
+ `$ rake instabug`
39
+
40
+ ## Todo
41
+
42
+ Color customization from the Rakefile
43
+
44
+ ## Thanks
45
+
46
+ This gem is a copy-paste of https://github.com/HipByte/motion-testflight so thanks Laurent Sansonetti <lrz@hipbyte.com>
47
+
48
+ ## License
49
+
50
+ Copyright (c) 2014, Benjamin Michotte <bmichotte@gmail.com>
51
+ All rights reserved.
52
+
53
+ Redistribution and use in source and binary forms, with or without
54
+ modification, are permitted provided that the following conditions are met:
55
+
56
+ 1. Redistributions of source code must retain the above copyright notice, this
57
+ list of conditions and the following disclaimer.
58
+ 2. Redistributions in binary form must reproduce the above copyright notice,
59
+ this list of conditions and the following disclaimer in the documentation
60
+ and/or other materials provided with the distribution.
61
+
62
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
63
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
64
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
65
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
66
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
67
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
68
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
69
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
70
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
71
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2014, Benjamin Michotte <bmichotte@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.
23
+
24
+ require 'motion/project/instabug'
@@ -0,0 +1,160 @@
1
+ # Copyright (c) 2014, Benjamin Michotte <bmichotte@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.
23
+ #
24
+
25
+ unless defined?(Motion::Project::Config)
26
+ raise 'This file must be required within a RubyMotion project Rakefile.'
27
+ end
28
+
29
+ Motion::Project::App.setup do |app|
30
+ app.pods do
31
+ pod 'Instabug'
32
+ end
33
+ end
34
+
35
+ class InstabugConfig
36
+ attr_accessor :api_token
37
+
38
+ def initialize(config)
39
+ @config = config
40
+ end
41
+
42
+ def sdk=(sdk)
43
+ if @sdk != sdk
44
+ @config.unvendor_project(@sdk)
45
+ @sdk = sdk
46
+ @config.vendor_project(sdk, :static)
47
+ libz = '/usr/lib/libz.dylib'
48
+ @config.libs << libz unless @config.libs.index(libz)
49
+ end
50
+ end
51
+
52
+ def api_token=(api_token)
53
+ @api_token = api_token
54
+ create_launcher
55
+ end
56
+
57
+ def inspect
58
+ {:api_token => api_token}.inspect
59
+ end
60
+
61
+ private
62
+
63
+ def create_launcher
64
+ return unless api_token
65
+ launcher_code = <<EOF
66
+ # This file is automatically generated. Do not edit.
67
+
68
+ if Object.const_defined?('Instabug') and !UIDevice.currentDevice.model.include?('Simulator')
69
+ NSNotificationCenter.defaultCenter.addObserverForName(UIApplicationDidFinishLaunchingNotification, object:nil, queue:nil, usingBlock:lambda do |notification|
70
+ Instabug.startWithToken('#{api_token}', captureSource: IBGCaptureSourceUIKit, invocationEvent: IBGInvocationEventShake)
71
+ end)
72
+ end
73
+ EOF
74
+ launcher_file = './app/instabug_launcher.rb'
75
+ if !File.exist?(launcher_file) or File.read(launcher_file) != launcher_code
76
+ File.open(launcher_file, 'w') { |io| io.write(launcher_code) }
77
+ end
78
+ files = @config.files.flatten
79
+ files << launcher_file unless files.find { |x| File.expand_path(x) == File.expand_path(launcher_file) }
80
+ end
81
+ end
82
+
83
+ module Motion; module Project; class Config
84
+
85
+ attr_accessor :instabug_mode
86
+
87
+ variable :instabug
88
+
89
+ def instabug
90
+ @instabug ||= InstabugConfig.new(self)
91
+ yield @instabug if block_given? && instabug?
92
+ @instabug
93
+ end
94
+
95
+ def instabug?
96
+ @instabug_mode == true
97
+ end
98
+
99
+ end; end; end
100
+
101
+ namespace 'instabug' do
102
+ desc "Submit an archive to Instabug"
103
+ task :submit do
104
+
105
+ App.config_without_setup.instabug_mode = true
106
+
107
+ # Retrieve configuration settings.
108
+ prefs = App.config.instabug
109
+ App.fail "A value for app.instabug.api_token is mandatory" unless prefs.api_token
110
+
111
+ Rake::Task["archive"].invoke
112
+
113
+ # An archived version of the .dSYM bundle is needed.
114
+ app_dsym = App.config.app_bundle_dsym('iPhoneOS')
115
+ app_dsym_zip = app_dsym + '.zip'
116
+ if !File.exist?(app_dsym_zip) or File.mtime(app_dsym) > File.mtime(app_dsym_zip)
117
+ Dir.chdir(File.dirname(app_dsym)) do
118
+ sh "/usr/bin/zip -q -r \"#{File.basename(app_dsym)}.zip\" \"#{File.basename(app_dsym)}\""
119
+ end
120
+ end
121
+ curl = "/usr/bin/curl https://www.instabug.com/api/ios/v1/dsym --write-out %{http_code} --silent --output /dev/null -F dsym=@\"#{app_dsym_zip}\" -F token=\"#{prefs.api_token}\""
122
+ App.info 'Run', curl
123
+ sh curl
124
+ end
125
+
126
+ desc "Records if the device build is created in instabug mode, so some things can be cleaned up between mode switches"
127
+ task :record_mode do
128
+ instabug_mode = App.config_without_setup.instabug_mode ? "True" : "False"
129
+
130
+ platform = 'iPhoneOS'
131
+ bundle_path = App.config.app_bundle(platform)
132
+ build_dir = File.join(App.config.versionized_build_dir(platform))
133
+ FileUtils.mkdir_p(build_dir)
134
+ previous_instabug_mode_file = File.join(build_dir, '.instabug_mode')
135
+
136
+ previous_instabug_mode = "False"
137
+ if File.exist?(previous_instabug_mode_file)
138
+ previous_instabug_mode = File.read(previous_instabug_mode_file).strip
139
+ end
140
+ if previous_instabug_mode != instabug_mode
141
+ App.info "Instabug", "Cleaning executable, Info.plist, and PkgInfo for mode change (was: #{previous_instabug_mode}, now: #{instabug_mode})"
142
+ [
143
+ App.config.app_bundle_executable(platform), # main_exec
144
+ File.join(bundle_path, 'Info.plist'), # bundle_info_plist
145
+ File.join(bundle_path, 'PkgInfo') # bundle_pkginfo
146
+ ].each do |path|
147
+ rm_rf(path) if File.exist?(path)
148
+ end
149
+ end
150
+ File.open(previous_instabug_mode_file, 'w') do |f|
151
+ f.write instabug_mode
152
+ end
153
+ end
154
+ end
155
+
156
+ desc 'Same as instabug:submit'
157
+ task 'instabug' => 'instabug:submit'
158
+
159
+ # record instabug mode before every device build
160
+ task 'build:device' => 'instabug:record_mode'
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-instabug
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Benjamin Michotte
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: motion-cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: motion-require
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ description: motion-instabug allows RubyMotion projects to easily embed the Instabug
42
+ SDK and be submitted to the Instabug platform.
43
+ email: bmichotte@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.md
50
+ - lib/motion-instabug.rb
51
+ - lib/motion/project/instabug.rb
52
+ homepage:
53
+ licenses: []
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.2.2
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: Instabug integration for RubyMotion projects
75
+ test_files: []