sem 0.2.3 → 0.2.4
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/.rubocop.yml +1 -1
- data/lib/sem/api/base.rb +11 -13
- data/lib/sem/api/env_var.rb +7 -0
- data/lib/sem/api/file.rb +7 -0
- data/lib/sem/api/org.rb +28 -0
- data/lib/sem/api/project.rb +50 -0
- data/lib/sem/api/shared_config.rb +109 -0
- data/lib/sem/api/team.rb +90 -0
- data/lib/sem/api/user.rb +8 -0
- data/lib/sem/api.rb +7 -8
- data/lib/sem/cli/orgs.rb +12 -12
- data/lib/sem/cli/projects.rb +30 -32
- data/lib/sem/cli/shared_configs.rb +71 -67
- data/lib/sem/cli/teams.rb +84 -106
- data/lib/sem/version.rb +1 -1
- data/lib/sem/views/env_vars.rb +2 -2
- data/lib/sem/views/files.rb +2 -2
- data/lib/sem/views/orgs.rb +12 -14
- data/lib/sem/views/projects.rb +28 -29
- data/lib/sem/views/shared_configs.rb +32 -20
- data/lib/sem/views/teams.rb +47 -65
- data/lib/sem/views/users.rb +6 -6
- data/lib/sem.rb +5 -0
- data/sem.gemspec +4 -0
- metadata +59 -36
- data/lib/sem/api/env_vars.rb +0 -22
- data/lib/sem/api/files.rb +0 -21
- data/lib/sem/api/orgs.rb +0 -42
- data/lib/sem/api/projects.rb +0 -42
- data/lib/sem/api/shared_configs.rb +0 -103
- data/lib/sem/api/teams.rb +0 -69
- data/lib/sem/api/traits/associated_with_org.rb +0 -17
- data/lib/sem/api/traits/associated_with_project.rb +0 -29
- data/lib/sem/api/traits/associated_with_shared_config.rb +0 -31
- data/lib/sem/api/traits/associated_with_team.rb +0 -29
- data/lib/sem/api/traits.rb +0 -10
- data/lib/sem/api/users.rb +0 -44
@@ -2,121 +2,125 @@ class Sem::CLI::SharedConfigs < Dracula
|
|
2
2
|
|
3
3
|
desc "list", "list shared cofigurations"
|
4
4
|
def list
|
5
|
-
shared_configs = Sem::API::
|
5
|
+
shared_configs = Sem::API::SharedConfig.all
|
6
6
|
|
7
|
-
|
7
|
+
if !shared_configs.empty?
|
8
|
+
Sem::Views::SharedConfigs.list(shared_configs)
|
9
|
+
else
|
10
|
+
Sem::Views::SharedConfigs.setup_first_shared_config
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
desc "info", "show information about a shared configuration"
|
11
|
-
def info(
|
12
|
-
|
13
|
-
|
14
|
-
shared_config_instance = Sem::API::SharedConfigs.info(org_name, shared_config_name).to_h
|
15
|
+
def info(shared_config_name)
|
16
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
15
17
|
|
16
|
-
Sem::Views::SharedConfigs.info(
|
18
|
+
Sem::Views::SharedConfigs.info(shared_config)
|
17
19
|
end
|
18
20
|
|
19
21
|
desc "create", "create a new shared configuration"
|
20
|
-
def create(
|
21
|
-
|
22
|
+
def create(shared_config_name)
|
23
|
+
shared_config = Sem::API::SharedConfig.create!(shared_config_name)
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
Sem::Views::SharedConfigs.info(shared_config_instance)
|
25
|
+
Sem::Views::SharedConfigs.info(shared_config)
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "rename", "rename a shared configuration"
|
29
|
-
def rename(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if old_org_name != new_org_name
|
34
|
-
abort Sem::Views::SharedConfigs.org_names_not_matching("old shared configuration name",
|
35
|
-
"new shared configuration name",
|
36
|
-
old_shared_config,
|
37
|
-
new_shared_config)
|
38
|
-
end
|
29
|
+
def rename(old_shared_config_name, new_shared_config_name)
|
30
|
+
shared_config = Sem::API::SharedConfig.find!(old_shared_config_name)
|
31
|
+
shared_config = shared_config.update!(:name => new_shared_config_name)
|
39
32
|
|
40
|
-
|
41
|
-
old_shared_config_name,
|
42
|
-
:name => new_shared_config_name)
|
43
|
-
|
44
|
-
Sem::Views::SharedConfigs.info(shared_config_instance)
|
33
|
+
Sem::Views::SharedConfigs.info(shared_config)
|
45
34
|
end
|
46
35
|
|
47
36
|
desc "delete", "removes a shared configuration from your organization"
|
48
|
-
def delete(
|
49
|
-
|
50
|
-
|
51
|
-
Sem::API::SharedConfigs.delete(org_name, shared_config_name)
|
37
|
+
def delete(shared_config_name)
|
38
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
39
|
+
shared_config.delete!
|
52
40
|
|
53
|
-
puts "Deleted shared configuration #{
|
41
|
+
puts "Deleted shared configuration #{shared_config_name}"
|
54
42
|
end
|
55
43
|
|
56
44
|
class Files < Dracula
|
57
|
-
desc "list", "list files in the shared configuration"
|
58
|
-
def list(shared_config)
|
59
|
-
org_name, shared_config_name = Sem::SRN.parse_shared_config(shared_config)
|
60
|
-
|
61
|
-
files = Sem::API::SharedConfigs.list_files(org_name, shared_config_name)
|
62
45
|
|
63
|
-
|
46
|
+
desc "list", "list files in the shared configuration"
|
47
|
+
def list(shared_config_name)
|
48
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
49
|
+
files = shared_config.files
|
50
|
+
|
51
|
+
if !files.empty?
|
52
|
+
Sem::Views::Files.list(files)
|
53
|
+
else
|
54
|
+
Sem::Views::SharedConfigs.add_first_file(shared_config)
|
55
|
+
end
|
64
56
|
end
|
65
57
|
|
66
58
|
desc "add", "add a file to the shared configuration"
|
67
|
-
option
|
68
|
-
|
69
|
-
|
59
|
+
option "path-on-semaphore", :aliases => "p", :desc => "Path of the file in builds", :required => true
|
60
|
+
option "local-path", :aliases => "l", :desc => "Location of the file on the local machine", :required => true
|
61
|
+
def add(shared_config_name)
|
62
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
63
|
+
|
64
|
+
local_path = options["local-path"]
|
70
65
|
|
71
|
-
|
66
|
+
abort "File #{local_path} not found" unless File.exist?(local_path)
|
72
67
|
|
73
|
-
|
68
|
+
path = options["path-on-semaphore"]
|
69
|
+
content = File.read(local_path)
|
74
70
|
|
75
|
-
|
71
|
+
shared_config.add_config_file(:path => path, :content => content)
|
72
|
+
|
73
|
+
puts "Added #{path} to #{shared_config_name}"
|
76
74
|
end
|
77
75
|
|
78
76
|
desc "remove", "remove a file from the shared configuration"
|
79
|
-
|
80
|
-
|
77
|
+
option :path, :aliases => "p", :desc => "Path of the file in builds", :required => true
|
78
|
+
def remove(shared_config_name)
|
79
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
81
80
|
|
82
|
-
|
81
|
+
shared_config.remove_config_file(options[:path])
|
83
82
|
|
84
|
-
puts "Removed #{
|
83
|
+
puts "Removed #{options[:path]} from #{shared_config_name}"
|
85
84
|
end
|
85
|
+
|
86
86
|
end
|
87
87
|
|
88
88
|
class EnvVars < Dracula
|
89
|
-
desc "list", "list environment variables in the shared configuration"
|
90
|
-
def list(shared_config)
|
91
|
-
org_name, shared_config_name = Sem::SRN.parse_shared_config(shared_config)
|
92
|
-
|
93
|
-
env_vars = Sem::API::SharedConfigs.list_env_vars(org_name, shared_config_name)
|
94
89
|
|
95
|
-
|
90
|
+
desc "list", "list environment variables in the shared configuration"
|
91
|
+
def list(shared_config_name)
|
92
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
93
|
+
env_vars = shared_config.env_vars
|
94
|
+
|
95
|
+
if !env_vars.empty?
|
96
|
+
Sem::Views::EnvVars.list(env_vars)
|
97
|
+
else
|
98
|
+
Sem::Views::SharedConfigs.add_first_env_var(shared_config)
|
99
|
+
end
|
96
100
|
end
|
97
101
|
|
98
102
|
desc "add", "add an environment variable to the shared configuration"
|
99
|
-
option :name, :aliases => "
|
100
|
-
option :content, :aliases => "
|
101
|
-
def add(
|
102
|
-
|
103
|
+
option :name, :aliases => "n", :desc => "Name of the variable", :required => true
|
104
|
+
option :content, :aliases => "c", :desc => "Content of the variable", :required => true
|
105
|
+
def add(shared_config_name)
|
106
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
103
107
|
|
104
|
-
|
105
|
-
shared_config_name,
|
106
|
-
:name => options[:name],
|
107
|
-
:content => options[:content])
|
108
|
+
shared_config.add_env_var(:name => options[:name], :content => options[:content])
|
108
109
|
|
109
|
-
puts "Added #{options[:name]} to #{
|
110
|
+
puts "Added #{options[:name]} to #{shared_config_name}"
|
110
111
|
end
|
111
112
|
|
112
113
|
desc "remove", "remove an environment variable from the shared configuration"
|
113
|
-
|
114
|
-
|
114
|
+
option :name, :aliases => "n", :desc => "Name of the variable", :required => true
|
115
|
+
def remove(shared_config_name)
|
116
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
117
|
+
name = options[:name]
|
115
118
|
|
116
|
-
|
119
|
+
shared_config.remove_env_var(name)
|
117
120
|
|
118
|
-
puts "Removed #{
|
121
|
+
puts "Removed #{name} from #{shared_config_name}"
|
119
122
|
end
|
123
|
+
|
120
124
|
end
|
121
125
|
|
122
126
|
register "files", "manage files", Files
|
data/lib/sem/cli/teams.rb
CHANGED
@@ -2,177 +2,155 @@ class Sem::CLI::Teams < Dracula
|
|
2
2
|
|
3
3
|
desc "list", "list teams"
|
4
4
|
def list
|
5
|
-
teams = Sem::API::
|
5
|
+
teams = Sem::API::Team.all
|
6
6
|
|
7
|
-
|
7
|
+
if !teams.empty?
|
8
|
+
Sem::Views::Teams.list(teams)
|
9
|
+
else
|
10
|
+
Sem::Views::Teams.create_first_team
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
desc "info", "show information about a team"
|
11
|
-
def info(
|
12
|
-
|
13
|
-
|
14
|
-
team_instance = Sem::API::Teams.info(org_name, team_name).to_h
|
15
|
+
def info(team_name)
|
16
|
+
team = Sem::API::Team.find!(team_name)
|
15
17
|
|
16
|
-
Sem::Views::Teams.info(
|
18
|
+
Sem::Views::Teams.info(team)
|
17
19
|
end
|
18
20
|
|
19
21
|
desc "create", "create a new team"
|
20
22
|
option :permission, :default => "read",
|
21
|
-
:aliases => "
|
23
|
+
:aliases => "p",
|
22
24
|
:desc => "Permission level of the team in the organization"
|
23
|
-
def create(
|
24
|
-
|
25
|
+
def create(team_name)
|
26
|
+
team = Sem::API::Team.create!(team_name, :permission => options[:permission])
|
25
27
|
|
26
|
-
|
27
|
-
:name => team_name,
|
28
|
-
:permission => options[:permission])
|
29
|
-
|
30
|
-
Sem::Views::Teams.info(team_instance)
|
28
|
+
Sem::Views::Teams.info(team)
|
31
29
|
end
|
32
30
|
|
33
31
|
desc "rename", "change the name of the team"
|
34
|
-
def rename(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if old_org_name != new_org_name
|
39
|
-
abort Sem::Views::Teams.org_names_not_matching("old team name", "new team name", old_team, new_team)
|
40
|
-
end
|
41
|
-
|
42
|
-
team_instance = Sem::API::Teams.update(old_org_name, old_team_name, :name => new_team_name)
|
32
|
+
def rename(old_team_name, new_team_name)
|
33
|
+
team = Sem::API::Team.find!(old_team_name)
|
34
|
+
team = team.update(:name => new_team_name)
|
43
35
|
|
44
|
-
Sem::Views::Teams.info(
|
36
|
+
Sem::Views::Teams.info(team)
|
45
37
|
end
|
46
38
|
|
47
39
|
desc "set-permission", "set the permission level of the team"
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
team_instance = Sem::API::Teams.update(org_name, team_name, :permission => permission)
|
40
|
+
option :permission, :default => "read",
|
41
|
+
:required => true,
|
42
|
+
:aliases => "p",
|
43
|
+
:desc => "Permission level of the team in the organization"
|
44
|
+
def set_permission(team_name) # rubocop:disable Style/AccessorMethodName
|
45
|
+
team = Sem::API::Team.find!(team_name)
|
46
|
+
team = team.update(:permission => options[:permission])
|
57
47
|
|
58
|
-
Sem::Views::Teams.info(
|
48
|
+
Sem::Views::Teams.info(team)
|
59
49
|
end
|
60
50
|
|
61
51
|
desc "delete", "removes a team from your organization"
|
62
|
-
def delete(
|
63
|
-
|
64
|
-
|
65
|
-
Sem::API::Teams.delete(org_name, team_name)
|
52
|
+
def delete(team_name)
|
53
|
+
team = Sem::API::Team.find!(team_name)
|
54
|
+
team.delete!
|
66
55
|
|
67
|
-
puts "
|
56
|
+
puts "Team #{team_name} deleted."
|
68
57
|
end
|
69
58
|
|
70
59
|
class Members < Dracula
|
71
60
|
desc "list", "lists members of the team"
|
72
|
-
def list(
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
61
|
+
def list(team_name)
|
62
|
+
team = Sem::API::Team.find!(team_name)
|
63
|
+
users = team.users
|
64
|
+
|
65
|
+
if !users.empty?
|
66
|
+
Sem::Views::Users.list(users)
|
67
|
+
else
|
68
|
+
Sem::Views::Teams.add_first_team_member(team)
|
69
|
+
end
|
78
70
|
end
|
79
71
|
|
80
72
|
desc "add", "add a user to the team"
|
81
|
-
def add(
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
Sem::API::Users.add_to_team(org_name, team_name, user_name)
|
73
|
+
def add(team_name, username)
|
74
|
+
team = Sem::API::Team.find!(team_name)
|
75
|
+
team.add_user(username)
|
86
76
|
|
87
|
-
puts "User #{
|
77
|
+
puts "User #{username} added to the team."
|
88
78
|
end
|
89
79
|
|
90
80
|
desc "remove", "removes a user from the team"
|
91
|
-
def remove(
|
92
|
-
|
93
|
-
|
81
|
+
def remove(team_name, username)
|
82
|
+
team = Sem::API::Team.find!(team_name)
|
83
|
+
team.remove_user(username)
|
94
84
|
|
95
|
-
|
96
|
-
|
97
|
-
puts "User #{user_name} removed from the team."
|
85
|
+
puts "User #{username} removed from the team."
|
98
86
|
end
|
99
87
|
end
|
100
88
|
|
101
89
|
class Projects < Dracula
|
102
90
|
desc "list", "lists projects in a team"
|
103
|
-
def list(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
def list(team_name)
|
92
|
+
team = Sem::API::Team.find!(team_name)
|
93
|
+
projects = team.projects
|
94
|
+
|
95
|
+
if !projects.empty?
|
96
|
+
Sem::Views::Projects.list(projects)
|
97
|
+
else
|
98
|
+
Sem::Views::Teams.add_first_project(team)
|
99
|
+
end
|
109
100
|
end
|
110
101
|
|
111
102
|
desc "add", "add a project to a team"
|
112
|
-
def add(
|
113
|
-
|
114
|
-
|
103
|
+
def add(team_name, project_name)
|
104
|
+
team = Sem::API::Team.find!(team_name)
|
105
|
+
project = Sem::API::Project.find!(project_name)
|
115
106
|
|
116
|
-
|
117
|
-
abort Sem::Views::Teams.org_names_not_matching("team", "project", team, project)
|
118
|
-
end
|
119
|
-
|
120
|
-
Sem::API::Projects.add_to_team(team_org_name, team_name, project_name)
|
107
|
+
team.add_project(project)
|
121
108
|
|
122
|
-
puts "Project #{
|
109
|
+
puts "Project #{project_name} added to the team."
|
123
110
|
end
|
124
111
|
|
125
112
|
desc "remove", "removes a project from the team"
|
126
|
-
def remove(
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
if team_org_name != project_org_name
|
131
|
-
abort Sem::Views::Teams.org_names_not_matching("team", "project", team, project)
|
132
|
-
end
|
113
|
+
def remove(team_name, project_name)
|
114
|
+
team = Sem::API::Team.find!(team_name)
|
115
|
+
project = Sem::API::Project.find!(project_name)
|
133
116
|
|
134
|
-
|
117
|
+
team.remove_project(project)
|
135
118
|
|
136
|
-
puts "Project #{
|
119
|
+
puts "Project #{project_name} removed from the team."
|
137
120
|
end
|
138
121
|
end
|
139
122
|
|
140
123
|
class SharedConfigs < Dracula
|
141
124
|
desc "list", "list shared configurations in a team"
|
142
|
-
def list(
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
125
|
+
def list(team_name)
|
126
|
+
team = Sem::API::Team.find!(team_name)
|
127
|
+
configs = team.shared_configs
|
128
|
+
|
129
|
+
if !configs.empty?
|
130
|
+
Sem::Views::SharedConfigs.list(configs)
|
131
|
+
else
|
132
|
+
Sem::Views::Teams.add_first_shared_config(team)
|
133
|
+
end
|
148
134
|
end
|
149
135
|
|
150
136
|
desc "add", "add a shared configuration to a team"
|
151
|
-
def add(
|
152
|
-
|
153
|
-
|
137
|
+
def add(team_name, shared_config_name)
|
138
|
+
team = Sem::API::Team.find!(team_name)
|
139
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
154
140
|
|
155
|
-
|
156
|
-
abort Sem::Views::Teams.org_names_not_matching("team", "shared configuration", team, shared_config)
|
157
|
-
end
|
141
|
+
team.add_shared_config(shared_config)
|
158
142
|
|
159
|
-
|
160
|
-
|
161
|
-
puts "Shared Configuration #{team_org_name}/#{shared_config_name} added to the team."
|
143
|
+
puts "Shared Configuration #{shared_config_name} added to the team."
|
162
144
|
end
|
163
145
|
|
164
146
|
desc "remove", "removes a shared Configuration from the team"
|
165
|
-
def remove(
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
if team_org_name != shared_config_org_name
|
170
|
-
abort Sem::Views::Teams.org_names_not_matching("team", "shared configuration", team, shared_config)
|
171
|
-
end
|
147
|
+
def remove(team_name, shared_config_name)
|
148
|
+
team = Sem::API::Team.find!(team_name)
|
149
|
+
shared_config = Sem::API::SharedConfig.find!(shared_config_name)
|
172
150
|
|
173
|
-
|
151
|
+
team.remove_shared_config(shared_config)
|
174
152
|
|
175
|
-
puts "Shared Configuration #{
|
153
|
+
puts "Shared Configuration #{shared_config_name} removed from the team."
|
176
154
|
end
|
177
155
|
end
|
178
156
|
|
data/lib/sem/version.rb
CHANGED
data/lib/sem/views/env_vars.rb
CHANGED
@@ -3,8 +3,8 @@ class Sem::Views::EnvVars < Sem::Views::Base
|
|
3
3
|
def self.list(env_vars)
|
4
4
|
header = ["ID", "NAME", "ENCRYPTED?", "CONTENT"]
|
5
5
|
|
6
|
-
body = env_vars.map do |
|
7
|
-
[
|
6
|
+
body = env_vars.map do |var|
|
7
|
+
[var.id, var.name, var.encrypted?, var.content]
|
8
8
|
end
|
9
9
|
|
10
10
|
print_table([header, *body])
|
data/lib/sem/views/files.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class Sem::Views::Files < Sem::Views::Base
|
2
2
|
|
3
3
|
def self.list(files)
|
4
|
-
header = ["ID", "
|
4
|
+
header = ["ID", "PATH", "ENCRYPTED?"]
|
5
5
|
|
6
6
|
body = files.map do |file|
|
7
|
-
[file
|
7
|
+
[file.id, file.path, file.encrypted?]
|
8
8
|
end
|
9
9
|
|
10
10
|
print_table([header, *body])
|
data/lib/sem/views/orgs.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
class Sem::Views::Orgs < Sem::Views::Base
|
2
2
|
|
3
|
-
def self.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return
|
11
|
-
end
|
3
|
+
def self.create_first_org
|
4
|
+
puts "You don't belong to any organization."
|
5
|
+
puts ""
|
6
|
+
puts "Create your first organization: https://semaphoreci.com/organizations/new."
|
7
|
+
puts ""
|
8
|
+
end
|
12
9
|
|
10
|
+
def self.list(orgs)
|
13
11
|
header = ["ID", "NAME"]
|
14
12
|
|
15
13
|
body = orgs.map do |org|
|
16
|
-
[org
|
14
|
+
[org.id, org.username]
|
17
15
|
end
|
18
16
|
|
19
17
|
print_table [header, *body]
|
@@ -21,10 +19,10 @@ class Sem::Views::Orgs < Sem::Views::Base
|
|
21
19
|
|
22
20
|
def self.info(org)
|
23
21
|
print_table [
|
24
|
-
["ID", org
|
25
|
-
["Name", org
|
26
|
-
["Created", org
|
27
|
-
["Updated", org
|
22
|
+
["ID", org.id],
|
23
|
+
["Name", org.username],
|
24
|
+
["Created", org.created_at],
|
25
|
+
["Updated", org.updated_at]
|
28
26
|
]
|
29
27
|
end
|
30
28
|
|
data/lib/sem/views/projects.rb
CHANGED
@@ -1,39 +1,38 @@
|
|
1
1
|
class Sem::Views::Projects < Sem::Views::Base
|
2
|
-
class << self
|
3
|
-
def list(projects)
|
4
|
-
if projects.empty?
|
5
|
-
puts "You don't have any project configured on Semaphore."
|
6
|
-
puts ""
|
7
|
-
puts "Add your first project: https://semaphoreci.com/new"
|
8
|
-
puts ""
|
9
2
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[project[:id], name(project)]
|
17
|
-
end
|
3
|
+
def self.setup_first_project
|
4
|
+
puts "You don't have any project configured on Semaphore."
|
5
|
+
puts ""
|
6
|
+
puts "Add your first project: https://semaphoreci.com/new"
|
7
|
+
puts ""
|
8
|
+
end
|
18
9
|
|
19
|
-
|
20
|
-
|
10
|
+
def self.list(projects)
|
11
|
+
header = ["ID", "NAME"]
|
21
12
|
|
22
|
-
|
23
|
-
|
24
|
-
["ID", project[:id]],
|
25
|
-
["Name", name(project)],
|
26
|
-
["Created", project[:created_at]],
|
27
|
-
["Updated", project[:updated_at]]
|
28
|
-
]
|
13
|
+
body = projects.map do |project|
|
14
|
+
[project.id, project.full_name]
|
29
15
|
end
|
30
16
|
|
31
|
-
|
17
|
+
print_table([header, *body])
|
18
|
+
end
|
32
19
|
|
33
|
-
|
34
|
-
|
20
|
+
def self.info(project)
|
21
|
+
print_table [
|
22
|
+
["ID", project.id],
|
23
|
+
["Name", project.full_name],
|
24
|
+
["Created", project.created_at],
|
25
|
+
["Updated", project.updated_at]
|
26
|
+
]
|
27
|
+
end
|
35
28
|
|
36
|
-
|
37
|
-
|
29
|
+
def self.attach_first_shared_config(project)
|
30
|
+
puts "You don't have any shared configurations on this project."
|
31
|
+
puts ""
|
32
|
+
puts "Add your first shared configuration:"
|
33
|
+
puts ""
|
34
|
+
puts " sem projects:shared-configs:add #{project.full_name} SHARED_CONFIG_NAME"
|
35
|
+
puts ""
|
38
36
|
end
|
37
|
+
|
39
38
|
end
|