uffizzi-cli 0.1.2 → 0.1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/Gemfile.lock +14 -1
- data/README.md +31 -0
- data/Rakefile +5 -0
- data/lib/uffizzi/auth_helper.rb +1 -5
- data/lib/uffizzi/cli/common.rb +15 -0
- data/lib/uffizzi/cli/login.rb +6 -9
- data/lib/uffizzi/cli/logout.rb +21 -0
- data/lib/uffizzi/cli/projects.rb +1 -1
- data/lib/uffizzi/cli.rb +14 -2
- data/lib/uffizzi/clients/api/api_client.rb +7 -0
- data/lib/uffizzi/response_helper.rb +27 -0
- data/lib/uffizzi/shell.rb +21 -0
- data/lib/uffizzi/version.rb +1 -1
- data/lib/uffizzi.rb +6 -0
- data/man/uffizzi-logout +21 -0
- data/man/uffizzi-logout.ronn +19 -0
- data/uffizzi.gemspec +2 -0
- metadata +36 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ba7aad922d83a3168cba4c93f476c334359ca83663f6fd9e10a9bbface0ae9
|
4
|
+
data.tar.gz: e32af9850d0dca8b4ba93675cd5f19d4c4fcdf8b86df5e4231125aa56ef63341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 013051664b8bdf93ed677b3ceff71053f283800dc4493f98c1326de0a85db99ba2e58217d8c6a16ec3502c7cf4898a3612208f2343ec177d7f44eae32ddb8d63
|
7
|
+
data.tar.gz: a1054b99e188dbbb6e13c5d19dec8134996386a42730dd5f2d9af857fc1b05b02cca00543e0c9158942a61d1b5e51a1d483f60c16ff74a4adca3f924d6819ed9
|
data/Dockerfile
CHANGED
@@ -2,7 +2,7 @@ FROM ruby:3.0.2-alpine3.14
|
|
2
2
|
|
3
3
|
RUN apk update && apk upgrade
|
4
4
|
RUN apk add bash
|
5
|
-
RUN apk add curl-dev ruby-dev build-base git curl ruby-json openssl
|
5
|
+
RUN apk add curl-dev ruby-dev build-base git curl ruby-json openssl groff mandoc man-pages
|
6
6
|
|
7
7
|
RUN mkdir -p /gem
|
8
8
|
WORKDIR /gem
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uffizzi-cli (0.1.
|
4
|
+
uffizzi-cli (0.1.4.3)
|
5
5
|
thor
|
6
6
|
|
7
7
|
GEM
|
@@ -26,12 +26,18 @@ GEM
|
|
26
26
|
hashdiff (1.0.1)
|
27
27
|
i18n (1.8.11)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
+
kramdown (2.3.1)
|
30
|
+
rexml
|
29
31
|
method_source (1.0.0)
|
30
32
|
minitest (5.14.4)
|
31
33
|
minitest-power_assert (0.3.1)
|
32
34
|
minitest
|
33
35
|
power_assert (>= 1.1)
|
34
36
|
mocha (1.13.0)
|
37
|
+
mustache (0.99.8)
|
38
|
+
nokogiri (1.13.1-x86_64-linux)
|
39
|
+
racc (~> 1.4)
|
40
|
+
open3 (0.1.1)
|
35
41
|
parallel (1.21.0)
|
36
42
|
parser (3.0.2.0)
|
37
43
|
ast (~> 2.4.1)
|
@@ -46,10 +52,15 @@ GEM
|
|
46
52
|
pry (> 0.10.0)
|
47
53
|
unicode (~> 0.4.4)
|
48
54
|
public_suffix (4.0.6)
|
55
|
+
racc (1.6.0)
|
49
56
|
rainbow (3.0.0)
|
50
57
|
rake (13.0.6)
|
51
58
|
regexp_parser (2.1.1)
|
52
59
|
rexml (3.2.5)
|
60
|
+
ronn-ng (0.9.1)
|
61
|
+
kramdown (~> 2.1)
|
62
|
+
mustache (~> 0.7, >= 0.7.0)
|
63
|
+
nokogiri (~> 1.9, >= 1.9.0)
|
53
64
|
rubocop (1.22.3)
|
54
65
|
parallel (~> 1.10)
|
55
66
|
parser (>= 3.0.0.0)
|
@@ -87,9 +98,11 @@ DEPENDENCIES
|
|
87
98
|
minitest
|
88
99
|
minitest-power_assert
|
89
100
|
mocha
|
101
|
+
open3
|
90
102
|
pry-byebug
|
91
103
|
pry-inline
|
92
104
|
rake
|
105
|
+
ronn-ng
|
93
106
|
rubocop
|
94
107
|
rubocop-minitest
|
95
108
|
rubocop-rake
|
data/README.md
CHANGED
@@ -108,6 +108,37 @@ $ uffizzi config delete OPTION
|
|
108
108
|
|
109
109
|
Deletes specified option.
|
110
110
|
|
111
|
+
## Git workflow for the app:
|
112
|
+
|
113
|
+
1. Clone the repository and checkout to `develop` branch
|
114
|
+
|
115
|
+
2. Pull repository to ensure you have the latest changes
|
116
|
+
```
|
117
|
+
git pull --rebase develop
|
118
|
+
```
|
119
|
+
|
120
|
+
3. Start new branch from `develop`
|
121
|
+
```
|
122
|
+
git checkout -b feature/short_issue_description (e.g. feature/add_domain_settings)
|
123
|
+
```
|
124
|
+
|
125
|
+
4. Make changes you need for the feature, commit them to the repo
|
126
|
+
```
|
127
|
+
git add .
|
128
|
+
git commit -m 'short commit description' (e.g. git commit -m 'added domain settings')
|
129
|
+
git push origin FEATURE_NAME
|
130
|
+
```
|
131
|
+
|
132
|
+
4. You already can create PR with develop branch as a target. Once the feature is ready let us know in the channel - we will review
|
133
|
+
|
134
|
+
5. Merge your feature to `qa` branch and push. Ensure your pipeline is successful
|
135
|
+
```
|
136
|
+
git checkout qa
|
137
|
+
git pull --rebase qa
|
138
|
+
git merge --no-ff FEATURE_NAME
|
139
|
+
git push origin qa
|
140
|
+
```
|
141
|
+
|
111
142
|
## Contributing
|
112
143
|
|
113
144
|
Bug reports and pull requests are welcome on GitHub at https://github.com/UffizziCloud/uffizzi_cli.
|
data/Rakefile
CHANGED
data/lib/uffizzi/auth_helper.rb
CHANGED
@@ -4,14 +4,10 @@ module Uffizzi
|
|
4
4
|
module AuthHelper
|
5
5
|
class << self
|
6
6
|
def signed_in?
|
7
|
-
|
7
|
+
ConfigFile.exists? &&
|
8
8
|
ConfigFile.option_exists?(:account_id) &&
|
9
9
|
ConfigFile.option_exists?(:cookie) &&
|
10
10
|
ConfigFile.option_exists?(:hostname)
|
11
|
-
|
12
|
-
puts 'You are not logged in.' unless logged_in
|
13
|
-
|
14
|
-
logged_in
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
data/lib/uffizzi/cli/login.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'io/console'
|
4
4
|
require 'uffizzi'
|
5
|
+
require 'uffizzi/response_helper'
|
5
6
|
|
6
7
|
module Uffizzi
|
7
8
|
class CLI::Login
|
@@ -13,12 +14,10 @@ module Uffizzi
|
|
13
14
|
|
14
15
|
def run
|
15
16
|
password = IO::console.getpass('Enter Password: ')
|
16
|
-
|
17
17
|
params = prepare_request_params(password)
|
18
|
-
|
19
18
|
response = create_session(@options[:hostname], params)
|
20
19
|
|
21
|
-
if response
|
20
|
+
if Uffizzi::ResponseHelper.created?(response)
|
22
21
|
handle_succeed_response(response)
|
23
22
|
else
|
24
23
|
handle_failed_response(response)
|
@@ -41,12 +40,10 @@ module Uffizzi
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def handle_succeed_response(response)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
account_id = response[:body][:user][:accounts].first[:id]
|
49
|
-
ConfigFile.create(account_id, response[:headers], @options[:hostname])
|
43
|
+
account = response[:body][:user][:accounts].first
|
44
|
+
return Uffizzi.ui.say('No account related to this email') unless account_valid?(account)
|
45
|
+
|
46
|
+
ConfigFile.create(account[:id], response[:headers], @options[:hostname])
|
50
47
|
end
|
51
48
|
|
52
49
|
def account_valid?(account)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'io/console'
|
4
|
+
require 'uffizzi'
|
5
|
+
require 'uffizzi/auth_helper'
|
6
|
+
|
7
|
+
module Uffizzi
|
8
|
+
class CLI::Logout
|
9
|
+
include ApiClient
|
10
|
+
|
11
|
+
def run
|
12
|
+
return Uffizzi.ui.say('You are not logged in') unless Uffizzi::AuthHelper.signed_in?
|
13
|
+
|
14
|
+
hostname = ConfigFile.read_option(:hostname)
|
15
|
+
destroy_session(hostname)
|
16
|
+
|
17
|
+
ConfigFile.delete
|
18
|
+
Uffizzi.ui.say('You have been successfully logged out')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/uffizzi/cli/projects.rb
CHANGED
data/lib/uffizzi/cli.rb
CHANGED
@@ -4,13 +4,17 @@ require 'thor'
|
|
4
4
|
|
5
5
|
module Uffizzi
|
6
6
|
class CLI < Thor
|
7
|
-
|
7
|
+
require_relative 'cli/common'
|
8
|
+
|
9
|
+
class_option :help, type: :boolean, aliases: HELP_MAPPINGS
|
10
|
+
|
11
|
+
desc 'version', 'Show Version'
|
8
12
|
def version
|
9
13
|
require_relative 'version'
|
10
14
|
puts Uffizzi::VERSION
|
11
15
|
end
|
12
16
|
|
13
|
-
desc 'login', '
|
17
|
+
desc 'login', 'Login into Uffizzi'
|
14
18
|
method_option :user, required: true, aliases: '-u'
|
15
19
|
method_option :hostname, required: true, aliases: '-h'
|
16
20
|
def login
|
@@ -18,6 +22,14 @@ module Uffizzi
|
|
18
22
|
Login.new(options).run
|
19
23
|
end
|
20
24
|
|
25
|
+
desc 'logout', 'Logout from Uffizzi'
|
26
|
+
def logout(help = nil)
|
27
|
+
return Cli::Common.show_manual(:logout) if help || options[:help]
|
28
|
+
|
29
|
+
require_relative 'cli/logout'
|
30
|
+
Logout.new.run
|
31
|
+
end
|
32
|
+
|
21
33
|
desc 'projects', 'projects'
|
22
34
|
def projects
|
23
35
|
require_relative 'cli/projects'
|
@@ -12,6 +12,13 @@ module ApiClient
|
|
12
12
|
build_response(response)
|
13
13
|
end
|
14
14
|
|
15
|
+
def destroy_session(hostname)
|
16
|
+
uri = session_uri(hostname)
|
17
|
+
response = Uffizzi::HttpClient.make_request(uri, :delete, true)
|
18
|
+
|
19
|
+
build_response(response)
|
20
|
+
end
|
21
|
+
|
15
22
|
def fetch_projects(hostname)
|
16
23
|
uri = projects_uri(hostname)
|
17
24
|
response = Uffizzi::HttpClient.make_request(uri, :get, true)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Uffizzi
|
4
|
+
module ResponseHelper
|
5
|
+
class << self
|
6
|
+
def created?(response)
|
7
|
+
response[:code] == Net::HTTPCreated
|
8
|
+
end
|
9
|
+
|
10
|
+
def unprocessable_entity?(response)
|
11
|
+
response[:code] == Net::HTTPUnprocessableEntity
|
12
|
+
end
|
13
|
+
|
14
|
+
def not_found?(response)
|
15
|
+
response[:code] == Net::HTTPNotFound
|
16
|
+
end
|
17
|
+
|
18
|
+
def forbidden?(response)
|
19
|
+
response[:code] == Net::HTTPForbidden
|
20
|
+
end
|
21
|
+
|
22
|
+
def no_content?(response)
|
23
|
+
response[:code] == Net::HTTPNoContent
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module Uffizzi
|
6
|
+
module UI
|
7
|
+
class Shell
|
8
|
+
def initialize
|
9
|
+
@shell = Thor::Shell::Basic.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def say(msg)
|
13
|
+
@shell.say(msg)
|
14
|
+
end
|
15
|
+
|
16
|
+
def last_message
|
17
|
+
@shell.send(:stdout).string.strip
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/uffizzi/version.rb
CHANGED
data/lib/uffizzi.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'uffizzi/shell'
|
3
4
|
require_relative 'uffizzi/version'
|
4
5
|
require_relative 'uffizzi/clients/api/api_client'
|
5
6
|
require_relative 'uffizzi/clients/api/api_routes'
|
@@ -7,4 +8,9 @@ require_relative 'uffizzi/config_file'
|
|
7
8
|
|
8
9
|
module Uffizzi
|
9
10
|
class Error < StandardError; end
|
11
|
+
class << self
|
12
|
+
def ui
|
13
|
+
@ui ||= Uffizzi::UI::Shell.new
|
14
|
+
end
|
15
|
+
end
|
10
16
|
end
|
data/man/uffizzi-logout
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
.\" generated with Ronn-NG/v0.9.1
|
2
|
+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
+
.TH "UFFIZZI\-LOGOUT" "" "February 2022" ""
|
4
|
+
.SH "NAME"
|
5
|
+
\fBuffizzi\-logout\fR \- log out of a Uffizzi user account
|
6
|
+
.SH "SYNOPSIS"
|
7
|
+
\fBuffizzi logout\fR
|
8
|
+
.SH "DESCRIPTION"
|
9
|
+
.nf
|
10
|
+
The uffizzi logout command logs out of a Uffizzi user account\.
|
11
|
+
|
12
|
+
For more information on logout, see:
|
13
|
+
https://docs\.uffizzi\.com/references/cli
|
14
|
+
.fi
|
15
|
+
.SH "UFFIZZI WIDE FLAGS"
|
16
|
+
.nf
|
17
|
+
These flags are available to all commands: \-\-project\. Run $ uffizzi
|
18
|
+
help for details\.
|
19
|
+
.fi
|
20
|
+
.SH "EXAMPLES"
|
21
|
+
uffizzi logout
|
@@ -0,0 +1,19 @@
|
|
1
|
+
uffizzi-logout - log out of a Uffizzi user account
|
2
|
+
================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`uffizzi logout`
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
The uffizzi logout command logs out of a Uffizzi user account.
|
10
|
+
|
11
|
+
For more information on logout, see:
|
12
|
+
https://docs.uffizzi.com/references/cli
|
13
|
+
|
14
|
+
## UFFIZZI WIDE FLAGS
|
15
|
+
These flags are available to all commands: --project. Run $ uffizzi
|
16
|
+
help for details.
|
17
|
+
|
18
|
+
## EXAMPLES
|
19
|
+
uffizzi logout
|
data/uffizzi.gemspec
CHANGED
@@ -33,9 +33,11 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'minitest'
|
34
34
|
spec.add_development_dependency 'minitest-power_assert'
|
35
35
|
spec.add_development_dependency 'mocha'
|
36
|
+
spec.add_development_dependency 'open3'
|
36
37
|
spec.add_development_dependency 'pry-byebug'
|
37
38
|
spec.add_development_dependency 'pry-inline'
|
38
39
|
spec.add_development_dependency 'rake'
|
40
|
+
spec.add_development_dependency 'ronn-ng'
|
39
41
|
spec.add_development_dependency 'rubocop'
|
40
42
|
spec.add_development_dependency 'rubocop-minitest'
|
41
43
|
spec.add_development_dependency 'rubocop-rake'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: open3
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
- !ruby/object:Gem::Dependency
|
99
113
|
name: pry-byebug
|
100
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +151,20 @@ dependencies:
|
|
137
151
|
- - ">="
|
138
152
|
- !ruby/object:Gem::Version
|
139
153
|
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: ronn-ng
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
140
168
|
- !ruby/object:Gem::Dependency
|
141
169
|
name: rubocop
|
142
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,14 +260,20 @@ files:
|
|
232
260
|
- lib/uffizzi.rb
|
233
261
|
- lib/uffizzi/auth_helper.rb
|
234
262
|
- lib/uffizzi/cli.rb
|
263
|
+
- lib/uffizzi/cli/common.rb
|
235
264
|
- lib/uffizzi/cli/config.rb
|
236
265
|
- lib/uffizzi/cli/login.rb
|
266
|
+
- lib/uffizzi/cli/logout.rb
|
237
267
|
- lib/uffizzi/cli/projects.rb
|
238
268
|
- lib/uffizzi/clients/api/api_client.rb
|
239
269
|
- lib/uffizzi/clients/api/api_routes.rb
|
240
270
|
- lib/uffizzi/clients/api/http_client.rb
|
241
271
|
- lib/uffizzi/config_file.rb
|
272
|
+
- lib/uffizzi/response_helper.rb
|
273
|
+
- lib/uffizzi/shell.rb
|
242
274
|
- lib/uffizzi/version.rb
|
275
|
+
- man/uffizzi-logout
|
276
|
+
- man/uffizzi-logout.ronn
|
243
277
|
- uffizzi.gemspec
|
244
278
|
homepage: https://uffizzi.com
|
245
279
|
licenses:
|