xcjobs-crittercism-oauth2 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e8a59bbb391548e7da1e00a00eecfe29a2446871
4
+ data.tar.gz: cedab42f37f49faa6552fdf5196ca0e56a25cbbd
5
+ SHA512:
6
+ metadata.gz: 4a327bfd195b7347d93cfd399d7caf4ba5e44b3bbcb1ce8d8e3efbfa6dd439014bd7c435627c3974c6d0096a1e5fff1242a14266d02906011b5a9355c0b8f1e1
7
+ data.tar.gz: 48143894ee24839419e9e0b730f7d4ec13f941c2901c8eb214ccc388a3ba765f1e611288e36bf054870cbabe99c5e68797c980fbfead2ef00f863a4450371280
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xcjobs-crittercism-oauth2.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 yuki.takahashi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Xcjobs::Crittercism::OAuth2
2
+
3
+ Crittercism plugin for xcjobs
4
+
5
+ + [xcjobs](https://github.com/kishikawakatsumi/xcjobs)
6
+ + [Crittercism](https://www.crittercism.com/)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'xcjobs-crittercism-oauth2'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install xcjobs-crittercism-oauth2
23
+
24
+ ## Usage
25
+
26
+ ```ruby
27
+ XCJobs::Distribute::Crittercism:OAuth2.new do |t|
28
+ t.app_id = 'xxx...'
29
+ t.token = 'xxx...'
30
+ t.dsym = File.join('build', "dSYMs.zip")
31
+ end
32
+ ```
33
+
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/[my-github-username]/xcjobs-crittercism-oauth2/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "xcjobs/crittercism/oauth2"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,69 @@
1
+ require "xcjobs/crittercism/oauth2/version"
2
+ require 'xcjobs/distribute'
3
+
4
+ module XCJobs
5
+ module Distribute
6
+ class Crittercism
7
+
8
+ class OAuth2 < Rake::TaskLib
9
+ include Rake::DSL if defined?(Rake::DSL)
10
+ include Distribute
11
+
12
+ # required
13
+ attr_accessor :app_id
14
+ attr_accessor :token
15
+ attr_accessor :dsym
16
+
17
+ def initialize()
18
+ yield self if block_given?
19
+ @upload_url = "https://files.crittercism.com/api/v1/applications/#{app_id}/symbol-uploads"
20
+ @process_symbol_url = "https://app.crittercism.com/v1.0/app/#{app_id}/symbols/uploads"
21
+ @oauth_header = "-H 'Authorization: Bearer #{token}'"
22
+ define
23
+ end
24
+
25
+ private
26
+
27
+ def define
28
+ namespace :distribute do
29
+ desc 'upload & process dSYMs to Crittercism using OAuth2'
30
+ task :crittercism_oauth2 do
31
+ begin
32
+ resource_id = create_resource_id
33
+ upload_dsym(resource_id)
34
+ process_symbols(resource_id)
35
+ rescue => ex
36
+ fail ex
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def create_resource_id
43
+ response = `/usr/bin/curl -X POST #{@upload_url} #{@oauth_header} --silent`
44
+ resource_id = JSON.parse(response)["resource-id"]
45
+ if resource_id.nil? then
46
+ throw "Crittercism Resource FAILED create"
47
+ end
48
+ resource_id
49
+ end
50
+
51
+ def upload_dsym(resource_id)
52
+ response = `/usr/bin/curl -X PUT #{@upload_url}/#{resource_id} --write-out %{http_code} --silent --output /dev/null -F name=symbolUpload -F filedata=@"#{dsym}" #{@oauth_header}`
53
+ if response != "202" then
54
+ throw "Crittercism Resource #{resource_id} Uploaded: FAILED #{response}"
55
+ end
56
+ end
57
+
58
+ def process_symbols(resource_id)
59
+ json = '{ "uploadUuid": "' + resource_id + '", "filename":"upload.zip" }'
60
+ response = `/usr/bin/curl --write-out %{http_code} --silent --output /dev/null -X POST "#{process_symbol_url}" --silent -d '#{json}' #{oauth_header} -H 'Content-Type: application/json'`
61
+ if response != "200" then
62
+ throw "Crittercism Resource #{resource_id} Processed: FAILED #{response}"
63
+ end
64
+ end
65
+
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,7 @@
1
+ module Xcjobs
2
+ module Crittercism
3
+ module Oauth2
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcjobs/crittercism/oauth2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xcjobs-crittercism-oauth2"
8
+ spec.version = Xcjobs::Crittercism::Oauth2::VERSION
9
+ spec.authors = ["ukitaka"]
10
+ spec.email = ["yuki.takahashi.1126@gmail.com"]
11
+
12
+ spec.summary = %q{crittercism plugin for xcjobs}
13
+ spec.description = %q{
14
+ Crittercism plugin for xcjobs.
15
+ You can upload dSYM using new api.
16
+ If you use Xcode7, `/api_beta/dsym/` doesn't work.
17
+
18
+ xcjobs:
19
+ https://github.com/kishikawakatsumi/xcjobs
20
+ }
21
+ spec.homepage = "https://github.com/ukitaka/xcjobs-crittercism-oauth2"
22
+ spec.license = "MIT"
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.8"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_runtime_dependency "xcjobs", "~> 0.1"
32
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcjobs-crittercism-oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ukitaka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcjobs
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ description: "\n Crittercism plugin for xcjobs.\n You can upload dSYM using
56
+ new api.\n If you use Xcode7, `/api_beta/dsym/` doesn't work.\n \n xcjobs:
57
+ \n https://github.com/kishikawakatsumi/xcjobs\n "
58
+ email:
59
+ - yuki.takahashi.1126@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - lib/xcjobs/crittercism/oauth2.rb
72
+ - lib/xcjobs/crittercism/oauth2/version.rb
73
+ - xcjobs-crittercism-oauth2.gemspec
74
+ homepage: https://github.com/ukitaka/xcjobs-crittercism-oauth2
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: crittercism plugin for xcjobs
98
+ test_files: []