sem 0.6.2 → 0.7.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 +10 -0
- data/bin/generate_json_structure +6 -0
- data/lib/sem/cli/orgs.rb +27 -1
- data/lib/sem/cli/projects.rb +78 -3
- data/lib/sem/cli/shared_configs.rb +96 -11
- data/lib/sem/cli/teams.rb +142 -6
- data/lib/sem/cli.rb +14 -3
- data/lib/sem/version.rb +1 -1
- data/lib/sem/views/files.rb +1 -1
- data/sem.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1a10ab040f112a1f24a09ea5f73861b9071b43
|
4
|
+
data.tar.gz: ada5cba1c12170b169bee90ab53c91a450d61147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51a35aa698536afebe6c0308fb9ce7fef042ac215e9e69368e08d621732fce09cf53ac3ef1d7c8a322eaaac1ba4c969e3a6e589a37c27933057622b8e70353c2
|
7
|
+
data.tar.gz: 95db9b01b1c029800a19572d192322d46f9d2d9e77d0fe93ab4e22c42c279cca5749b0e1debc2f0c5ea816b7f0216072b961f5fb0f95289314e07a220a52366d
|
data/README.md
CHANGED
@@ -60,6 +60,16 @@ the [CLI development guide](guides.md).
|
|
60
60
|
|
61
61
|
To run the CLI locally, use the `bundle exec sem`.
|
62
62
|
|
63
|
+
#### Generating Docs
|
64
|
+
|
65
|
+
First, generate a JSON structure of the CLI, by running:
|
66
|
+
|
67
|
+
``` bash
|
68
|
+
./bin/generate_json_structure
|
69
|
+
```
|
70
|
+
|
71
|
+
Use that structure to generate docs in the semaphore-docs-new repository.
|
72
|
+
|
63
73
|
#### Semaphore Resource Name (SRN)
|
64
74
|
|
65
75
|
SRN is a way of identifying Semaphore resources. This CLI uses SRNs as arguments
|
data/lib/sem/cli/orgs.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
class Sem::CLI::Orgs < Dracula
|
2
2
|
|
3
|
-
desc "list", "
|
3
|
+
desc "list", "List all organizations"
|
4
|
+
long_desc <<-DESC
|
5
|
+
Examples:
|
6
|
+
|
7
|
+
$ sem orgs:list
|
8
|
+
ID NAME
|
9
|
+
5bc7ed43-ac8a-487e-b488-c38bc757a034 renderedtext
|
10
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 z-fighters
|
11
|
+
DESC
|
4
12
|
def list
|
5
13
|
orgs = Sem::API::Org.all
|
6
14
|
|
@@ -12,6 +20,15 @@ class Sem::CLI::Orgs < Dracula
|
|
12
20
|
end
|
13
21
|
|
14
22
|
desc "info", "shows detailed information about an organization"
|
23
|
+
long_desc <<-DESC
|
24
|
+
Examples:
|
25
|
+
|
26
|
+
$ sem orgs:info renderedtext
|
27
|
+
ID 5bc7ed43-ac8a-487e-b488-c38bc757a034
|
28
|
+
Name renderedtext
|
29
|
+
Created 2017-08-01 13:14:40 +0200
|
30
|
+
Updated 2017-08-02 13:14:40 +0200
|
31
|
+
DESC
|
15
32
|
def info(org_name)
|
16
33
|
org = Sem::API::Org.find!(org_name)
|
17
34
|
|
@@ -19,6 +36,15 @@ class Sem::CLI::Orgs < Dracula
|
|
19
36
|
end
|
20
37
|
|
21
38
|
desc "members", "list members of an organization"
|
39
|
+
long_desc <<-DESC
|
40
|
+
Examples:
|
41
|
+
|
42
|
+
$ sem orgs:members renderedtext
|
43
|
+
NAME
|
44
|
+
darko
|
45
|
+
shiroyasha
|
46
|
+
bmarkons
|
47
|
+
DESC
|
22
48
|
def members(org_name)
|
23
49
|
org = Sem::API::Org.find!(org_name)
|
24
50
|
|
data/lib/sem/cli/projects.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
class Sem::CLI::Projects < Dracula
|
2
2
|
|
3
|
-
desc "list", "list projects"
|
3
|
+
desc "list", "list all your projects"
|
4
|
+
long_desc <<-DESC
|
5
|
+
Examples:
|
6
|
+
|
7
|
+
$ sem projects:list
|
8
|
+
NAME
|
9
|
+
ID NAME
|
10
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 rt/cli
|
11
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 rt/api
|
12
|
+
DESC
|
4
13
|
def list
|
5
14
|
projects = Sem::API::Project.all
|
6
15
|
|
@@ -12,6 +21,15 @@ class Sem::CLI::Projects < Dracula
|
|
12
21
|
end
|
13
22
|
|
14
23
|
desc "info", "shows detailed information about a project"
|
24
|
+
long_desc <<-DESC
|
25
|
+
Examples:
|
26
|
+
|
27
|
+
$ sem projects:info renderedtext/cli
|
28
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
29
|
+
Name renderedtext/cli
|
30
|
+
Created 2017-08-01 13:14:40 +0200
|
31
|
+
Updated 2017-08-02 13:14:40 +0200
|
32
|
+
DESC
|
15
33
|
def info(project_name)
|
16
34
|
project = Sem::API::Project.find!(project_name)
|
17
35
|
|
@@ -19,7 +37,28 @@ class Sem::CLI::Projects < Dracula
|
|
19
37
|
end
|
20
38
|
|
21
39
|
desc "create", "create a project"
|
22
|
-
option :url, :aliases => "-u", :desc => "Git url to the repository"
|
40
|
+
option :url, :aliases => "-u", :desc => "Git url to the repository", :required => true
|
41
|
+
long_desc <<-DESC
|
42
|
+
Examples:
|
43
|
+
|
44
|
+
$ sem projects:create renderedtext/cli --url git@github.com:renderedtext/cli.git
|
45
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
46
|
+
Name renderedtext/cli
|
47
|
+
Created 2017-08-01 13:14:40 +0200
|
48
|
+
Updated 2017-08-02 13:14:40 +0200
|
49
|
+
|
50
|
+
$ sem projects:create renderedtext/api --url https://github.com/renderedtext/api
|
51
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
52
|
+
Name renderedtext/api
|
53
|
+
Created 2017-08-01 13:14:40 +0200
|
54
|
+
Updated 2017-08-02 13:14:40 +0200
|
55
|
+
|
56
|
+
$ sem projects:create renderedtext/api-tests --url https://github.com/renderedtext/api
|
57
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
58
|
+
Name renderedtext/api-tests
|
59
|
+
Created 2017-08-01 13:14:40 +0200
|
60
|
+
Updated 2017-08-02 13:14:40 +0200
|
61
|
+
DESC
|
23
62
|
def create(project_name)
|
24
63
|
url = Sem::Helpers::GitUrl.new(options[:url])
|
25
64
|
|
@@ -38,7 +77,15 @@ class Sem::CLI::Projects < Dracula
|
|
38
77
|
|
39
78
|
class Files < Dracula
|
40
79
|
|
41
|
-
desc "list", "list configuration files
|
80
|
+
desc "list", "list configuration files for a project"
|
81
|
+
long_desc <<-DESC
|
82
|
+
Examples:
|
83
|
+
|
84
|
+
$ sem projects:files:list renderedtext/cli
|
85
|
+
ID PATH ENCRYPTED?
|
86
|
+
77c7ed43-ac8a-487e-b488-c38bc757a034 /etc/a true
|
87
|
+
11c7ed43-bc8a-a87e-ba88-a38ba757a034 /var/secrets.txt true
|
88
|
+
DESC
|
42
89
|
def list(project_name)
|
43
90
|
project = Sem::API::Project.find!(project_name)
|
44
91
|
|
@@ -50,6 +97,14 @@ class Sem::CLI::Projects < Dracula
|
|
50
97
|
class EnvVars < Dracula
|
51
98
|
|
52
99
|
desc "list", "list environment variables on project"
|
100
|
+
long_desc <<-DESC
|
101
|
+
Examples:
|
102
|
+
|
103
|
+
$ sem projects:env-vars:list renderedtext/cli
|
104
|
+
ID NAME ENCRYPTED? CONTENT
|
105
|
+
9997ed43-ac8a-487e-b488-c38bc757a034 SECRET false aaa
|
106
|
+
1117ed43-tc8a-387e-6488-838bc757a034 TOKEN true *encrypted*
|
107
|
+
DESC
|
53
108
|
def list(project_name)
|
54
109
|
project = Sem::API::Project.find!(project_name)
|
55
110
|
|
@@ -61,6 +116,14 @@ class Sem::CLI::Projects < Dracula
|
|
61
116
|
class SharedConfigs < Dracula
|
62
117
|
|
63
118
|
desc "list", "list shared configurations on a project"
|
119
|
+
long_desc <<-DESC
|
120
|
+
Examples:
|
121
|
+
|
122
|
+
$ sem projects:shared-configs:list renderedtext/cli
|
123
|
+
ID NAME CONFIG FILES ENV VARS
|
124
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/tokens 1 0
|
125
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/secrets 0 1
|
126
|
+
DESC
|
64
127
|
def list(project_name)
|
65
128
|
project = Sem::API::Project.find!(project_name)
|
66
129
|
shared_configs = project.shared_configs
|
@@ -73,6 +136,12 @@ class Sem::CLI::Projects < Dracula
|
|
73
136
|
end
|
74
137
|
|
75
138
|
desc "add", "attach a shared configuration to a project"
|
139
|
+
long_desc <<-DESC
|
140
|
+
Examples:
|
141
|
+
|
142
|
+
$ sem projects:shared-configs:add renderedtext/cli renderedtext/secrets
|
143
|
+
Shared Configuration renderedtext/secrets added to the project.
|
144
|
+
DESC
|
76
145
|
def add(project_name, shared_config_name)
|
77
146
|
project = Sem::API::Project.find!(project_name)
|
78
147
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
@@ -86,6 +155,12 @@ class Sem::CLI::Projects < Dracula
|
|
86
155
|
end
|
87
156
|
|
88
157
|
desc "remove", "removes a shared configuration from the project"
|
158
|
+
long_desc <<-DESC
|
159
|
+
Examples:
|
160
|
+
|
161
|
+
$ sem projects:shared-configs:remove renderedtext/cli renderedtext/secrets
|
162
|
+
Shared Configuration renderedtext/secrets removed from the project.
|
163
|
+
DESC
|
89
164
|
def remove(project_name, shared_config_name)
|
90
165
|
project = Sem::API::Project.find!(project_name)
|
91
166
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
@@ -1,6 +1,14 @@
|
|
1
1
|
class Sem::CLI::SharedConfigs < Dracula
|
2
2
|
|
3
3
|
desc "list", "list shared cofigurations"
|
4
|
+
long_desc <<-DESC
|
5
|
+
Examples:
|
6
|
+
|
7
|
+
$ sem shared-configs:list
|
8
|
+
ID NAME CONFIG FILES ENV VARS
|
9
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/tokens 1 0
|
10
|
+
1133ed43-ac8a-487e-b488-c38bc757a044 renderedtext/secrets 0 1
|
11
|
+
DESC
|
4
12
|
def list
|
5
13
|
shared_configs = Sem::API::SharedConfig.all
|
6
14
|
|
@@ -12,6 +20,17 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
12
20
|
end
|
13
21
|
|
14
22
|
desc "info", "show information about a shared configuration"
|
23
|
+
long_desc <<-DESC
|
24
|
+
Examples:
|
25
|
+
|
26
|
+
$ sem shared-configs:info renderedtext/secrets
|
27
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
28
|
+
Name renderedtext/secrets
|
29
|
+
Config Files 1
|
30
|
+
Environment Variables 0
|
31
|
+
Created 2017-08-01 13:14:40 +0200
|
32
|
+
Updated 2017-08-02 13:14:40 +0200
|
33
|
+
DESC
|
15
34
|
def info(shared_config_name)
|
16
35
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
17
36
|
|
@@ -19,6 +38,17 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
19
38
|
end
|
20
39
|
|
21
40
|
desc "create", "create a new shared configuration"
|
41
|
+
long_desc <<-DESC
|
42
|
+
Examples:
|
43
|
+
|
44
|
+
$ sem shared-configs:create renderedtext/secrets
|
45
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
46
|
+
Name renderedtext/secrets
|
47
|
+
Config Files 1
|
48
|
+
Environment Variables 0
|
49
|
+
Created 2017-08-01 13:14:40 +0200
|
50
|
+
Updated 2017-08-02 13:14:40 +0200
|
51
|
+
DESC
|
22
52
|
def create(shared_config_name)
|
23
53
|
shared_config = Sem::API::SharedConfig.create!(shared_config_name)
|
24
54
|
|
@@ -26,6 +56,17 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
26
56
|
end
|
27
57
|
|
28
58
|
desc "rename", "rename a shared configuration"
|
59
|
+
long_desc <<-DESC
|
60
|
+
Examples:
|
61
|
+
|
62
|
+
$ sem shared-configs:create renderedtext/secrets renderedtext/psst
|
63
|
+
ID 99c7ed43-ac8a-487e-b488-c38bc757a034
|
64
|
+
Name renderedtext/psst
|
65
|
+
Config Files 1
|
66
|
+
Environment Variables 0
|
67
|
+
Created 2017-08-01 13:14:40 +0200
|
68
|
+
Updated 2017-08-02 13:14:40 +0200
|
69
|
+
DESC
|
29
70
|
def rename(old_shared_config_name, new_shared_config_name)
|
30
71
|
old_org_name, _old_name = Sem::SRN.parse_shared_config(old_shared_config_name)
|
31
72
|
new_org_name, new_name = Sem::SRN.parse_shared_config(new_shared_config_name)
|
@@ -39,16 +80,30 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
39
80
|
end
|
40
81
|
|
41
82
|
desc "delete", "removes a shared configuration from your organization"
|
83
|
+
long_desc <<-DESC
|
84
|
+
Examples:
|
85
|
+
|
86
|
+
$ sem shared-configs:delete renderedtext/secrets
|
87
|
+
Deleted shared configuration renderedtext/secrets.
|
88
|
+
DESC
|
42
89
|
def delete(shared_config_name)
|
43
90
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
44
91
|
shared_config.delete!
|
45
92
|
|
46
|
-
puts "Deleted shared configuration #{shared_config_name}"
|
93
|
+
puts "Deleted shared configuration #{shared_config_name}."
|
47
94
|
end
|
48
95
|
|
49
96
|
class Files < Dracula
|
50
97
|
|
51
|
-
desc "list", "list files in
|
98
|
+
desc "list", "list files in a shared configuration"
|
99
|
+
long_desc <<-DESC
|
100
|
+
Examples:
|
101
|
+
|
102
|
+
$ sem shared-configs:files:list renderedtext/secrets
|
103
|
+
ID PATH ENCRYPTED?
|
104
|
+
77c7ed43-ac8a-487e-b488-c38bc757a034 /home/runner/a true
|
105
|
+
11c7ed43-bc8a-a87e-ba88-a38ba757a034 /home/runner/secrets.txt true
|
106
|
+
DESC
|
52
107
|
def list(shared_config_name)
|
53
108
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
54
109
|
files = shared_config.files
|
@@ -61,9 +116,14 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
61
116
|
end
|
62
117
|
|
63
118
|
desc "add", "add a file to the shared configuration"
|
64
|
-
option "path-on-semaphore", :aliases => "p", :desc => "Path of the file in builds", :required => true
|
119
|
+
option "path-on-semaphore", :aliases => "p", :desc => "Path of the file in builds relative to /home/runner directory", :required => true
|
65
120
|
option "local-path", :aliases => "l", :desc => "Location of the file on the local machine", :required => true
|
66
|
-
|
121
|
+
long_desc <<-DESC
|
122
|
+
Examples:
|
123
|
+
|
124
|
+
$ sem shared-configs:files:add renderedtext/secrets --local-path /tmp/secrets.json --path-on-semaphore secrets.json
|
125
|
+
Added /home/runner/secrets.txt to renderedtext/secrets.
|
126
|
+
DESC
|
67
127
|
def add(shared_config_name)
|
68
128
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
69
129
|
|
@@ -74,19 +134,25 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
74
134
|
path = options["path-on-semaphore"]
|
75
135
|
content = File.read(local_path)
|
76
136
|
|
77
|
-
shared_config.add_config_file(:path => path, :content => content, :encrypted =>
|
137
|
+
shared_config.add_config_file(:path => path, :content => content, :encrypted => true)
|
78
138
|
|
79
|
-
puts "Added
|
139
|
+
puts "Added /home/runner/#{path} to #{shared_config_name}."
|
80
140
|
end
|
81
141
|
|
82
142
|
desc "remove", "remove a file from the shared configuration"
|
83
|
-
option :path, :aliases => "p", :desc => "Path of the file in builds", :required => true
|
143
|
+
option :path, :aliases => "p", :desc => "Path of the file in builds relative to /home/runner directory", :required => true
|
144
|
+
long_desc <<-DESC
|
145
|
+
Examples:
|
146
|
+
|
147
|
+
$ sem shared-configs:files:remove renderedtext/secrets --path secrets.json
|
148
|
+
Removed /home/runner/secrets.txt from renderedtext/secrets.
|
149
|
+
DESC
|
84
150
|
def remove(shared_config_name)
|
85
151
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
86
152
|
|
87
153
|
shared_config.remove_config_file(options[:path])
|
88
154
|
|
89
|
-
puts "Removed
|
155
|
+
puts "Removed /home/runner/#{options[:path]} from #{shared_config_name}."
|
90
156
|
end
|
91
157
|
|
92
158
|
end
|
@@ -94,6 +160,14 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
94
160
|
class EnvVars < Dracula
|
95
161
|
|
96
162
|
desc "list", "list environment variables in the shared configuration"
|
163
|
+
long_desc <<-DESC
|
164
|
+
Examples:
|
165
|
+
|
166
|
+
$ sem shared-configs:files:list renderedtext/secrets
|
167
|
+
ID NAME ENCRYPTED? CONTENT
|
168
|
+
9997ed43-ac8a-487e-b488-c38bc757a034 SECRET true aaa
|
169
|
+
1117ed43-tc8a-387e-6488-838bc757a034 TOKEN true *encrypted*
|
170
|
+
DESC
|
97
171
|
def list(shared_config_name)
|
98
172
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
99
173
|
env_vars = shared_config.env_vars
|
@@ -108,17 +182,28 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
108
182
|
desc "add", "add an environment variable to the shared configuration"
|
109
183
|
option :name, :aliases => "n", :desc => "Name of the variable", :required => true
|
110
184
|
option :content, :aliases => "c", :desc => "Content of the variable", :required => true
|
111
|
-
|
185
|
+
long_desc <<-DESC
|
186
|
+
Examples:
|
187
|
+
|
188
|
+
$ sem shared-configs:env-vars:add renderedtext/secrets --name TOKEN --content "s3cr3t"
|
189
|
+
Added TOKEN to renderedtext/secrets.
|
190
|
+
DESC
|
112
191
|
def add(shared_config_name)
|
113
192
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
114
193
|
|
115
|
-
shared_config.add_env_var(:name => options[:name], :content => options[:content], :encrypted =>
|
194
|
+
shared_config.add_env_var(:name => options[:name], :content => options[:content], :encrypted => true)
|
116
195
|
|
117
|
-
puts "Added #{options[:name]} to #{shared_config_name}"
|
196
|
+
puts "Added #{options[:name]} to #{shared_config_name}."
|
118
197
|
end
|
119
198
|
|
120
199
|
desc "remove", "remove an environment variable from the shared configuration"
|
121
200
|
option :name, :aliases => "n", :desc => "Name of the variable", :required => true
|
201
|
+
long_desc <<-DESC
|
202
|
+
Examples:
|
203
|
+
|
204
|
+
$ sem shared-configs:env-vars:remove renderedtext/secrets --name TOKEN
|
205
|
+
Removed TOKEN from renderedtext/secrets.
|
206
|
+
DESC
|
122
207
|
def remove(shared_config_name)
|
123
208
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
124
209
|
name = options[:name]
|
data/lib/sem/cli/teams.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
-
class Sem::CLI::Teams < Dracula
|
1
|
+
class Sem::CLI::Teams < Dracula # rubocop:disable Metrics/ClassLength
|
2
2
|
|
3
3
|
ALLOWED_PERMISSIONS = ["admin", "edit", "read"].freeze
|
4
4
|
|
5
|
-
desc "list", "list teams"
|
5
|
+
desc "list", "list all your teams"
|
6
|
+
long_desc <<-DESC
|
7
|
+
Examples:
|
8
|
+
|
9
|
+
$ sem teams:list
|
10
|
+
ID NAME PERMISSION MEMBERS
|
11
|
+
1bc7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/devs write 2 members
|
12
|
+
1bc7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/admins write 0 members
|
13
|
+
DESC
|
6
14
|
def list
|
7
15
|
teams = Sem::API::Team.all
|
8
16
|
|
@@ -14,6 +22,17 @@ class Sem::CLI::Teams < Dracula
|
|
14
22
|
end
|
15
23
|
|
16
24
|
desc "info", "show information about a team"
|
25
|
+
long_desc <<-DESC
|
26
|
+
Examples:
|
27
|
+
|
28
|
+
$ sem teams:info renderedtext/admins
|
29
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
30
|
+
Name renderedtext/admins
|
31
|
+
Permission edit
|
32
|
+
Members 2 members
|
33
|
+
Created 2017-08-01 13:14:40 +0200
|
34
|
+
Updated 2017-08-02 13:14:40 +0200
|
35
|
+
DESC
|
17
36
|
def info(team_name)
|
18
37
|
team = Sem::API::Team.find!(team_name)
|
19
38
|
|
@@ -24,6 +43,33 @@ class Sem::CLI::Teams < Dracula
|
|
24
43
|
option :permission, :default => "read",
|
25
44
|
:aliases => "p",
|
26
45
|
:desc => "Permission level of the team in the organization"
|
46
|
+
long_desc <<-DESC
|
47
|
+
Examples:
|
48
|
+
|
49
|
+
$ sem teams:create renderedtext/interns
|
50
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
51
|
+
Name renderedtext/interns
|
52
|
+
Permission read
|
53
|
+
Members 0 members
|
54
|
+
Created 2017-08-01 13:14:40 +0200
|
55
|
+
Updated 2017-08-02 13:14:40 +0200
|
56
|
+
|
57
|
+
$ sem teams:create renderedtext/devs --permission edit
|
58
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
59
|
+
Name renderedtext/devs
|
60
|
+
Permission edit
|
61
|
+
Members 0 members
|
62
|
+
Created 2017-08-01 13:14:40 +0200
|
63
|
+
Updated 2017-08-02 13:14:40 +0200
|
64
|
+
|
65
|
+
$ sem teams:create renderedtext/admins --permission admin
|
66
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
67
|
+
Name renderedtext/admins
|
68
|
+
Permission admin
|
69
|
+
Members 0 members
|
70
|
+
Created 2017-08-01 13:14:40 +0200
|
71
|
+
Updated 2017-08-02 13:14:40 +0200
|
72
|
+
DESC
|
27
73
|
def create(team_name)
|
28
74
|
permission = options[:permission]
|
29
75
|
|
@@ -37,6 +83,17 @@ class Sem::CLI::Teams < Dracula
|
|
37
83
|
end
|
38
84
|
|
39
85
|
desc "rename", "change the name of the team"
|
86
|
+
long_desc <<-DESC
|
87
|
+
Examples:
|
88
|
+
|
89
|
+
$ sem teams:create renderedtext/interns renderedtext/juniors
|
90
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
91
|
+
Name renderedtext/juniors
|
92
|
+
Permission read
|
93
|
+
Members 0 members
|
94
|
+
Created 2017-08-01 13:14:40 +0200
|
95
|
+
Updated 2017-08-02 13:14:40 +0200
|
96
|
+
DESC
|
40
97
|
def rename(old_team_name, new_team_name)
|
41
98
|
old_org_name, _old_name = Sem::SRN.parse_team(old_team_name)
|
42
99
|
new_org_name, new_name = Sem::SRN.parse_team(new_team_name)
|
@@ -54,6 +111,17 @@ class Sem::CLI::Teams < Dracula
|
|
54
111
|
:required => true,
|
55
112
|
:aliases => "p",
|
56
113
|
:desc => "Permission level of the team in the organization"
|
114
|
+
long_desc <<-DESC
|
115
|
+
Examples:
|
116
|
+
|
117
|
+
$ sem teams:set-permission renderedtext/interns --permission edit
|
118
|
+
ID 1bc7ed43-ac8a-487e-b488-c38bc757a034
|
119
|
+
Name renderedtext/interns
|
120
|
+
Permission edit
|
121
|
+
Members 0 members
|
122
|
+
Created 2017-08-01 13:14:40 +0200
|
123
|
+
Updated 2017-08-02 13:14:40 +0200
|
124
|
+
DESC
|
57
125
|
def set_permission(team_name) # rubocop:disable Style/AccessorMethodName
|
58
126
|
permission = options[:permission]
|
59
127
|
|
@@ -68,6 +136,12 @@ class Sem::CLI::Teams < Dracula
|
|
68
136
|
end
|
69
137
|
|
70
138
|
desc "delete", "removes a team from your organization"
|
139
|
+
long_desc <<-DESC
|
140
|
+
Examples:
|
141
|
+
|
142
|
+
$ sem teams:delete renderedtext/interns
|
143
|
+
Team renderedtext/interns deleted.
|
144
|
+
DESC
|
71
145
|
def delete(team_name)
|
72
146
|
team = Sem::API::Team.find!(team_name)
|
73
147
|
team.delete!
|
@@ -76,7 +150,16 @@ class Sem::CLI::Teams < Dracula
|
|
76
150
|
end
|
77
151
|
|
78
152
|
class Members < Dracula
|
79
|
-
desc "list", "
|
153
|
+
desc "list", "list members of the team"
|
154
|
+
long_desc <<-DESC
|
155
|
+
Examples:
|
156
|
+
|
157
|
+
$ sem teams:members:list renderedtext/interns
|
158
|
+
NAME
|
159
|
+
shiroyasha
|
160
|
+
darko
|
161
|
+
ervinb
|
162
|
+
DESC
|
80
163
|
def list(team_name)
|
81
164
|
team = Sem::API::Team.find!(team_name)
|
82
165
|
users = team.users
|
@@ -89,6 +172,12 @@ class Sem::CLI::Teams < Dracula
|
|
89
172
|
end
|
90
173
|
|
91
174
|
desc "add", "add a user to the team"
|
175
|
+
long_desc <<-DESC
|
176
|
+
Examples:
|
177
|
+
|
178
|
+
$ sem teams:members:add renderedtext/interns shiroyasha
|
179
|
+
User shiroyasha added to the team.
|
180
|
+
DESC
|
92
181
|
def add(team_name, username)
|
93
182
|
team = Sem::API::Team.find!(team_name)
|
94
183
|
team.add_user(username)
|
@@ -96,7 +185,13 @@ class Sem::CLI::Teams < Dracula
|
|
96
185
|
puts "User #{username} added to the team."
|
97
186
|
end
|
98
187
|
|
99
|
-
desc "remove", "
|
188
|
+
desc "remove", "remove a user from the team"
|
189
|
+
long_desc <<-DESC
|
190
|
+
Examples:
|
191
|
+
|
192
|
+
$ sem teams:members:remove renderedtext/interns shiroyasha
|
193
|
+
User shiroyasha removed from the team.
|
194
|
+
DESC
|
100
195
|
def remove(team_name, username)
|
101
196
|
team = Sem::API::Team.find!(team_name)
|
102
197
|
team.remove_user(username)
|
@@ -106,7 +201,16 @@ class Sem::CLI::Teams < Dracula
|
|
106
201
|
end
|
107
202
|
|
108
203
|
class Projects < Dracula
|
109
|
-
desc "list", "
|
204
|
+
desc "list", "list projects in a team"
|
205
|
+
long_desc <<-DESC
|
206
|
+
Examples:
|
207
|
+
|
208
|
+
$ sem team:projects:list renderedtext/devs
|
209
|
+
NAME
|
210
|
+
ID NAME
|
211
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/cli
|
212
|
+
12c7ed43-4444-487e-b488-c38bc757a034 renderedtext/api
|
213
|
+
DESC
|
110
214
|
def list(team_name)
|
111
215
|
team = Sem::API::Team.find!(team_name)
|
112
216
|
projects = team.projects
|
@@ -119,6 +223,12 @@ class Sem::CLI::Teams < Dracula
|
|
119
223
|
end
|
120
224
|
|
121
225
|
desc "add", "add a project to a team"
|
226
|
+
long_desc <<-DESC
|
227
|
+
Examples:
|
228
|
+
|
229
|
+
$ sem team:projects:add renderedtext/devs renderedtext/cli
|
230
|
+
Project renderedtext/cli added to the team.
|
231
|
+
DESC
|
122
232
|
def add(team_name, project_name)
|
123
233
|
team = Sem::API::Team.find!(team_name)
|
124
234
|
project = Sem::API::Project.find!(project_name)
|
@@ -128,7 +238,13 @@ class Sem::CLI::Teams < Dracula
|
|
128
238
|
puts "Project #{project_name} added to the team."
|
129
239
|
end
|
130
240
|
|
131
|
-
desc "remove", "
|
241
|
+
desc "remove", "remove a project from the team"
|
242
|
+
long_desc <<-DESC
|
243
|
+
Examples:
|
244
|
+
|
245
|
+
$ sem team:projects:remove renderedtext/devs renderedtext/cli
|
246
|
+
Project renderedtext/cli removed from the team.
|
247
|
+
DESC
|
132
248
|
def remove(team_name, project_name)
|
133
249
|
team = Sem::API::Team.find!(team_name)
|
134
250
|
project = Sem::API::Project.find!(project_name)
|
@@ -141,6 +257,14 @@ class Sem::CLI::Teams < Dracula
|
|
141
257
|
|
142
258
|
class SharedConfigs < Dracula
|
143
259
|
desc "list", "list shared configurations in a team"
|
260
|
+
long_desc <<-DESC
|
261
|
+
Examples:
|
262
|
+
|
263
|
+
$ sem team:shared-configs:list renderedtext/devs
|
264
|
+
ID NAME CONFIG FILES ENV VARS
|
265
|
+
99c7ed43-ac8a-487e-b488-c38bc757a034 renderedtext/tokens 1 0
|
266
|
+
1133ed43-ac8a-487e-b488-c38bc757a044 renderedtext/secrets 0 1
|
267
|
+
DESC
|
144
268
|
def list(team_name)
|
145
269
|
team = Sem::API::Team.find!(team_name)
|
146
270
|
configs = team.shared_configs
|
@@ -153,6 +277,12 @@ class Sem::CLI::Teams < Dracula
|
|
153
277
|
end
|
154
278
|
|
155
279
|
desc "add", "add a shared configuration to a team"
|
280
|
+
long_desc <<-DESC
|
281
|
+
Examples:
|
282
|
+
|
283
|
+
$ sem team:shared-configs:add renderedtext/devs renderedtext/secrets
|
284
|
+
Shared Configuration renderedtext/secrets added to the team.
|
285
|
+
DESC
|
156
286
|
def add(team_name, shared_config_name)
|
157
287
|
team = Sem::API::Team.find!(team_name)
|
158
288
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
@@ -163,6 +293,12 @@ class Sem::CLI::Teams < Dracula
|
|
163
293
|
end
|
164
294
|
|
165
295
|
desc "remove", "removes a shared Configuration from the team"
|
296
|
+
long_desc <<-DESC
|
297
|
+
Examples:
|
298
|
+
|
299
|
+
$ sem team:shared-configs:remove renderedtext/devs renderedtext/secrets
|
300
|
+
Shared Configuration renderedtext/secrets removed from the team.
|
301
|
+
DESC
|
166
302
|
def remove(team_name, shared_config_name)
|
167
303
|
team = Sem::API::Team.find!(team_name)
|
168
304
|
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
data/lib/sem/cli.rb
CHANGED
@@ -12,10 +12,15 @@ module Sem
|
|
12
12
|
puts Sem::VERSION
|
13
13
|
end
|
14
14
|
|
15
|
-
desc "login", "Log in to
|
15
|
+
desc "login", "Log in to Semaphore from the command line"
|
16
16
|
option "auth-token", :required => true
|
17
17
|
long_desc <<-DESC
|
18
|
-
|
18
|
+
Examples:
|
19
|
+
|
20
|
+
$ sem login --auth-token abcd12345
|
21
|
+
Your credentials have been saved to #{Sem::Configuration::CREDENTIALS_PATH}."
|
22
|
+
|
23
|
+
You can find your auth-token on the bottom of the users settings page <https://semaphoreci.com/users/edit>.
|
19
24
|
DESC
|
20
25
|
def login
|
21
26
|
auth_token = options["auth-token"]
|
@@ -30,10 +35,16 @@ DESC
|
|
30
35
|
end
|
31
36
|
|
32
37
|
desc "logout", "Log out from semaphore"
|
38
|
+
long_desc <<-DESC
|
39
|
+
Examples:
|
40
|
+
|
41
|
+
$ sem logout
|
42
|
+
Logged out.
|
43
|
+
DESC
|
33
44
|
def logout
|
34
45
|
Sem::Configuration.delete_auth_token
|
35
46
|
|
36
|
-
puts "
|
47
|
+
puts "Logged out."
|
37
48
|
end
|
38
49
|
|
39
50
|
register "orgs", "manage organizations", Sem::CLI::Orgs
|
data/lib/sem/version.rb
CHANGED
data/lib/sem/views/files.rb
CHANGED
data/sem.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency "semaphore_client", "2.8.1"
|
25
|
-
spec.add_dependency "dracula", "~> 0.
|
25
|
+
spec.add_dependency "dracula", "~> 0.6.0"
|
26
26
|
spec.add_dependency "pmap", "~> 1.1.1"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.14"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semaphore_client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pmap
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- README.md
|
194
194
|
- Rakefile
|
195
195
|
- bin/console
|
196
|
+
- bin/generate_json_structure
|
196
197
|
- bin/setup
|
197
198
|
- exe/sem
|
198
199
|
- guides.md
|