crittercism 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 930a2e36b9e1c6ce6e292ba4a7c6455610175837
4
- data.tar.gz: cf51892f16f07f0a8f6c6c4b09dd6fbfbab438be
3
+ metadata.gz: 784d6a16e59ddf0d79eba5a2f48c52810395636d
4
+ data.tar.gz: f8e6dea3fcc279336e01b8226040fa4fef7dd06e
5
5
  SHA512:
6
- metadata.gz: da198ef9ac20ea6a4f790eb306da8ee16f5bca7ab620e15bea32c4197a2dae1ff4e1167b79cae277cc8a0c8d87967b35985e4f69853498c8142cf42f7f68505d
7
- data.tar.gz: d74721cdaedeb6780404998ff367fa8d8e386e564ff53db4b286b83f2a38d3113e45a8b1573f40a7a743a04af7900a261f26e31022698a558f3fd960475a31cc
6
+ metadata.gz: f029423b3c6b92ebab56c912a17719ede869b1a971cd83c48b600b40d6fe1da66bbd34499d163aab6a877fd0d3ca710d33b34173d76c23ae5b0028fe477257d3
7
+ data.tar.gz: b7b52966c0ef200b24f2180ceda3e3bb044922d4b7201922e09f1c31637d40f2938d02623893917677f56a3ce3d15fdc39852d40c7a3e4a106108f94481184ff
data/README.md CHANGED
@@ -49,18 +49,17 @@ end
49
49
  Refer to the [Crittercism docs](http://docs.crittercism.com/ios/ios.html) for
50
50
  information on how to use Crittercism's other features.
51
51
 
52
- ### Rake Task
52
+ ### Uploading dSYM
53
53
 
54
- You will need to upload your app's dSYM to Crittercism for symbolication.
54
+ This gem automatically uploads your dSYM file to Crittercism on every build. To
55
+ disable dSYM upload on simulator builds, add this configuration to your Rakefile:
55
56
 
56
- $ rake crittercism:upload_dsym
57
+ app.crittercism_disable_on_simulator_builds = true
57
58
 
58
- Typically, you will want to upload your dSYM every time you build your app.
59
- You can configure your rake tasks to include this task.
59
+ If you want to manually upload your app's dSYM to Crittercism for symbolication,
60
+ you can use the following Rake task:
60
61
 
61
- ```ruby
62
- task :my_custom_deploy_task => ['archive:distribution', 'crittercism:upload_dsym']
63
- ```
62
+ $ rake crittercism:upload_dsym
64
63
 
65
64
  <!--
66
65
  ## Development
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "crittercism"
5
- spec.version = "0.1.1"
5
+ spec.version = "0.2.0"
6
6
  spec.authors = ["Andrew Havens"]
7
7
  spec.email = ["email@andrewhavens.com"]
8
8
 
@@ -1,18 +1,56 @@
1
- module Motion
2
- module Project
3
- class Config
4
- variable :crittercism_app_id, :crittercism_api_key
5
- end
1
+ module Crittercism
2
+ def self.platform(value = nil)
3
+ @platform = value if value
4
+ @platform ||= 'iPhoneOS'
5
+ @platform
6
6
  end
7
- end
8
7
 
9
- Motion::Project::App.setup do |app|
10
- app.pods do
11
- pod 'CrittercismSDK', '5.3.0' # any higher conflicts with New Relic, resulting in duplicate symbol errors
8
+ def self.upload_dsym
9
+ app_id = App.config.crittercism_app_id
10
+ api_key = App.config.crittercism_api_key
11
+
12
+ unless app_id && api_key
13
+ App.warn 'Missing Crittercism keys, skipping dSYM upload.'
14
+ return
15
+ end
16
+
17
+ if platform =~ /Simulator/ && App.config.crittercism_disable_on_simulator_builds
18
+ App.info 'Crittercism', 'Skipping dSYM upload on simulator build.'
19
+ return
20
+ end
21
+
22
+ zip_dsym!
23
+
24
+ app_dsym = App.config.app_bundle_dsym(platform)
25
+ upload_uri = "https://api.crittercism.com/api_beta/dsym/#{app_id}"
26
+ command = "/usr/bin/curl #{upload_uri}"\
27
+ " --silent --output /dev/null -w '%{http_code}'"\
28
+ " -F dsym=@'#{app_dsym}.zip'"\
29
+ " -F key='#{api_key}'"
30
+
31
+ App.info 'Crittercism', 'Uploading dSYM to Crittercism...'
32
+ output = %x[#{command}]
33
+ if output =~ /^2\d+/
34
+ App.info 'Crittercism', 'Successfully uploaded dSYM to Crittercism.'
35
+ else
36
+ p output
37
+ App.fail 'Failed to upload dSYM to Crittercism.'
38
+ end
12
39
  end
13
40
 
14
- # TODO: add runtime support for fetching configured App ID
15
- # app.files << 'rubymotion_lib/crittercism.rb'
41
+ def self.zip_dsym!
42
+ app_dsym = App.config.app_bundle_dsym(platform)
43
+ App.info 'Crittercism', 'Zipping dSYM file...'
44
+ App.fail "Could not find dSYM file at #{app_dsym}" unless File.exist?(app_dsym)
45
+
46
+ app_dsym_zip = app_dsym + '.zip'
47
+ if !File.exist?(app_dsym_zip) or File.mtime(app_dsym) > File.mtime(app_dsym_zip)
48
+ Dir.chdir(File.dirname(app_dsym)) do
49
+ %x[/usr/bin/zip -q -r '#{File.basename(app_dsym)}.zip' '#{File.basename(app_dsym)}']
50
+ end
51
+ end
52
+ end
16
53
  end
17
54
 
55
+ require "crittercism/rubymotion_extensions"
18
56
  require "crittercism/rake_tasks"
@@ -1,44 +1,6 @@
1
1
  namespace :crittercism do
2
-
3
- def platform
4
- # FIXME: need to be able to fetch this dynamically
5
- 'iPhoneOS'
6
- end
7
-
8
- def app_dsym
9
- App.config.app_bundle(platform) + '.dSYM'
10
- end
11
-
12
- desc 'Zip .dSYM file'
13
- task :zip_dsym do
14
- puts 'Zipping dSYM file...'
15
- raise "Could not find dSYM file at #{app_dsym}" unless File.exist?(app_dsym)
16
-
17
- app_dsym_zip = app_dsym + '.zip'
18
- if !File.exist?(app_dsym_zip) or File.mtime(app_dsym) > File.mtime(app_dsym_zip)
19
- Dir.chdir(File.dirname(app_dsym)) do
20
- sh "/usr/bin/zip -q -r '#{File.basename(app_dsym)}.zip' '#{File.basename(app_dsym)}'"
21
- end
22
- end
23
- end
24
-
25
- desc 'Submit .dSYM to Crittercism'
26
- task :upload_dsym => :zip_dsym do
27
- puts 'Submitting dSYM to Crittercism...'
28
-
29
- upload_uri = "https://api.crittercism.com/api_beta/dsym/#{App.config.crittercism_app_id}"
30
- command = "/usr/bin/curl #{upload_uri}"\
31
- " --silent --output /dev/null -w '%{http_code}'"\
32
- " -F dsym=@'#{app_dsym}.zip'"\
33
- " -F key='#{App.config.crittercism_api_key}'"
34
-
35
- output = %x[#{command}]
36
- if output =~ /^2\d+/
37
- puts 'Successfully uploaded dSYM to Crittercism.'
38
- else
39
- puts 'Failed to upload dSYM to Crittercism.'
40
- p output
41
- exit 1
42
- end
2
+ desc 'Upload dSYM file to Crittercism'
3
+ task :upload_dsym do
4
+ Crittercism.upload_dsym
43
5
  end
44
6
  end
@@ -0,0 +1,34 @@
1
+ module Crittercism
2
+ module BuilderExtensions
3
+ def build(config, platform, opts)
4
+ super
5
+ Crittercism.platform(platform)
6
+ Crittercism.upload_dsym
7
+ end
8
+ end
9
+ end
10
+
11
+ module Motion
12
+ module Project
13
+ class Builder
14
+ prepend Crittercism::BuilderExtensions
15
+ end
16
+ end
17
+ end
18
+
19
+ module Motion
20
+ module Project
21
+ class Config
22
+ variable :crittercism_app_id, :crittercism_api_key, :crittercism_disable_on_simulator_builds
23
+ end
24
+ end
25
+ end
26
+
27
+ Motion::Project::App.setup do |app|
28
+ app.pods do
29
+ pod 'CrittercismSDK', '~> 5.4.0'
30
+ end
31
+
32
+ # TODO: add runtime support for fetching configured App ID
33
+ # app.files << 'rubymotion_lib/crittercism.rb'
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crittercism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Havens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods
@@ -85,6 +85,7 @@ files:
85
85
  - crittercism.gemspec
86
86
  - lib/crittercism.rb
87
87
  - lib/crittercism/rake_tasks.rb
88
+ - lib/crittercism/rubymotion_extensions.rb
88
89
  - rubymotion_lib/crittercism.rb
89
90
  homepage: https://github.com/andrewhavens/crittercism
90
91
  licenses: