appetize-cli 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/CHANGELOG.md +5 -1
- data/README.md +57 -17
- data/appetize.gemspec +4 -4
- data/exe/appetize +6 -6
- data/lib/appetize/cli.rb +14 -15
- data/lib/appetize/command.rb +11 -11
- data/lib/appetize/commands/delete.rb +10 -15
- data/lib/appetize/commands/upload.rb +9 -17
- data/lib/appetize/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2101282d9a12bdff13f6a1dd9201f02ad8d2a224cb3a3812062fcd071055d45
|
4
|
+
data.tar.gz: b15eb9a303bf9a1eacd987e104389d152f099e041449a58849eaeb2e6ea106c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 928614f04e34a1cde2585b6d626e83a7e3b78610b9349142ab212f8c8cd3b50a78dc4566d49f6b688826e9a9d21802ce0b5a6dd485bc4bdb733f674af53da49b
|
7
|
+
data.tar.gz: 22ca9b064911e3271dc4c1aba63bc7a37761cca606ca1337465c7c66550fafc0025268e7f5c4d6a66bbb80b36ae260da73e380d5f3a3aef42389131fa0d7feba
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.5
|
3
3
|
|
4
4
|
Style/StringLiterals:
|
5
5
|
Enabled: true
|
@@ -11,3 +11,12 @@ Style/StringLiteralsInInterpolation:
|
|
11
11
|
|
12
12
|
Layout/LineLength:
|
13
13
|
Max: 120
|
14
|
+
|
15
|
+
Lint/MissingSuper:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Lint/UnusedMethodArgument:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,43 +1,83 @@
|
|
1
|
-
# Appetize
|
1
|
+
# Appetize CLI
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
The Appetize CLI provides a command line interface to the [Appetize API](https://docs.appetize.io/api/overview).
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
Install this gem by executing:
|
8
|
+
|
9
|
+
$ gem install appetize-cli
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Currently there are two supported actions `upload` and `delete` - `help` and `version` commands are also supplied.
|
10
14
|
|
11
|
-
```
|
12
|
-
|
15
|
+
```
|
16
|
+
Commands:
|
17
|
+
appetize delete PUBLIC_KEY # Delete an app deploymment from Appetize
|
18
|
+
appetize help [COMMAND] # Describe available commands or one specific command
|
19
|
+
appetize upload PATH PLATFORM # Upload an APK/ZIP to Appetize
|
20
|
+
appetize version # appetize version
|
13
21
|
```
|
14
22
|
|
15
|
-
|
23
|
+
### Setup
|
16
24
|
|
17
|
-
|
25
|
+
All actions in this tool require an Appetize API token, which can be generated in your Appetize account. Once a token has been generated you must set it as the environment variable `APPETIZE_API_TOKEN`.
|
18
26
|
|
19
|
-
|
27
|
+
Example:
|
20
28
|
|
21
|
-
|
29
|
+
$ export APPETIZE_API_TOKEN=yourtoken
|
22
30
|
|
23
|
-
## Usage
|
24
31
|
|
25
|
-
|
32
|
+
### Upload
|
33
|
+
|
34
|
+
Upload an APK/ZIP to Appetize
|
35
|
+
|
36
|
+
```
|
37
|
+
Usage:
|
38
|
+
appetize upload PATH PLATFORM
|
39
|
+
```
|
40
|
+
|
41
|
+
`PATH` the path to the Apk or Zip file of the app you would like to deploy
|
42
|
+
|
43
|
+
`PLATFORM` either `ios` or `android`
|
44
|
+
|
45
|
+
Example:
|
46
|
+
|
47
|
+
$ appetize upload builds/app-debug.apk android
|
48
|
+
$ appetize upload builds/app.zip ios
|
49
|
+
|
50
|
+
|
51
|
+
### Delete
|
52
|
+
|
53
|
+
Delete an app deploymment from Appetize
|
54
|
+
|
55
|
+
```
|
56
|
+
Usage:
|
57
|
+
appetize delete PUBLIC_KEY
|
58
|
+
```
|
59
|
+
|
60
|
+
`PUBLIC_KEY` the public key provided by Appetize for the specific app deployment you'd like to delete
|
61
|
+
|
62
|
+
Example:
|
63
|
+
|
64
|
+
$ appetize delete somepublickey
|
65
|
+
|
26
66
|
|
27
67
|
## Development
|
28
68
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
70
|
|
31
71
|
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`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
72
|
|
33
73
|
## Contributing
|
34
74
|
|
35
|
-
Bug reports and
|
75
|
+
Bug reports and merge requests are welcome on GitLab at https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli/-/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli/-/blob/master/CODE_OF_CONDUCT.md).
|
36
76
|
|
37
77
|
## Code of Conduct
|
38
78
|
|
39
|
-
Everyone interacting in the Appetize project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
79
|
+
Everyone interacting in the Appetize CLI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli/-/blob/master/CODE_OF_CONDUCT.md).
|
40
80
|
|
41
81
|
## Copyright
|
42
82
|
|
43
|
-
Copyright (c) 2021
|
83
|
+
Copyright (c) 2021 GitLab, Inc. See [MIT License](LICENSE.txt) for further details.
|
data/appetize.gemspec
CHANGED
@@ -11,12 +11,12 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = "A Command Line Interface to the Appetize.io API"
|
13
13
|
spec.description = "A Command Line Interface to the Appetize.io API"
|
14
|
-
spec.homepage = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
14
|
+
spec.homepage = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli"
|
15
|
+
spec.required_ruby_version = ">= 2.5.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize"
|
19
|
-
spec.metadata["changelog_uri"] = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize/CHANGELOG.md"
|
18
|
+
spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli"
|
19
|
+
spec.metadata["changelog_uri"] = "https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli/CHANGELOG.md"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/exe/appetize
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
lib_path = File.expand_path(
|
5
|
-
|
6
|
-
require
|
4
|
+
lib_path = File.expand_path("../lib", __dir__)
|
5
|
+
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
|
6
|
+
require "appetize/cli"
|
7
7
|
|
8
|
-
Signal.trap(
|
8
|
+
Signal.trap("INT") do
|
9
9
|
warn("\n#{caller.join("\n")}: interrupted")
|
10
10
|
exit(1)
|
11
11
|
end
|
12
12
|
|
13
13
|
begin
|
14
14
|
Appetize::CLI.start
|
15
|
-
rescue Appetize::CLI::Error =>
|
16
|
-
puts "ERROR: #{
|
15
|
+
rescue Appetize::CLI::Error => e
|
16
|
+
puts "ERROR: #{e.message}"
|
17
17
|
exit 1
|
18
18
|
end
|
data/lib/appetize/cli.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require 'httparty'
|
3
|
+
require "thor"
|
5
4
|
|
6
5
|
module Appetize
|
7
6
|
# Handle the application command line parsing
|
@@ -12,33 +11,33 @@ module Appetize
|
|
12
11
|
# Error raised by this runner
|
13
12
|
Error = Class.new(StandardError)
|
14
13
|
|
15
|
-
desc
|
14
|
+
desc "version", "appetize version"
|
16
15
|
def version
|
17
|
-
require_relative
|
16
|
+
require_relative "version"
|
18
17
|
puts "v#{Appetize::VERSION}"
|
19
18
|
end
|
20
|
-
map %w
|
19
|
+
map %w[--version -v] => :version
|
21
20
|
|
22
|
-
desc
|
23
|
-
method_option :help, aliases:
|
24
|
-
desc:
|
21
|
+
desc "upload PATH PLATFORM", "Upload an APK/ZIP to Appetize"
|
22
|
+
method_option :help, aliases: "-h", type: :boolean,
|
23
|
+
desc: "Display usage information"
|
25
24
|
def upload(path, platform, token = nil, api_host = nil)
|
26
25
|
if options[:help]
|
27
|
-
invoke :help, [
|
26
|
+
invoke :help, ["upload"]
|
28
27
|
else
|
29
|
-
require_relative
|
28
|
+
require_relative "commands/upload"
|
30
29
|
Appetize::Commands::Upload.new(path, platform, token, api_host, options).execute
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
desc
|
35
|
-
method_option :help, aliases:
|
36
|
-
desc:
|
33
|
+
desc "delete PUBLIC_KEY", "Delete an app deploymment from Appetize"
|
34
|
+
method_option :help, aliases: "-h", type: :boolean,
|
35
|
+
desc: "Display usage information"
|
37
36
|
def delete(public_key, token = nil, api_host = nil)
|
38
37
|
if options[:help]
|
39
|
-
invoke :help, [
|
38
|
+
invoke :help, ["delete"]
|
40
39
|
else
|
41
|
-
require_relative
|
40
|
+
require_relative "commands/delete"
|
42
41
|
Appetize::Commands::Delete.new(public_key, token, api_host, options).execute
|
43
42
|
end
|
44
43
|
end
|
data/lib/appetize/command.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "forwardable"
|
4
4
|
|
5
5
|
module Appetize
|
6
6
|
class Command
|
@@ -24,7 +24,7 @@ module Appetize
|
|
24
24
|
#
|
25
25
|
# @api public
|
26
26
|
def command(**options)
|
27
|
-
require
|
27
|
+
require "tty-command"
|
28
28
|
TTY::Command.new(options)
|
29
29
|
end
|
30
30
|
|
@@ -34,7 +34,7 @@ module Appetize
|
|
34
34
|
#
|
35
35
|
# @api public
|
36
36
|
def cursor
|
37
|
-
require
|
37
|
+
require "tty-cursor"
|
38
38
|
TTY::Cursor
|
39
39
|
end
|
40
40
|
|
@@ -44,7 +44,7 @@ module Appetize
|
|
44
44
|
#
|
45
45
|
# @api public
|
46
46
|
def editor
|
47
|
-
require
|
47
|
+
require "tty-editor"
|
48
48
|
TTY::Editor
|
49
49
|
end
|
50
50
|
|
@@ -54,7 +54,7 @@ module Appetize
|
|
54
54
|
#
|
55
55
|
# @api public
|
56
56
|
def generator
|
57
|
-
require
|
57
|
+
require "tty-file"
|
58
58
|
TTY::File
|
59
59
|
end
|
60
60
|
|
@@ -64,7 +64,7 @@ module Appetize
|
|
64
64
|
#
|
65
65
|
# @api public
|
66
66
|
def pager(**options)
|
67
|
-
require
|
67
|
+
require "tty-pager"
|
68
68
|
TTY::Pager.new(options)
|
69
69
|
end
|
70
70
|
|
@@ -74,7 +74,7 @@ module Appetize
|
|
74
74
|
#
|
75
75
|
# @api public
|
76
76
|
def platform
|
77
|
-
require
|
77
|
+
require "tty-platform"
|
78
78
|
TTY::Platform.new
|
79
79
|
end
|
80
80
|
|
@@ -84,7 +84,7 @@ module Appetize
|
|
84
84
|
#
|
85
85
|
# @api public
|
86
86
|
def prompt(**options)
|
87
|
-
require
|
87
|
+
require "tty-prompt"
|
88
88
|
TTY::Prompt.new(options)
|
89
89
|
end
|
90
90
|
|
@@ -94,7 +94,7 @@ module Appetize
|
|
94
94
|
#
|
95
95
|
# @api public
|
96
96
|
def screen
|
97
|
-
require
|
97
|
+
require "tty-screen"
|
98
98
|
TTY::Screen
|
99
99
|
end
|
100
100
|
|
@@ -104,7 +104,7 @@ module Appetize
|
|
104
104
|
#
|
105
105
|
# @api public
|
106
106
|
def which(*args)
|
107
|
-
require
|
107
|
+
require "tty-which"
|
108
108
|
TTY::Which.which(*args)
|
109
109
|
end
|
110
110
|
|
@@ -114,7 +114,7 @@ module Appetize
|
|
114
114
|
#
|
115
115
|
# @api public
|
116
116
|
def exec_exist?(*args)
|
117
|
-
require
|
117
|
+
require "tty-which"
|
118
118
|
TTY::Which.exist?(*args)
|
119
119
|
end
|
120
120
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "httparty"
|
4
|
+
require_relative "../command"
|
4
5
|
|
5
6
|
module Appetize
|
6
7
|
module Commands
|
7
8
|
class Delete < Appetize::Command
|
8
|
-
def initialize(public_key, token, api_host, options)
|
9
|
+
def initialize(public_key, token = nil, api_host = nil, options = {})
|
9
10
|
@public_key = public_key
|
10
11
|
@token = token
|
11
12
|
@api_host = api_host
|
@@ -13,23 +14,17 @@ module Appetize
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def execute(input: $stdin, output: $stdout)
|
16
|
-
token
|
17
|
-
api_host
|
17
|
+
token = @token || ENV["APPETIZE_API_TOKEN"]
|
18
|
+
api_host = @api_host || "api.appetize.io"
|
18
19
|
|
19
20
|
url = "https://#{api_host}/v1/apps/#{@public_key}"
|
20
|
-
auth = {
|
21
|
-
username: token,
|
22
|
-
password: ''
|
23
|
-
}
|
21
|
+
auth = { username: token, password: "" }
|
24
22
|
|
25
23
|
response = HTTParty.delete(url, basic_auth: auth)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
message = "Delete failed: #{response.code}"
|
31
|
-
raise message
|
32
|
-
end
|
24
|
+
|
25
|
+
raise "Delete failed: #{response.code}" unless response.code == 200
|
26
|
+
|
27
|
+
output.puts response.message
|
33
28
|
end
|
34
29
|
end
|
35
30
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "httparty"
|
4
|
+
require_relative "../command"
|
4
5
|
|
5
6
|
module Appetize
|
6
7
|
module Commands
|
@@ -14,27 +15,18 @@ module Appetize
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def execute(input: $stdin, output: $stdout)
|
17
|
-
token
|
18
|
-
api_host
|
18
|
+
token = @token || ENV["APPETIZE_API_TOKEN"]
|
19
|
+
api_host = @api_host || "api.appetize.io"
|
19
20
|
|
20
21
|
url = "https://#{api_host}/v1/apps"
|
21
|
-
auth = {
|
22
|
-
|
23
|
-
password: ''
|
24
|
-
}
|
25
|
-
body = {
|
26
|
-
platform: @platform,
|
27
|
-
file: File.open(@path)
|
28
|
-
}
|
22
|
+
auth = { username: token, password: "" }
|
23
|
+
body = { platform: @platform, file: File.open(@path) }
|
29
24
|
|
30
25
|
response = HTTParty.post(url, body: body, basic_auth: auth)
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
message = "Upload failed: #{response.code}"
|
36
|
-
raise message
|
37
|
-
end
|
27
|
+
raise "Upload failed: #{response.code}" unless response.code == 200
|
28
|
+
|
29
|
+
output.puts response.message
|
38
30
|
end
|
39
31
|
end
|
40
32
|
end
|
data/lib/appetize/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appetize-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darby Frey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -68,13 +68,13 @@ files:
|
|
68
68
|
- lib/appetize/templates/delete/.gitkeep
|
69
69
|
- lib/appetize/templates/upload/.gitkeep
|
70
70
|
- lib/appetize/version.rb
|
71
|
-
homepage: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize
|
71
|
+
homepage: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli
|
72
72
|
licenses:
|
73
73
|
- MIT
|
74
74
|
metadata:
|
75
|
-
homepage_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize
|
76
|
-
source_code_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize
|
77
|
-
changelog_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize/CHANGELOG.md
|
75
|
+
homepage_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli
|
76
|
+
source_code_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli
|
77
|
+
changelog_uri: https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/appetize-cli/CHANGELOG.md
|
78
78
|
post_install_message:
|
79
79
|
rdoc_options: []
|
80
80
|
require_paths:
|
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
83
|
requirements:
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 2.
|
86
|
+
version: 2.5.0
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - ">="
|