sem 0.3.5 → 0.4.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 +4 -4
- data/README.md +23 -15
- data/lib/sem/api/base.rb +19 -6
- data/lib/sem/configuration.rb +1 -7
- data/lib/sem/version.rb +1 -1
- data/lib/sem.rb +3 -6
- data/sem.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d6cad3568c4070fd455a3b3a847eb9cdbfa4b01
|
4
|
+
data.tar.gz: 19741e275c1a27637594542589cc61e535bb7445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae5e86225473f3cb5c53c99377d36a7caf7b64b1656fc58821f3684c2966d4e37ddb223bd54baa2c70ebf10dbce0e60165532686adf4b6219b9e38f95ecf0c8
|
7
|
+
data.tar.gz: a1c05d01cbe0da43c1af69b6de53cbebb0a2916d1e112e3d73b6f7ecf0220c782c1284b12cf44f8018668a73aa85c13ee1e4a35cb79abc293b2461f7916dc11e
|
data/README.md
CHANGED
@@ -5,27 +5,19 @@
|
|
5
5
|
|
6
6
|

|
7
7
|
|
8
|
-
__Note:
|
8
|
+
__Note: The Semaphore CLI gem is still an alpha release.__
|
9
9
|
|
10
10
|
The Semaphore CLI is used to manage Semaphore projects from the command line.
|
11
11
|
|
12
|
-
For more info about Semaphore see <https://
|
12
|
+
For more info about Semaphore see <https://semaphoreci.com>
|
13
13
|
|
14
|
-
##
|
14
|
+
## Usage
|
15
15
|
|
16
|
-
|
17
|
-
for all actions.
|
16
|
+
Install the gem with:
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- Team: `organization_name/team_name`
|
23
|
-
- Project: `organization_name/project_name`
|
24
|
-
- Shared Configuration: `organization_name/shared_configuration_name`
|
25
|
-
|
26
|
-
## Using custom API URL
|
27
|
-
|
28
|
-
Create a file at `~/.sem/api_url` containing only the custom url.
|
18
|
+
``` ruby
|
19
|
+
gem install sem
|
20
|
+
```
|
29
21
|
|
30
22
|
## Issues
|
31
23
|
|
@@ -42,3 +34,19 @@ Developing the CLI locally requires Ruby.
|
|
42
34
|
While developing please follow the [CLI development guide](guides.md).
|
43
35
|
|
44
36
|
To run the CLI locally, use the `bundle exec sem`.
|
37
|
+
|
38
|
+
#### Semaphore Resource Name (SRN)
|
39
|
+
|
40
|
+
SRN is a way of identifying Semaphore resources. This CLI uses SRNs as arguments
|
41
|
+
for all actions.
|
42
|
+
|
43
|
+
Formats for individual resources are the following:
|
44
|
+
|
45
|
+
- Organization: `organization_name`
|
46
|
+
- Team: `organization_name/team_name`
|
47
|
+
- Project: `organization_name/project_name`
|
48
|
+
- Shared Configuration: `organization_name/shared_configuration_name`
|
49
|
+
|
50
|
+
#### Using custom API URL
|
51
|
+
|
52
|
+
Create a file at `~/.sem/api_url` containing only the custom url.
|
data/lib/sem/api/base.rb
CHANGED
@@ -2,12 +2,25 @@ module Sem::API::Base
|
|
2
2
|
module_function
|
3
3
|
|
4
4
|
def client
|
5
|
-
@client ||=
|
6
|
-
Sem::Configuration.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
@client ||= create_new_api_client(
|
6
|
+
Sem::Configuration.api_url,
|
7
|
+
Sem::Configuration.auth_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_new_api_client(api_url, auth_token)
|
11
|
+
SemaphoreClient.new(auth_token, :api_url => api_url,
|
12
|
+
:logger => api_logger,
|
13
|
+
:auto_paginate => true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def api_logger
|
17
|
+
return nil unless Sem.trace?
|
18
|
+
return @api_logger if defined?(@api_logger)
|
19
|
+
|
20
|
+
@api_logger = Logger.new(STDOUT)
|
21
|
+
@api_logger.level = Logger::DEBUG
|
22
|
+
|
23
|
+
@api_logger
|
11
24
|
end
|
12
25
|
|
13
26
|
end
|
data/lib/sem/configuration.rb
CHANGED
@@ -7,13 +7,7 @@ module Sem
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def valid_auth_token?(auth_token)
|
10
|
-
|
11
|
-
auth_token,
|
12
|
-
:api_url => api_url,
|
13
|
-
:verbose => (Sem.log_level == Sem::LOG_LEVEL_TRACE)
|
14
|
-
)
|
15
|
-
|
16
|
-
client.orgs.list!
|
10
|
+
Sem::API::Base.create_new_api_client(api_url, auth_token).orgs.list!
|
17
11
|
|
18
12
|
true
|
19
13
|
rescue SemaphoreClient::Exceptions::Base
|
data/lib/sem/version.rb
CHANGED
data/lib/sem.rb
CHANGED
@@ -13,20 +13,17 @@ module Sem
|
|
13
13
|
require "sem/api"
|
14
14
|
require "sem/views"
|
15
15
|
|
16
|
-
LOG_LEVEL_TRACE = :trace
|
17
|
-
LOG_LEVEL_ERROR = :error
|
18
|
-
|
19
16
|
class << self
|
20
17
|
attr_writer :log_level
|
21
18
|
|
22
|
-
def
|
23
|
-
@
|
19
|
+
def trace?
|
20
|
+
@trace_mode == true
|
24
21
|
end
|
25
22
|
|
26
23
|
# Returns exit status as a number.
|
27
24
|
def start(args)
|
28
25
|
if args.include?("--trace")
|
29
|
-
@
|
26
|
+
@trace_mode = true
|
30
27
|
|
31
28
|
args.delete("--trace")
|
32
29
|
end
|
data/sem.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency "semaphore_client", "2.
|
24
|
+
spec.add_dependency "semaphore_client", "2.7.0"
|
25
25
|
spec.add_dependency "dracula", "~> 0.4.0"
|
26
26
|
spec.add_dependency "pmap", "~> 1.1.1"
|
27
27
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dracula
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|