fabricate 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/fabricate +42 -0
- data/fabricate.gemspec +27 -0
- data/lib/fabricate.rb +75 -0
- data/lib/fabricate/version.rb +3 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da50f061f974d2411805b7bffd65ae49facc2440
|
4
|
+
data.tar.gz: 4aa06a6835dc800786baccb17fa13c5fa4238d5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b904ce06f298f197b8ea0e5eb8c6f25a2c5365db99298aa72f85d30077aa9eca8ecc81888dd89368fbf8c30f820a1e7883b5977bfca8955b7dda2a78f6cdb046
|
7
|
+
data.tar.gz: dab9ee59f6e3b22de815d47d0850d430d6d81c39e6fa91d466114ef7efa332a16da68a3ebc3b156f903f785ec0e38eacf20b37151dbcd9ef4529a3b40f397f89
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fabricate (0.0.1)
|
5
|
+
faraday (>= 0.9)
|
6
|
+
oga
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ansi (1.5.0)
|
12
|
+
ast (2.3.0)
|
13
|
+
faraday (0.13.1)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
multipart-post (2.0.0)
|
16
|
+
oga (2.11)
|
17
|
+
ast
|
18
|
+
ruby-ll (~> 2.1)
|
19
|
+
rake (10.5.0)
|
20
|
+
ruby-ll (2.1.2)
|
21
|
+
ansi
|
22
|
+
ast
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 1.12)
|
29
|
+
fabricate!
|
30
|
+
rake (~> 10.0)
|
31
|
+
|
32
|
+
BUNDLED WITH
|
33
|
+
1.15.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Igor Makarov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# fabricate
|
2
|
+
|
3
|
+
A small CLI tool that uploads dSYM files to Crashlytics without using their binary.
|
4
|
+
Useful for running in a Linux environment, for example.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install fabricate
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
$ Usage: fabricate [options]
|
13
|
+
-v, --verbose Output diagnosic info
|
14
|
+
-a APP_IDENTIFIER, Application bundle ID
|
15
|
+
--app_identifier
|
16
|
+
-k, --api_key API_KEY Fabric API key (public)
|
17
|
+
-f, --filename FILENAME File to upload)
|
18
|
+
-h, --help Show this help message
|
19
|
+
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/igor-makarov/fabricate.
|
24
|
+
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
29
|
+
|
data/Rakefile
ADDED
data/bin/fabricate
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fabricate'
|
4
|
+
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
# This will hold the options we parse
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
optparse = OptionParser.new do |parser|
|
11
|
+
parser.banner = "Usage: #{File.basename(__FILE__)} [options]"
|
12
|
+
parser.on("-v", "--verbose", TrueClass, "Output diagnosic info") do |v|
|
13
|
+
options[:verbose] = true
|
14
|
+
end
|
15
|
+
parser.on("-a", "--app_identifier APP_IDENTIFIER", "Application bundle ID") do |v|
|
16
|
+
options[:app_identifier] = v
|
17
|
+
end
|
18
|
+
parser.on("-k", "--api_key API_KEY", "Fabric API key (public)") do |v|
|
19
|
+
options[:api_key] = v
|
20
|
+
end
|
21
|
+
parser.on("-f", "--filename FILENAME", "File to upload)") do |v|
|
22
|
+
options[:filename] = v
|
23
|
+
end
|
24
|
+
parser.on("-h", "--help", "Show this help message") do
|
25
|
+
puts parser
|
26
|
+
exit 0
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
optparse.parse!
|
32
|
+
mandatory = [:app_identifier, :api_key, :filename]
|
33
|
+
missing = mandatory.select{ |param| options[param].nil? }
|
34
|
+
raise OptionParser::MissingArgument.new(missing.join(', ')) unless missing.empty?
|
35
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
36
|
+
puts $!.to_s
|
37
|
+
exit 255
|
38
|
+
end
|
39
|
+
|
40
|
+
executor = Fabricate::Fabricate.new(options)
|
41
|
+
executor.verbose = options[:verbose] || false
|
42
|
+
executor.run!
|
data/fabricate.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fabricate/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = File.basename(__FILE__, '.gemspec')
|
8
|
+
spec.version = Fabricate::VERSION
|
9
|
+
spec.authors = ["Igor Makarov"]
|
10
|
+
spec.email = ["igormaka@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Fabricate"
|
13
|
+
spec.description = "A gem that uploads dSYM files to fabric. OS-independent and can be used on linux"
|
14
|
+
spec.homepage = "https://github.com/igor-makarov/fabricate"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'faraday', '>= 0.9'
|
23
|
+
spec.add_dependency 'oga'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
data/lib/fabricate.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'oga'
|
3
|
+
require 'json'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
module Fabricate
|
7
|
+
class Fabricate
|
8
|
+
attr_reader :app_identifier
|
9
|
+
attr_reader :api_key
|
10
|
+
attr_reader :filename
|
11
|
+
attr_reader :developer_token
|
12
|
+
attr_accessor :verbose
|
13
|
+
|
14
|
+
def initialize(options)
|
15
|
+
@app_identifier = options[:app_identifier]
|
16
|
+
@api_key = options[:api_key]
|
17
|
+
@filename = options[:filename]
|
18
|
+
end
|
19
|
+
|
20
|
+
def run!
|
21
|
+
debug "Getting CSRF token..."
|
22
|
+
response = Faraday.get "https://fabric.io/login"
|
23
|
+
document = Oga.parse_html(response.body)
|
24
|
+
csrf_token = document.at_css('meta[name="csrf-token"]')['content']
|
25
|
+
raise "No CSRF token!" if csrf_token.nil?
|
26
|
+
debug "CSRF token: #{csrf_token}"
|
27
|
+
|
28
|
+
debug "Getting developer token..."
|
29
|
+
response = Faraday.get "https://fabric.io/api/v2/client_boot/config_data" do |req|
|
30
|
+
req.headers['X-CSRF-Token'] = csrf_token
|
31
|
+
end
|
32
|
+
developer_token = JSON.parse!(response.body)['developer_token']
|
33
|
+
debug "Developer token: #{developer_token}"
|
34
|
+
raise "No developer token!" if developer_token.nil?
|
35
|
+
@developer_token = developer_token
|
36
|
+
|
37
|
+
debug "Uploading file..."
|
38
|
+
upload_file!
|
39
|
+
end
|
40
|
+
|
41
|
+
def upload_file!
|
42
|
+
conn = Faraday.new do |conn|
|
43
|
+
conn.request :multipart
|
44
|
+
conn.request :url_encoded
|
45
|
+
# Last middleware must be the adapter:
|
46
|
+
conn.adapter :net_http
|
47
|
+
end
|
48
|
+
|
49
|
+
payload = Hash.new
|
50
|
+
payload['code_mapping[file]'] = Faraday::UploadIO.new(filename, 'application/zip')
|
51
|
+
payload['code_mapping[type]'] = 'dsym'
|
52
|
+
payload['project[identifier]'] = app_identifier
|
53
|
+
|
54
|
+
response = conn.post "https://cm.crashlytics.com/api/v3/platforms/ios/code_mappings", payload do |req|
|
55
|
+
req.headers['X-CRASHLYTICS-API-KEY'] = api_key
|
56
|
+
req.headers['X-CRASHLYTICS-DEVELOPER-TOKEN'] = developer_token
|
57
|
+
end
|
58
|
+
debug "Status: #{response.status}"
|
59
|
+
debug response.body
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def debug(message)
|
64
|
+
STDERR.puts message if verbose
|
65
|
+
end
|
66
|
+
|
67
|
+
def print(message)
|
68
|
+
STDERR.puts message
|
69
|
+
end
|
70
|
+
|
71
|
+
def output(message)
|
72
|
+
puts message
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fabricate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Makarov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oga
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: A gem that uploads dSYM files to fabric. OS-independent and can be used
|
70
|
+
on linux
|
71
|
+
email:
|
72
|
+
- igormaka@gmail.com
|
73
|
+
executables:
|
74
|
+
- fabricate
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/fabricate
|
85
|
+
- fabricate.gemspec
|
86
|
+
- lib/fabricate.rb
|
87
|
+
- lib/fabricate/version.rb
|
88
|
+
homepage: https://github.com/igor-makarov/fabricate
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.5.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Fabricate
|
112
|
+
test_files: []
|