asca 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +23 -2
- data/README.md +19 -2
- data/asca.gemspec +1 -1
- data/exe/asca +13 -3
- data/lib/asca.rb +1 -0
- data/lib/asca/log.rb +53 -0
- data/lib/asca/profiles.rb +10 -8
- data/lib/asca/token.rb +5 -5
- data/lib/asca/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc9b810b18682238d1c5f99d0a623e99463e9160adc17d785b9fa63212dd0f0b
|
4
|
+
data.tar.gz: 0d735db64772cde9d62c447fe1e7dd60f7c19b26472b6168d75b5d05992278e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7435d44fe5e5f51b17e5694b1e1014079b7261e646bfa4717ebf2db8a695b04151e6bab12030819325fe781b9abe8e4f75676803dca3a2a4d3f6c669a70f826
|
7
|
+
data.tar.gz: 04b5f0cbe2485bf6a3f3b04253c0629ea5e3860efe02de6c1f8614e11d2642b3ed925d0ca7aee8bf642bba4740b1654b5b4f45d92ec8569537e27942b16cacac
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,18 +2,39 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
asca (0.1.0)
|
5
|
-
|
5
|
+
http
|
6
6
|
json
|
7
7
|
jwt
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
|
12
|
+
addressable (2.7.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
|
+
domain_name (0.5.20190701)
|
15
|
+
unf (>= 0.0.5, < 1.0.0)
|
16
|
+
ffi (1.13.1)
|
17
|
+
ffi-compiler (1.0.1)
|
18
|
+
ffi (>= 1.0.0)
|
19
|
+
rake
|
20
|
+
http (4.4.1)
|
21
|
+
addressable (~> 2.3)
|
22
|
+
http-cookie (~> 1.0)
|
23
|
+
http-form_data (~> 2.2)
|
24
|
+
http-parser (~> 1.2.0)
|
25
|
+
http-cookie (1.0.3)
|
26
|
+
domain_name (~> 0.5)
|
27
|
+
http-form_data (2.3.0)
|
28
|
+
http-parser (1.2.1)
|
29
|
+
ffi-compiler (>= 1.0, < 2.0)
|
13
30
|
json (2.3.1)
|
14
31
|
jwt (2.2.2)
|
15
32
|
minitest (5.14.1)
|
33
|
+
public_suffix (4.0.5)
|
16
34
|
rake (10.5.0)
|
35
|
+
unf (0.1.4)
|
36
|
+
unf_ext
|
37
|
+
unf_ext (0.0.7.7)
|
17
38
|
|
18
39
|
PLATFORMS
|
19
40
|
ruby
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Asca
|
2
2
|
|
3
|
+
[![GitHub license](https://img.shields.io/github/license/xueminghao/appstoreconnectapi)](https://github.com/xueminghao/appstoreconnectapi/blob/master/LICENSE.txt)
|
4
|
+
[![npm](https://img.shields.io/npm/v/asca)](https://rubygems.org/gems/asca)
|
5
|
+
|
3
6
|
An apple app store connect api wrapper based on ruby!!!
|
4
7
|
|
5
8
|
Why ruby?
|
@@ -8,13 +11,27 @@ Every mac's ready for ruby out of the box!!!
|
|
8
11
|
|
9
12
|
## Installation
|
10
13
|
|
11
|
-
|
14
|
+
Install from rubygem.org
|
12
15
|
|
13
|
-
```
|
16
|
+
``` sh
|
17
|
+
gem install asca
|
18
|
+
```
|
19
|
+
|
20
|
+
Install from github
|
21
|
+
|
22
|
+
``` sh
|
14
23
|
gem install specific_install
|
15
24
|
gem specific_install https://github.com/xueminghao/appstoreconnectapi.git
|
16
25
|
```
|
17
26
|
|
27
|
+
## What you need
|
28
|
+
|
29
|
+
1. App store connect key id
|
30
|
+
1. App store connect issuer ID
|
31
|
+
1. App store connect private key
|
32
|
+
|
33
|
+
For more details for how and where to get these info, you can refer to the [App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests)
|
34
|
+
|
18
35
|
## Usage
|
19
36
|
|
20
37
|
* Download provisioning files by name from developer account
|
data/asca.gemspec
CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
32
|
spec.add_development_dependency "minitest", "~> 5.0"
|
33
33
|
spec.add_dependency "json"
|
34
|
-
spec.add_dependency "
|
34
|
+
spec.add_dependency "http"
|
35
35
|
spec.add_dependency 'jwt'
|
36
36
|
end
|
data/exe/asca
CHANGED
@@ -12,19 +12,29 @@ options = {}
|
|
12
12
|
option_parser = OptionParser.new do |opts|
|
13
13
|
opts.banner = 'This is an apple connect api wrapper cli.'
|
14
14
|
|
15
|
-
opts.on('-a action-name', '--action action-name', 'profile-install, profile-download') do |value|
|
15
|
+
opts.on('-a action-name', '--action action-name', 'version, profile-install, profile-download') do |value|
|
16
16
|
options[:action] = value
|
17
17
|
end
|
18
18
|
opts.on('-n name', '--name name', 'Profile name') do |value|
|
19
19
|
options[:profile_name] = value
|
20
20
|
end
|
21
|
+
opts.on('-v', '--version', 'Get current version') do |value|
|
22
|
+
options[:action] = 'version'
|
23
|
+
end
|
21
24
|
end.parse!
|
22
25
|
|
23
26
|
case options[:action]
|
27
|
+
when 'version'
|
28
|
+
Asca::Log.info(Asca::VERSION)
|
24
29
|
when 'profile-download'
|
25
|
-
|
30
|
+
Asca::Profiles.download_profile options[:profile_name]
|
26
31
|
when 'profile-install'
|
27
|
-
|
32
|
+
Asca::Profiles.install_profile options[:profile_name]
|
28
33
|
else
|
34
|
+
if options[:action]
|
29
35
|
puts "Unsupported action: " + options[:action]
|
36
|
+
else
|
37
|
+
puts Asca::Log.error('Wrong parameters')
|
38
|
+
end
|
39
|
+
|
30
40
|
end
|
data/lib/asca.rb
CHANGED
data/lib/asca/log.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
module Asca
|
2
|
+
class Log
|
3
|
+
class Color
|
4
|
+
class << self
|
5
|
+
def time
|
6
|
+
"\e[37m"
|
7
|
+
end
|
8
|
+
|
9
|
+
def warn
|
10
|
+
"\e[33;1m"
|
11
|
+
end
|
12
|
+
|
13
|
+
def info
|
14
|
+
"\e[32m"
|
15
|
+
end
|
16
|
+
|
17
|
+
def error
|
18
|
+
"\e[31;1m"
|
19
|
+
end
|
20
|
+
|
21
|
+
def reset
|
22
|
+
"\e[0m"
|
23
|
+
end
|
24
|
+
|
25
|
+
def command
|
26
|
+
"\e[34m"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def warn message
|
33
|
+
puts "#{Color.warn}WARN: #{message}#{Color.reset}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def info message
|
37
|
+
puts "#{Color.info}INFO: #{message}#{Color.reset}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def error message
|
41
|
+
puts "#{Color.error}ERROR: #{message}#{Color.reset}", STDERR
|
42
|
+
end
|
43
|
+
|
44
|
+
def command message
|
45
|
+
puts "#{Color.command}RUN: \e[4m#{message}#{Color.reset}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def puts message, io = STDOUT
|
49
|
+
io.puts "#{Color.time}[#{Time.new}]#{Color.reset} #{message}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/asca/profiles.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'http'
|
2
2
|
require 'json'
|
3
3
|
require "base64"
|
4
4
|
|
@@ -14,13 +14,15 @@ module Asca
|
|
14
14
|
Asca::Configuration.update_config('out_put_dir', out_put_dir)
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
response = HTTP.auth('Bearer ' + Asca::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => profile_name })
|
18
|
+
if response.status.success?
|
19
|
+
profile_obj = JSON.parse(response.body)
|
20
|
+
profile_content = profile_obj["data"][0]["attributes"]['profileContent']
|
21
|
+
File.open(File.expand_path(profile_name + ".mobileprovision", out_put_dir), 'w') do |file|
|
22
|
+
file.write(Base64.decode64(profile_content))
|
23
|
+
end
|
24
|
+
else
|
25
|
+
Log.error(response.body)
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
data/lib/asca/token.rb
CHANGED
@@ -77,15 +77,15 @@ module Asca
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def get_token_from_cache
|
80
|
-
|
81
|
-
if !
|
80
|
+
token_valid_max_time = Asca::Configuration.get_config('cache_token_time')
|
81
|
+
if !token_valid_max_time
|
82
82
|
return nil
|
83
83
|
end
|
84
84
|
current = Time.now.to_i
|
85
|
-
if
|
86
|
-
return
|
85
|
+
if token_valid_max_time > current
|
86
|
+
return Asca::Configuration.get_config('cache_token')
|
87
87
|
end
|
88
|
-
return
|
88
|
+
return nil
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
data/lib/asca/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xueminghao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: http
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/asca.rb
|
119
119
|
- lib/asca/configuration.rb
|
120
120
|
- lib/asca/consts.rb
|
121
|
+
- lib/asca/log.rb
|
121
122
|
- lib/asca/profiles.rb
|
122
123
|
- lib/asca/token.rb
|
123
124
|
- lib/asca/version.rb
|